Skip to content

Add a UI to Chronos for creating OOO events#87543

Open
tgolen wants to merge 22 commits intomainfrom
tgolen-chronos-oooUI
Open

Add a UI to Chronos for creating OOO events#87543
tgolen wants to merge 22 commits intomainfrom
tgolen-chronos-oooUI

Conversation

@tgolen
Copy link
Copy Markdown
Contributor

@tgolen tgolen commented Apr 9, 2026

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/622509

Tests

  1. Go to the Chronos chat
  2. In the report header, open the dropdown button and select "Schedule OOO"
  3. Fill out the form and test the different controls
  4. Submit the form and verify that the proper message is sent to Chronos
  • Verify that no errors appear in the JS console

Offline tests

Same

QA Steps

Same

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I verified that similar component doesn't exist in the codebase
  • I verified that all props are defined accurately and each prop has a /** comment above it */
  • I verified that each file is named correctly
  • I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
  • I verified that the only data being stored in component state is data necessary for rendering and nothing else
  • In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
  • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
  • I verified that component internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
  • I verified that all JSX used for rendering exists in the render method
  • I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari image

@tgolen tgolen changed the title Tgolen chronos ooo UI Add a UI to Chronos for creating OOO events Apr 9, 2026
@OSBotify

This comment has been minimized.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 93.65% <ø> (ø)
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/SCREENS.ts 100.00% <ø> (ø)
src/components/NumberWithSymbolForm.tsx 52.63% <100.00%> (+0.92%) ⬆️
src/libs/ChronosUtils.ts 98.07% <100.00%> (+0.64%) ⬆️
src/libs/Navigation/linkingConfig/config.ts 76.92% <ø> (ø)
src/ROUTES.ts 16.32% <0.00%> (+0.23%) ⬆️
...gation/AppNavigator/ModalStackNavigators/index.tsx 6.96% <50.00%> (+0.11%) ⬆️
...on/AppNavigator/Navigators/RightModalNavigator.tsx 5.26% <0.00%> (-0.06%) ⬇️
src/types/form/ChronosScheduleOOOForm.ts 0.00% <0.00%> (ø)
... and 4 more
... and 155 files with indirect coverage changes

@tgolen
Copy link
Copy Markdown
Contributor Author

tgolen commented Apr 9, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9377c6979e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +59 to +61
const timeValue = values[INPUT_IDS.TIME]?.trim();
if (timeValue && !/^(1[0-2]|0?[1-9])(:[0-5]\d)?$/.test(timeValue)) {
addErrorMessage(errors, INPUT_IDS.TIME, translate('chronos.invalidTimeFormat'));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require AM/PM when time is provided

This validation allows a time value without timePeriod, and buildOOOCommand() only appends the period when it exists, so submitting 12:30 can generate ooo <date> 12:30 with no AM/PM. Since this form intentionally validates a 12-hour clock (1-12), the command is ambiguous and can schedule the wrong half-day OOO window when users forget to pick AM/PM. Please require timePeriod whenever time is filled (or provide a default) before submission.

Useful? React with 👍 / 👎.

@tgolen tgolen marked this pull request as ready for review April 9, 2026 22:44
@tgolen tgolen requested review from a team as code owners April 9, 2026 22:44
@melvin-bot melvin-bot bot requested a review from dukenv0307 April 9, 2026 22:44
@melvin-bot
Copy link
Copy Markdown

melvin-bot bot commented Apr 9, 2026

@dukenv0307 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot requested review from flaviadefaria and removed request for a team April 9, 2026 22:44
@tgolen tgolen changed the title Add a UI to Chronos for creating OOO events [HOLD] Add a UI to Chronos for creating OOO events Apr 9, 2026
@OSBotify
Copy link
Copy Markdown
Contributor

OSBotify commented Apr 9, 2026

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index 9f5f39b2..2a2a602d 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -7862,7 +7862,7 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
         reason: 'Grund',
         workingPercentage: 'Arbeitsprozentsatz',
         dateRequired: 'Datum ist erforderlich.',
-        invalidTimeFormat: 'Bitte geben Sie eine gültige Uhrzeit ein (z. B. 12:30).',
+        invalidTimeFormat: 'Bitte geben Sie eine gültige Uhrzeit im 24‑Stunden-Format ein (z. B. 14:30).',
         enterANumber: 'Bitte geben Sie eine Zahl ein.',
         hour: 'Stunden',
         day: 'Tage',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index a0819934..58cbc443 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -7877,7 +7877,7 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
         startTimer: 'Démarrer le minuteur',
         stopTimer: 'Arrêter le minuteur',
         scheduleOOO: 'Planifier une absence',
-        scheduleOOOTitle: 'Programmer une absence du bureau',
+        scheduleOOOTitle: 'Planifier une absence du bureau',
         date: 'Date',
         time: 'Heure',
         durationAmount: 'Montant',
@@ -7885,7 +7885,7 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
         reason: 'Raison',
         workingPercentage: 'Pourcentage de travail',
         dateRequired: 'La date est obligatoire.',
-        invalidTimeFormat: 'Veuillez saisir une heure valide (p. ex. 12:30).',
+        invalidTimeFormat: 'Veuillez entrer une heure valide au format 24 heures (par ex. 14:30).',
         enterANumber: 'Veuillez saisir un nombre.',
         hour: 'heures',
         day: 'jours',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index b09d9ab0..8c9b7391 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -7843,15 +7843,15 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
         startTimer: 'Avvia timer',
         stopTimer: 'Ferma timer',
         scheduleOOO: 'Pianifica OOO',
-        scheduleOOOTitle: 'Pianifica assenza dall’ufficio',
+        scheduleOOOTitle: 'Programma assenza dall’ufficio',
         date: 'Data',
         time: 'Ora',
         durationAmount: 'Importo',
         durationUnit: 'Unità',
         reason: 'Motivo',
-        workingPercentage: 'Percentuale di lavoro',
+        workingPercentage: 'Percentuale lavorativa',
         dateRequired: 'La data è obbligatoria.',
-        invalidTimeFormat: 'Inserisci un orario valido (ad es. 12:30).',
+        invalidTimeFormat: 'Inserisci un orario valido nel formato 24 ore (ad es. 14:30).',
         enterANumber: 'Inserisci un numero.',
         hour: 'ore',
         day: 'giorni',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 7420008d..4e48a8ad 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -7746,15 +7746,15 @@ ${reportName}
         startTimer: 'タイマー開始',
         stopTimer: 'タイマーを停止',
         scheduleOOO: '不在予定を設定',
-        scheduleOOOTitle: '外出予定を設定',
+        scheduleOOOTitle: '不在予定を設定',
         date: '日付',
         time: '時間',
         durationAmount: '金額',
         durationUnit: '単位',
         reason: '理由',
-        workingPercentage: '作業率',
+        workingPercentage: '稼働率',
         dateRequired: '日付は必須です。',
-        invalidTimeFormat: '有効な時刻を入力してください(例: 12:30)。',
+        invalidTimeFormat: '有効な24時間表記の時刻を入力してください(例: 14:30)。',
         enterANumber: '数字を入力してください。',
         hour: '時間',
         day: '日数',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 1ecc8982..af1891d1 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -7819,7 +7819,7 @@ Voeg meer bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
         oooEventSummaryPartialDay: (summary: string, timePeriod: string, date: string) => `${summary} van ${timePeriod} op ${date}`,
         startTimer: 'Timer starten',
         stopTimer: 'Timer stoppen',
-        scheduleOOO: 'OOO plannen',
+        scheduleOOO: 'Afwezigheid plannen',
         scheduleOOOTitle: 'Afwezigheid plannen',
         date: 'Datum',
         time: 'Tijd',
@@ -7827,8 +7827,8 @@ Voeg meer bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
         durationUnit: 'Eenheid',
         reason: 'Reden',
         workingPercentage: 'Werkpercentage',
-        dateRequired: 'Datum is vereist.',
-        invalidTimeFormat: 'Voer een geldige tijd in (bijv. 12:30).',
+        dateRequired: 'Datum is verplicht.',
+        invalidTimeFormat: 'Voer een geldige 24-uurs tijd in (bijv. 14:30).',
         enterANumber: 'Voer een getal in.',
         hour: 'uren',
         day: 'dagen',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 755d478e..4985470f 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -7815,9 +7815,9 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
         durationAmount: 'Kwota',
         durationUnit: 'Jednostka',
         reason: 'Powód',
-        workingPercentage: 'Działający procent',
+        workingPercentage: 'Procent pracy',
         dateRequired: 'Data jest wymagana.',
-        invalidTimeFormat: 'Wprowadź prawidłowy czas (np. 12:30).',
+        invalidTimeFormat: 'Podaj poprawny czas w formacie 24-godzinnym (np. 14:30).',
         enterANumber: 'Wpisz liczbę.',
         hour: 'godziny',
         day: 'dni',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 32e97429..edfb9d0e 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -7813,16 +7813,16 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
         startTimer: 'Iniciar cronômetro',
         stopTimer: 'Parar cronômetro',
         scheduleOOO: 'Agendar ausência',
-        scheduleOOOTitle: 'Programar ausência do escritório',
+        scheduleOOOTitle: 'Agendar ausência do escritório',
         date: 'Data',
-        time: 'Hora',
+        time: 'Tempo',
         durationAmount: 'Valor',
         durationUnit: 'Unidade',
         reason: 'Motivo',
         workingPercentage: 'Porcentagem de trabalho',
         dateRequired: 'A data é obrigatória.',
-        invalidTimeFormat: 'Insira um horário válido (por exemplo, 12:30).',
-        enterANumber: 'Por favor, insira um número.',
+        invalidTimeFormat: 'Insira um horário válido no formato 24 horas (por exemplo, 14:30).',
+        enterANumber: 'Insira um número.',
         hour: 'horas',
         day: 'dias',
         week: 'semanas',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 28bf59b3..77d82e2f 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -7613,12 +7613,12 @@ ${reportName}
         reason: '原因',
         workingPercentage: '工作百分比',
         dateRequired: '日期为必填项。',
-        invalidTimeFormat: '请输入有效的时间(例如:12:30)。',
+        invalidTimeFormat: '请输入有效的 24 小时制时间(例如:14:30)。',
         enterANumber: '请输入一个数字。',
         hour: '小时',
         day: '天',
         week: '周',
-        month: '月数',
+        month: '个月',
     },
     footer: {
         features: '功能',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@tgolen tgolen changed the title [HOLD] Add a UI to Chronos for creating OOO events Add a UI to Chronos for creating OOO events Apr 10, 2026
reason: 'Motivo',
workingPercentage: 'Porcentaje de trabajo',
dateRequired: 'La fecha es obligatoria.',
invalidTimeFormat: 'Ingresa una hora válida (ej., 12:30).',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be 14:30?

@dukenv0307
Copy link
Copy Markdown
Contributor

We're building the ooo message in English only, is it expected?

@dukenv0307
Copy link
Copy Markdown
Contributor

I see the AM/PM selector in your screenshot but it doesn't appear on my side

@dukenv0307
Copy link
Copy Markdown
Contributor

@Expensify/design For more eyes

@dubielzyk-expensify
Copy link
Copy Markdown
Contributor

Yeah I'd align them a bit more like this:

CleanShot 2026-04-10 at 13 40 15@2x CleanShot 2026-04-10 at 13 40 36@2x

@shawnborton
Copy link
Copy Markdown
Contributor

Or we could try something like we are already building for the expense creation flow, where a selector button is nested inside of the input. I don't feel strongly but I like the idea of being consistent with how we handle units inside of an input:

CleanShot 2026-04-10 at 09 26 45@2x

@shawnborton
Copy link
Copy Markdown
Contributor

Also, how does the date work? Can you select a range for multiple days?

@dannymcclain
Copy link
Copy Markdown
Contributor

Dig those tweak suggestions 👍

@tgolen
Copy link
Copy Markdown
Contributor Author

tgolen commented Apr 10, 2026

We're building the ooo message in English only, is it expected?

Yeah, Chronos can only understand English, so that's fine.

The time needs to be in 24-hour format for now (without making any changes to Chronos), so I will update my screenshot, double-check that translation, and the designs will need to account for that.

I like the unit selector idea @shawnborton and I'll use that if it's already built. If it's not built yet, let's just keep what we have an can swap it out later.

Also, how does the date work? Can you select a range for multiple days?

It's a single date selector that is used in the Chronos message. You configure a range by using the "amount" and "unit" fields (ie. "for 6 days")

@tgolen tgolen requested a review from dukenv0307 April 10, 2026 19:33
@tgolen
Copy link
Copy Markdown
Contributor Author

tgolen commented Apr 10, 2026

Here is the new UI.

  • Used a combined control for the amount + units (I had to make a couple of changes to the underlying control to make it more generic)
  • Renamed "Amount" to "Duration"
  • Used a control for the percentage that let me add a "%" as part of the control
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants