feat(task): CAI-7811 Campaign Countdown#682
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eab28a86a3
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0ae195827
ℹ️ 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".
| } else if (remainingSeconds === 0 && !hasTimedOut) { | ||
| setHasTimedOut(true); | ||
| onTimeout?.(); |
There was a problem hiding this comment.
Skip firing timeout callback without a configured deadline
This branch calls onTimeout immediately whenever remainingSeconds initializes to 0, which also happens when both timeoutTimestamp and timeoutInSeconds are absent (or not yet populated on first render). In that case a parent that always passes onTimeout can trigger the campaign timeout action instantly before backend timeout data arrives, causing premature task expiration. Add a guard so the callback only fires when at least one valid timeout source is configured.
Useful? React with 👍 / 👎.
| @@ -1,3 +1,5 @@ | |||
| const store = window.store; | |||
There was a problem hiding this comment.
yes this was causing the build to fail which in turn caused the pre-commit script to fail
There was a problem hiding this comment.
im not having this issue on my branch, which is strange
There was a problem hiding this comment.
I think this change is okay to be added, its only sample- it should not be an issue
| export const PHONE_NUMBER = 'Phone Number:'; | ||
| export const CUSTOMER_NAME = 'Customer Name'; | ||
| export const RONA = 'RONA:'; | ||
| export const TIME_LEFT = 'Time left:'; |
There was a problem hiding this comment.
can you confirm that time left isn't used already in incomingtask component? and if so, share the const
There was a problem hiding this comment.
its hard coded there, const can be shared to incoming task in a follow up enhancement dedicated to replacing hard coded text with consts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce82ee2b88
ℹ️ 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".
| timerRef.current = setTimeout(() => { | ||
| // Recalculate from wall clock when using timeoutTimestamp to handle | ||
| // browser throttling (background tabs, blocked main thread) | ||
| const newRemaining = timeoutTimestamp !== undefined ? calculateRemaining() : remainingSeconds - 1; |
There was a problem hiding this comment.
Respect fallback countdown when timestamp is unparsable
Use the same validity check here that calculateRemainingSeconds uses, rather than only timeoutTimestamp !== undefined. With inputs like timeoutTimestamp: '' (or any unparsable string) plus timeoutInSeconds, calculateRemaining() falls back to the original timeoutInSeconds value, and this branch reassigns that same value every tick, so the countdown never decreases and onTimeout never fires. This can happen when backend data sends an empty/invalid timestamp while the seconds fallback is provided.
Useful? React with 👍 / 👎.
| @@ -1,3 +1,5 @@ | |||
| const store = window.store; | |||
There was a problem hiding this comment.
I think this change is okay to be added, its only sample- it should not be an issue
Thank you for your contribution! |
COMPLETES #https://jira-eng-sjc12.cisco.com/jira/browse/CAI-7811
This pull request addresses
Creating the Campaign Countdown component to be used in future campaign preview features
by making the following changes
Created a countdown component that can take an elapsed time or the time the countdown should end as well as a callback for what to do after the countdown finishes, which will be helpful for performing the automatic timeout action for campaign preview tasks
vidcast: https://app.vidcast.io/share/d24a983e-991f-4c10-ba66-60560ca38483?playerMode=vidcast
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.