Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎀 UI Migration Wrap-up #1106

Merged
merged 137 commits into from
Feb 1, 2024

Commits on Nov 21, 2023

  1. Configuration menu
    Copy the full SHA
    6fc9894 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6d64774 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2c92ff9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0092ace View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    dd39c92 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c0170de View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    30eccf3 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c03324f View commit details
    Browse the repository at this point in the history
  9. remove all remaining uses of getAngularService()

    -In useAppConfig.ts, we can't rely on $ionicPlatform anymore since we won't be using Angular moving forward. So we need an alternate way to ensure Cordova plugins are ready before we try to do stuff with them. I found that Cordova fires the 'deviceready' event once plugins are loaded - so we can just listen for that, wrap it in a promise, and use it in the place of $ionicPlatform.ready(...)
    -There were a few uses where getAngularService() was still used to access the old Logger, which were easily substituted to instead use the functions exported from logger.ts (logDebug, logWarn, etc)
    -There were several unused imports left over in files where getAngularService was formerly used and is no longer
    JGreenlee committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    3760d25 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    2a0daf9 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    2871402 View commit details
    Browse the repository at this point in the history
  12. don't use angular in ngApp.js

    The startup logic will now happen not in an Angular context, but with an event listener for 'deviceready' (which is what Cordova uses)
    And the React initialization will happen from there.
    JGreenlee committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    4df43c2 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    3242697 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    5b0cea0 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    ea60154 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    2c4afca View commit details
    Browse the repository at this point in the history
  17. consolidate ngApp.js into index.js

    Since these have both been simplified we can merge them together
    JGreenlee committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    2d438f0 View commit details
    Browse the repository at this point in the history
  18. fix failing test in notifScheduler

    It was failing because 'commHelper' is no longer directly in '/js' -- it is in 'js/services'
    JGreenlee committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    5bb56fe View commit details
    Browse the repository at this point in the history
  19. remove ng-i18next

    JGreenlee committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    80fa776 View commit details
    Browse the repository at this point in the history
  20. remove unused /build folder

    JGreenlee committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    ebe7fe5 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    263c90a View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    99e1090 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2023

  1. comply to Typescript "strictNullChecks": true

    This commit enables strictNullChecks for greater type safety and then fixes the dozens of instances where TS now warns us about values that are potentially null https://www.typescriptlang.org/tsconfig#strictNullChecks
    
    This means adding types on a lot of places where we had not added types before. Typescript is more powerful when it's on a stricter configuration, but this means we have to be more explicit.
    
    In a few of the files, I also cleaned up formatting and modernized syntax while I was making changes there.
    JGreenlee committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    49a1a64 View commit details
    Browse the repository at this point in the history
  2. more type safety to comply with strictNullChecks

    continuation of 49a1a64
    JGreenlee committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    9f7bc4a View commit details
    Browse the repository at this point in the history
  3. clean/reformat pushNotifySettings

    This file had a lot of outdated JS syntax and console.log statements. I just did a full sweep of this file and 'modernized' it.
    Added some type definitions too.
    JGreenlee committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    3d14e37 View commit details
    Browse the repository at this point in the history
  4. use aria-hidden instead of accessibilityHidden

    I previously used the wrong property name here. Now that we have Typescript on a stricter configuration, I found my mistake
    JGreenlee committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    6b70afd View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    72b3f7a View commit details
    Browse the repository at this point in the history
  6. remove french and italian

    We previously had maintainers for the translations in these languages, but they have not been updated in a very long time. Because the app has changed so much since then, the old translations are almost entirely obsolete.
    At this point, I think it is better to remove them from usage. If we ever get someone to update the translations we can add them back.
    We'll still keep the old translations up on the e-mission-translate repo although they won't be used here.
    JGreenlee committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    12133ba View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    b60a05f View commit details
    Browse the repository at this point in the history
  8. add js/types to typeRoots

    VSCode was only picking up on our declaration TS files if they were open in the editor. This signals to VSCode and TS to check js/types for .d.ts files.
    JGreenlee committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    50fb40d View commit details
    Browse the repository at this point in the history
  9. cleanup and fix types in ProfileSettings

    This file was a JSX file until very recently and so a lot of type errors and warnings went unnoticed. There were a lot, so I just went over the whole file - fixing typings, modernizing syntax, and removing things that are unused.
    As part of this I expanded the typings for AppConfig.
    JGreenlee committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    df0f03f View commit details
    Browse the repository at this point in the history
  10. more cleanup related to typings

    Continuing to clean up type warnings that are now showing up since 49a1a64
    JGreenlee committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    9e58c7e View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2023

  1. fix DiaryCard showing current time if blank

    dt might be undefined here (like in the case of the most recent / current place in the timeline)
    In that case we should return nothing instead of letting Luxon create a new date (it would fallback to the current date&time which we don't want)
    JGreenlee committed Nov 29, 2023
    Configuration menu
    Copy the full SHA
    3bebd8c View commit details
    Browse the repository at this point in the history
  2. add TimestampRange type

    this is used in a few places - it's tidier to have a common type definition
    JGreenlee committed Nov 29, 2023
    Configuration menu
    Copy the full SHA
    9a2567c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3e232ab View commit details
    Browse the repository at this point in the history
  4. new LabelTab functions for user inputs

    i) instead of providing timelineLabelMap and timelineNotesMap to the entire component tree under LabelTab, we can pass accessor functions (userInputFor, labelFor, notesFor) to get user inputs in a cleaner way
    
    ii) Unify the structure of how multilabel vs enketo user inputs are kept on the phone. Now both will be the 'raw' format (an object with 'data', 'metadata' etc).
    Note that there is still a discrepancy on the server - for multilabel inputs we get a plain string and for enketo inputs we get the whole userinput entry.
    The plan is to unify this on the server at some point, so I am doing it here on the phone in advance.
    
    iii) instead of using a 'justRepopulated' flag to signify that an entry should not be filtered within 30 seconds of having a user input recorded on it, we can just look at the write_ts in the metadata of that entry's inputs and see if it was within 30 seconds ago. If so, it's immune to filtering.
    After a label is recorded and added to the timelineLabelMap, we'll trigger a refilter after 30 seconds by calling setLastFilteredTs.
    This approach negates the need for an extra property on the timelineEntry object - which is good because we want it to match the server type.
    JGreenlee committed Nov 29, 2023
    Configuration menu
    Copy the full SHA
    7a0ea59 View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2023

  1. Configuration menu
    Copy the full SHA
    cf7027e View commit details
    Browse the repository at this point in the history
  2. fix UserInputButton not filling in after response

    This useEffect was watching timelineEntry for updates, but we changed the mechanism so timelineMap is no longer updated -- only the timelineLabelMap gets updated when a new response is recorded. By watching the result of userInputFor(...), this component will recieve the update.
    JGreenlee committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    45799c6 View commit details
    Browse the repository at this point in the history
  3. add duration to ConfirmedPlace type def

    This has always been a property on the server for trips as well as places. For some reason I must have missed it on the first pass of making the ConfirmedPlace type definition.
    JGreenlee committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    27549a3 View commit details
    Browse the repository at this point in the history
  4. refactor enketo user input types

    It keeps the codebase more logical (and more modular) to keep Enketo survey-related type definitions encapsulated away in enketoHelper.
    JGreenlee committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    2efb03d View commit details
    Browse the repository at this point in the history
  5. ignore /dist directory

    When we have Typescript compiler in 'watch' mode (useful for linting/ finding type errors in VSCode), it outputs to the root level directory 'dist'. Adding this directory to gitignore so we don't end up needlessly committing these output files.
    JGreenlee committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    fa1dfbf View commit details
    Browse the repository at this point in the history
  6. fix reload on every tab switch

    Each tab gets wrapped by an error boundary. We were doing this in the body of the App component which means every time the App component was updated/rerendered, the tabs were recomputed too.
    Doing the error boundary wrapping outside of the App component ensures that it only happens once and we use the same tab components each time
    JGreenlee committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    44ecc45 View commit details
    Browse the repository at this point in the history
  7. UI touchups

    -Fix size of Leaflet markers
    -- this changed when we removed all the extra CSS bloat and easy one line restores the previous size
    
    -Unify app bar styles
    -- removed elevation: 3 to soften the shadow (default is 1 and matches the rest of the app better - we were only using elevation 3 to match the style of the Ionic header)
    -- use 'colors.surface' instead of hardcoded 'white'
    
    - unify 'notesButton' style of diary cards
    - add paddingHorizontal to ModesIndicator
    -- this way, if there are a lot of modes, they have room to breathe
    JGreenlee committed Nov 30, 2023
    Configuration menu
    Copy the full SHA
    31ce4d3 View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2023

  1. Configuration menu
    Copy the full SHA
    76e579e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f04079b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a0eb054 View commit details
    Browse the repository at this point in the history

Commits on Dec 4, 2023

  1. add "/dist/" to jest ignore

    As in fa1dfbf, TypeScript puts output files here. We don't need git NOR Jest to pick up on these 'dist' files.
    JGreenlee committed Dec 4, 2023
    Configuration menu
    Copy the full SHA
    4959198 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c0e29ef View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f5dc166 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    76e6867 View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2023

  1. fix getFormattedTimeRange

    With invalid inputs, this function should return early rather than continuing and resulting in a zero-length duration.
    Fixes the diaryHelper test that was failing.
    JGreenlee committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    47acc03 View commit details
    Browse the repository at this point in the history
  2. rework resolveTimestamps validation to fix test

    We need a safe way to mark that validation fails in this function, without actually throwing an error. Let's use a third parameter for this purpose which is a callback function 'onFail' to handle the invalid case.
    - Updated tests accordingly - now passing
    JGreenlee committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    ee2fe2a View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2023

  1. Configuration menu
    Copy the full SHA
    aa9ee64 View commit details
    Browse the repository at this point in the history
  2. update to Prettier 3.1

    JGreenlee committed Dec 6, 2023
    Configuration menu
    Copy the full SHA
    4f173ba View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2023

  1. Configuration menu
    Copy the full SHA
    0f77f5c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b3dd4b1 View commit details
    Browse the repository at this point in the history
  3. fix type warnings in timelineHelper

    Typescript wants us to be more explicit about what could be null/undefined and what couldn't be.
    
    transitionTrip2TripObj should return a Promise that could resolve as an UnprocessedTrip or undefined.
    (If undefined, it gets filtered later in readUnprocessedTrips)
    
    We also need to address that Luxon's DateTime.toISO has string or null as the return type – null is for if the input was invalid. It never should be, but if it was for some reason we can have an error dialog and assert type with an empty string.
    JGreenlee committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    60ef5ed View commit details
    Browse the repository at this point in the history
  4. fix type warnings on timelineHelperMocks

    mockUnprocessedTrip was unnecessary and not used anywhere
    mockFilterLocation didn't need all these fake properties and instead could just include the few that are needed and then declare it 'as FilteredLocation'
    JGreenlee committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    a9042d3 View commit details
    Browse the repository at this point in the history
  5. fix Enketo type warnings

    enketoHelper.test.ts had a lot of the wrong types in the fake responses. They were all strings but I've since updated them so there some strings, some numbers, objects.
    EnketoResponseData in enketoHelper is correct.
    
    - some other type casting (with 'any') in both of these tests to ensure fake inputs satisfy parameters types
    JGreenlee committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    8e78f79 View commit details
    Browse the repository at this point in the history
  6. fix type warnings in confirmHelper.test.ts

    this test still had LabelOptions type for the userInput values instead of the UserInputEntry type.
    It didn't cause the tests to fail because inferFinalLabels and verifiabilityForTrip only check that the values exist - they don't care what properties they have.
    Anyhow, the types line up now.
    JGreenlee committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    1a35e1f View commit details
    Browse the repository at this point in the history
  7. fix type warnings in confirmHelper.test.ts

    this test still had LabelOptions type for the userInput values instead of the UserInputEntry type.
    It didn't cause the tests to fail because inferFinalLabels and verifiabilityForTrip only check that the values exist - they don't care what properties they have.
    Anyhow, the types line up now.
    JGreenlee committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    107eb84 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    81f4558 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2023

  1. Configuration menu
    Copy the full SHA
    0eab473 View commit details
    Browse the repository at this point in the history
  2. add specific prettier version

    jiji14 authored and JGreenlee committed Dec 14, 2023
    Configuration menu
    Copy the full SHA
    58fba92 View commit details
    Browse the repository at this point in the history
  3. use prettier 3.1.0 in workflow

    In 4f173ba I bumped the prettier version to 3.1. Whatever version we are using for the project should be the same as the workflow runs with (as we established in e-mission#1117)
    JGreenlee committed Dec 14, 2023
    Configuration menu
    Copy the full SHA
    17deb22 View commit details
    Browse the repository at this point in the history

Commits on Dec 21, 2023

  1. Configuration menu
    Copy the full SHA
    ae0ae28 View commit details
    Browse the repository at this point in the history
  2. Fix merge conflict the right way

    We wanted to keep the 3.1.0 not downgrade to 3.0.3
    shankari authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    80e3903 View commit details
    Browse the repository at this point in the history

Commits on Dec 26, 2023

  1. Configuration menu
    Copy the full SHA
    5cb8187 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    588f685 View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2024

  1. update unprocessed inputs after recording user input

    -- Part of the fix for e-mission/e-mission-docs#1034
    
    When a user input is recorded, we put it in storage. For snappy performance we also cache it in the timelineLabelMap / timelineNotesMap state.
    However, if we switch filters or load more trips, this state gets overridden. So, we need to call updateLocalUnprocessedInputs at some point.
    It is an async function but we can call it without 'await' and just allow it to execute in the background.
    JGreenlee committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    961ac78 View commit details
    Browse the repository at this point in the history
  2. allow labels to be stored as a batch

    -- Part of the fix for e-mission/e-mission-docs#1034
    
    When the yellow checkmark is used to verify a pair of inferred mode+purpose labels, both labels should be verified by a single click.
    The labels get stored fine; however, the way we update state after doing so prevents both labels from being updated simultaneously and only one of them gets filled in. The resulting UX is that it takes 2 clicks and this is not desired.
    We could: update state in succession, one after the other (await label A, then proceed label B),
    OR we could rework these functions to support adding labels for a particular trip as a batch (so the same function call could store mode+purpose at the same time). This was decided as a better and more performant option.
    
    It uses Promise.all to store all labels from the batch, then it updates the state with all changes from that batch.
    When a single label is recorded, it is a batch of 1 - when verifying inferences, it may be a batch of multiple labels.
    JGreenlee committed Jan 8, 2024
    Configuration menu
    Copy the full SHA
    68ae2bb View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2024

  1. Added to WSOD fix on metrics tab

    When selecting date, the following behavior occurs:
    - If 2+ days, behave as normal (Range of Day1 -> Day2)
    - If  "open Ended" (i.e., only start is picked), fetch
      a range of days between that day and present (Day1 -> Today)
    - If 1 day, fetch range for 48 hours from that day
    
    TODO: The 1 day range going to 48 hours is meant as a patch, so that
    this WSOD fix can go to staging.  To make a single day only fetch
    24 hrs, some changes to the server may be needed.
    the-bay-kay committed Jan 9, 2024
    Configuration menu
    Copy the full SHA
    5166bef View commit details
    Browse the repository at this point in the history
  2. Merge pull request #1 from the-bay-kay/diary_wsod_fix

    🗓️ Fixed WSOD on Metric Date Selector
    JGreenlee authored Jan 9, 2024
    Configuration menu
    Copy the full SHA
    27e7a51 View commit details
    Browse the repository at this point in the history
  3. use memoization pattern for added notes' displayDt

    Instead of mutating an extra property 'displayDt' onto the entries, let's use a get function that returns the displayDt. This should fix issue (4) in e-mission/e-mission-docs#1034.
    And let's also memoize that function so performance is not impacted
    JGreenlee committed Jan 9, 2024
    Configuration menu
    Copy the full SHA
    1474833 View commit details
    Browse the repository at this point in the history
  4. display error properly if thrown in EnketoModal

    If something was thrown, it could display 'undefined' if 'err' was an error message and not the error object.
    Using the displayError function is a more proper way to guarantee we see any error messages
    JGreenlee committed Jan 9, 2024
    Configuration menu
    Copy the full SHA
    01f33d3 View commit details
    Browse the repository at this point in the history
  5. revise type defs for additions / EnketoUserInputEntry

    - 'key' could be kept in 'data' or 'metadata' depending on if it is a processed or unprocessed entry (this is an inconsistency we may want to revisit later)
    - handle possible null/ undefined parameters in functions: check for truthy inputs before executing
    JGreenlee committed Jan 9, 2024
    Configuration menu
    Copy the full SHA
    f1bd447 View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2024

  1. Configuration menu
    Copy the full SHA
    cb7b191 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d1927b3 View commit details
    Browse the repository at this point in the history
  3. remove all remaining uses of getAngularService()

    -In useAppConfig.ts, we can't rely on $ionicPlatform anymore since we won't be using Angular moving forward. So we need an alternate way to ensure Cordova plugins are ready before we try to do stuff with them. I found that Cordova fires the 'deviceready' event once plugins are loaded - so we can just listen for that, wrap it in a promise, and use it in the place of $ionicPlatform.ready(...)
    -There were a few uses where getAngularService() was still used to access the old Logger, which were easily substituted to instead use the functions exported from logger.ts (logDebug, logWarn, etc)
    -There were several unused imports left over in files where getAngularService was formerly used and is no longer
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    0d417f2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e558163 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0153f0f View commit details
    Browse the repository at this point in the history
  6. don't use angular in ngApp.js

    The startup logic will now happen not in an Angular context, but with an event listener for 'deviceready' (which is what Cordova uses)
    And the React initialization will happen from there.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    ce81699 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    2c18cc1 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e920752 View commit details
    Browse the repository at this point in the history
  9. consolidate ngApp.js into index.js

    Since these have both been simplified we can merge them together
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    385a384 View commit details
    Browse the repository at this point in the history
  10. fix failing test in notifScheduler

    It was failing because 'commHelper' is no longer directly in '/js' -- it is in 'js/services'
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    6d5566e View commit details
    Browse the repository at this point in the history
  11. remove ng-i18next

    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    40f7aad View commit details
    Browse the repository at this point in the history
  12. remove unused /build folder

    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    4d9a8ef View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    98b08bf View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    78661da View commit details
    Browse the repository at this point in the history
  15. comply to Typescript "strictNullChecks": true

    This commit enables strictNullChecks for greater type safety and then fixes the dozens of instances where TS now warns us about values that are potentially null https://www.typescriptlang.org/tsconfig#strictNullChecks
    
    This means adding types on a lot of places where we had not added types before. Typescript is more powerful when it's on a stricter configuration, but this means we have to be more explicit.
    
    In a few of the files, I also cleaned up formatting and modernized syntax while I was making changes there.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    c901e91 View commit details
    Browse the repository at this point in the history
  16. more type safety to comply with strictNullChecks

    continuation of 49a1a64
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    8178c1f View commit details
    Browse the repository at this point in the history
  17. clean/reformat pushNotifySettings

    This file had a lot of outdated JS syntax and console.log statements. I just did a full sweep of this file and 'modernized' it.
    Added some type definitions too.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    dd00645 View commit details
    Browse the repository at this point in the history
  18. use aria-hidden instead of accessibilityHidden

    I previously used the wrong property name here. Now that we have Typescript on a stricter configuration, I found my mistake
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    a5edfb7 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    5f9c665 View commit details
    Browse the repository at this point in the history
  20. remove french and italian

    We previously had maintainers for the translations in these languages, but they have not been updated in a very long time. Because the app has changed so much since then, the old translations are almost entirely obsolete.
    At this point, I think it is better to remove them from usage. If we ever get someone to update the translations we can add them back.
    We'll still keep the old translations up on the e-mission-translate repo although they won't be used here.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    60f12b3 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    7286a04 View commit details
    Browse the repository at this point in the history
  22. add js/types to typeRoots

    VSCode was only picking up on our declaration TS files if they were open in the editor. This signals to VSCode and TS to check js/types for .d.ts files.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    aa74a4f View commit details
    Browse the repository at this point in the history
  23. cleanup and fix types in ProfileSettings

    This file was a JSX file until very recently and so a lot of type errors and warnings went unnoticed. There were a lot, so I just went over the whole file - fixing typings, modernizing syntax, and removing things that are unused.
    As part of this I expanded the typings for AppConfig.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    e77b92a View commit details
    Browse the repository at this point in the history
  24. more cleanup related to typings

    Continuing to clean up type warnings that are now showing up since 49a1a64
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    6a17228 View commit details
    Browse the repository at this point in the history
  25. fix DiaryCard showing current time if blank

    dt might be undefined here (like in the case of the most recent / current place in the timeline)
    In that case we should return nothing instead of letting Luxon create a new date (it would fallback to the current date&time which we don't want)
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    9dc0d48 View commit details
    Browse the repository at this point in the history
  26. add TimestampRange type

    this is used in a few places - it's tidier to have a common type definition
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    da0a311 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    1e906c0 View commit details
    Browse the repository at this point in the history
  28. new LabelTab functions for user inputs

    i) instead of providing timelineLabelMap and timelineNotesMap to the entire component tree under LabelTab, we can pass accessor functions (userInputFor, labelFor, notesFor) to get user inputs in a cleaner way
    
    ii) Unify the structure of how multilabel vs enketo user inputs are kept on the phone. Now both will be the 'raw' format (an object with 'data', 'metadata' etc).
    Note that there is still a discrepancy on the server - for multilabel inputs we get a plain string and for enketo inputs we get the whole userinput entry.
    The plan is to unify this on the server at some point, so I am doing it here on the phone in advance.
    
    iii) instead of using a 'justRepopulated' flag to signify that an entry should not be filtered within 30 seconds of having a user input recorded on it, we can just look at the write_ts in the metadata of that entry's inputs and see if it was within 30 seconds ago. If so, it's immune to filtering.
    After a label is recorded and added to the timelineLabelMap, we'll trigger a refilter after 30 seconds by calling setLastFilteredTs.
    This approach negates the need for an extra property on the timelineEntry object - which is good because we want it to match the server type.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    63c14d6 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    9ac6e00 View commit details
    Browse the repository at this point in the history
  30. fix UserInputButton not filling in after response

    This useEffect was watching timelineEntry for updates, but we changed the mechanism so timelineMap is no longer updated -- only the timelineLabelMap gets updated when a new response is recorded. By watching the result of userInputFor(...), this component will recieve the update.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    d339de7 View commit details
    Browse the repository at this point in the history
  31. add duration to ConfirmedPlace type def

    This has always been a property on the server for trips as well as places. For some reason I must have missed it on the first pass of making the ConfirmedPlace type definition.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    6deab9f View commit details
    Browse the repository at this point in the history
  32. refactor enketo user input types

    It keeps the codebase more logical (and more modular) to keep Enketo survey-related type definitions encapsulated away in enketoHelper.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    e37fa01 View commit details
    Browse the repository at this point in the history
  33. ignore /dist directory

    When we have Typescript compiler in 'watch' mode (useful for linting/ finding type errors in VSCode), it outputs to the root level directory 'dist'. Adding this directory to gitignore so we don't end up needlessly committing these output files.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    098ba21 View commit details
    Browse the repository at this point in the history
  34. fix reload on every tab switch

    Each tab gets wrapped by an error boundary. We were doing this in the body of the App component which means every time the App component was updated/rerendered, the tabs were recomputed too.
    Doing the error boundary wrapping outside of the App component ensures that it only happens once and we use the same tab components each time
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    36bbf08 View commit details
    Browse the repository at this point in the history
  35. UI touchups

    -Fix size of Leaflet markers
    -- this changed when we removed all the extra CSS bloat and easy one line restores the previous size
    
    -Unify app bar styles
    -- removed elevation: 3 to soften the shadow (default is 1 and matches the rest of the app better - we were only using elevation 3 to match the style of the Ionic header)
    -- use 'colors.surface' instead of hardcoded 'white'
    
    - unify 'notesButton' style of diary cards
    - add paddingHorizontal to ModesIndicator
    -- this way, if there are a lot of modes, they have room to breathe
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    412b3b8 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    c9b2683 View commit details
    Browse the repository at this point in the history
  37. add "/dist/" to jest ignore

    As in fa1dfbf, TypeScript puts output files here. We don't need git NOR Jest to pick up on these 'dist' files.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    e1d03a6 View commit details
    Browse the repository at this point in the history
  38. fix getFormattedTimeRange

    With invalid inputs, this function should return early rather than continuing and resulting in a zero-length duration.
    Fixes the diaryHelper test that was failing.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    07befbc View commit details
    Browse the repository at this point in the history
  39. rework resolveTimestamps validation to fix test

    We need a safe way to mark that validation fails in this function, without actually throwing an error. Let's use a third parameter for this purpose which is a callback function 'onFail' to handle the invalid case.
    - Updated tests accordingly - now passing
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    fec6a4b View commit details
    Browse the repository at this point in the history
  40. update to Prettier 3.1

    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    3c65612 View commit details
    Browse the repository at this point in the history
  41. fix type warnings in timelineHelper

    Typescript wants us to be more explicit about what could be null/undefined and what couldn't be.
    
    transitionTrip2TripObj should return a Promise that could resolve as an UnprocessedTrip or undefined.
    (If undefined, it gets filtered later in readUnprocessedTrips)
    
    We also need to address that Luxon's DateTime.toISO has string or null as the return type – null is for if the input was invalid. It never should be, but if it was for some reason we can have an error dialog and assert type with an empty string.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    59a080f View commit details
    Browse the repository at this point in the history
  42. fix type warnings on timelineHelperMocks

    mockUnprocessedTrip was unnecessary and not used anywhere
    mockFilterLocation didn't need all these fake properties and instead could just include the few that are needed and then declare it 'as FilteredLocation'
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    3563698 View commit details
    Browse the repository at this point in the history
  43. fix Enketo type warnings

    enketoHelper.test.ts had a lot of the wrong types in the fake responses. They were all strings but I've since updated them so there some strings, some numbers, objects.
    EnketoResponseData in enketoHelper is correct.
    
    - some other type casting (with 'any') in both of these tests to ensure fake inputs satisfy parameters types
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    699d90f View commit details
    Browse the repository at this point in the history
  44. fix type warnings in confirmHelper.test.ts

    this test still had LabelOptions type for the userInput values instead of the UserInputEntry type.
    It didn't cause the tests to fail because inferFinalLabels and verifiabilityForTrip only check that the values exist - they don't care what properties they have.
    Anyhow, the types line up now.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    ff840ff View commit details
    Browse the repository at this point in the history
  45. use prettier 3.1.0 in workflow

    In 4f173ba I bumped the prettier version to 3.1. Whatever version we are using for the project should be the same as the workflow runs with (as we established in e-mission#1117)
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    88c72f8 View commit details
    Browse the repository at this point in the history
  46. update unprocessed inputs after recording user input

    -- Part of the fix for e-mission/e-mission-docs#1034
    
    When a user input is recorded, we put it in storage. For snappy performance we also cache it in the timelineLabelMap / timelineNotesMap state.
    However, if we switch filters or load more trips, this state gets overridden. So, we need to call updateLocalUnprocessedInputs at some point.
    It is an async function but we can call it without 'await' and just allow it to execute in the background.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    a6e7a79 View commit details
    Browse the repository at this point in the history
  47. allow labels to be stored as a batch

    -- Part of the fix for e-mission/e-mission-docs#1034
    
    When the yellow checkmark is used to verify a pair of inferred mode+purpose labels, both labels should be verified by a single click.
    The labels get stored fine; however, the way we update state after doing so prevents both labels from being updated simultaneously and only one of them gets filled in. The resulting UX is that it takes 2 clicks and this is not desired.
    We could: update state in succession, one after the other (await label A, then proceed label B),
    OR we could rework these functions to support adding labels for a particular trip as a batch (so the same function call could store mode+purpose at the same time). This was decided as a better and more performant option.
    
    It uses Promise.all to store all labels from the batch, then it updates the state with all changes from that batch.
    When a single label is recorded, it is a batch of 1 - when verifying inferences, it may be a batch of multiple labels.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    8161d58 View commit details
    Browse the repository at this point in the history
  48. Fixed WSOD on single-date pick

    the-bay-kay authored and JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    b6a9155 View commit details
    Browse the repository at this point in the history
  49. Clean up a line of test code

    the-bay-kay authored and JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    ce760b6 View commit details
    Browse the repository at this point in the history
  50. Added to WSOD fix on metrics tab

    When selecting date, the following behavior occurs:
    - If 2+ days, behave as normal (Range of Day1 -> Day2)
    - If  "open Ended" (i.e., only start is picked), fetch
      a range of days between that day and present (Day1 -> Today)
    - If 1 day, fetch range for 48 hours from that day
    
    TODO: The 1 day range going to 48 hours is meant as a patch, so that
    this WSOD fix can go to staging.  To make a single day only fetch
    24 hrs, some changes to the server may be needed.
    the-bay-kay authored and JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    7483fe5 View commit details
    Browse the repository at this point in the history
  51. use memoization pattern for added notes' displayDt

    Instead of mutating an extra property 'displayDt' onto the entries, let's use a get function that returns the displayDt. This should fix issue (4) in e-mission/e-mission-docs#1034.
    And let's also memoize that function so performance is not impacted
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    b3785fd View commit details
    Browse the repository at this point in the history
  52. display error properly if thrown in EnketoModal

    If something was thrown, it could display 'undefined' if 'err' was an error message and not the error object.
    Using the displayError function is a more proper way to guarantee we see any error messages
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    3e44ebc View commit details
    Browse the repository at this point in the history
  53. revise type defs for additions / EnketoUserInputEntry

    - 'key' could be kept in 'data' or 'metadata' depending on if it is a processed or unprocessed entry (this is an inconsistency we may want to revisit later)
    - handle possible null/ undefined parameters in functions: check for truthy inputs before executing
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    316d4e9 View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    d5fe4b4 View commit details
    Browse the repository at this point in the history
  55. Configuration menu
    Copy the full SHA
    b0d6e7b View commit details
    Browse the repository at this point in the history
  56. fix notifScheduler test

    This test failed due to a bad merge conflict resolution.
    This commit reverts notifScheduler.test.ts to the state of 3cbb5f0 after sebastianbarry's fix.
    The test now passes.
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    6631890 View commit details
    Browse the repository at this point in the history
  57. fix type defs for notifScheduler

    - ReminderSchemeConfig should be ReminderSchemesConfig - a problem that resulted from resolving merge conflicts
    - Defining types in notifScheduler.ts so that the functions have return types and Typescript type warnings go away
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    a086892 View commit details
    Browse the repository at this point in the history
  58. fix type defs for timelineHelper

    -- With 'strictNullChecks' enabled in Typescript, we get type errors when declaring objects of a type with some of its properties missing.
    But for the purpose of testing (ie fake data, potentially invalid inputs) we want to do just that. We can get around this by hard casting with `as unknown as <T>`.
    In tests, for blank/invalid inputs being used (such as a blank CompositeTrip object) we can use `{} as any`
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    0aec763 View commit details
    Browse the repository at this point in the history
  59. fix type warnings

    This fixes a bunch of type warnings that show up with strictNullChecks being true.
    Fixes include adding types, disambiguating null and undefined types and handling them more carefully, and disambiguating trip vs place with type guards
    JGreenlee committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    79d18a1 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2024

  1. replace remaining uses of moment & remove it from dependencies

    With this change, any remaining uses of the `moment` library from datetime operations have been fully replaced by Luxon.
    All references to moment are removed.
    JGreenlee committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    004b9ea View commit details
    Browse the repository at this point in the history
  2. remove jQuery from dependencies + webpack

    When using AngularJS, jQuery needed to be provided as a global by Webpack. Now, we do not need it at all (except Enketo which still uses jQuery internally, but provides it to itself and is not needed globally.)
    JGreenlee committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    48633c3 View commit details
    Browse the repository at this point in the history