Repository navigation
feat(ui): add time and date format settings and message timestamps #2223
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
Open
KarthickMahalingam
wants to merge
17
commits into
Zoo-Code-Org:main
Choose a base branch
from
KarthickMahalingam:feat/time-date-format
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,160
−56
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
738bc87
feat(ui): add time and date format settings and message timestamps
KarthickMahalingam c987648
fix(ui): address review feedback on time and date settings
KarthickMahalingam 61b734e
test(visual): add Language tab baselines
KarthickMahalingam c8d7492
test(e2e): mask the message time in the extension host visual test
KarthickMahalingam d0b39ed
test(e2e): update the chat sidebar baseline for the message time
KarthickMahalingam daa83bd
Merge branch 'main' into feat/time-date-format
KarthickMahalingam d11277a
test(e2e): give the masked message time a fixed width so the mask box…
KarthickMahalingam 8e1aed2
test(e2e): iterate the message times with forEach (no DOM.Iterable in…
KarthickMahalingam 34c1d1d
test(e2e): regenerate the chat sidebar baseline from CI with a fixed-…
KarthickMahalingam 9a3c483
feat(ui): make the time format a real radio group with roving focus a…
KarthickMahalingam 36548f9
test(host): cover saving the date and time settings and returning the…
KarthickMahalingam 6dd6cb9
test(ui): cover the date format on older messages across user, assist…
KarthickMahalingam 994486a
test(e2e): pin the masked message time to one fixed-size line, and up…
KarthickMahalingam 6aaffc2
refactor(ui): drop the unused formatDate; no tooltip that repeats an …
KarthickMahalingam 611b7cf
fix(ui): select the time format option that receives focus; keep keyb…
KarthickMahalingam 4f9bc9f
test: assert the webview state refresh after a save; cover the date f…
KarthickMahalingam 6944e2d
test(ui): cover the task header time and the display language fallback
KarthickMahalingam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file modified
BIN
-898 Bytes
(97%)
apps/vscode-e2e/src/visual/__screenshots__/electron-chat-dark-sidebar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { Clock } from "lucide-react" | ||
|
|
||
| import { cn } from "@src/lib/utils" | ||
| import { formatDateTime, formatMessageTime, type DateFormat, type TimeFormat } from "@/utils/format" | ||
|
|
||
| import { StandardTooltip } from "../ui/standard-tooltip" | ||
|
|
||
| interface MessageTimestampProps { | ||
| /** Epoch ms the message was sent. */ | ||
| ts: number | ||
| /** From the user's Language settings; both default to "auto". */ | ||
| timeFormat?: TimeFormat | ||
| dateFormat?: DateFormat | ||
| className?: string | ||
| } | ||
|
|
||
| /** | ||
| * "🕒 Yesterday 11:43 AM" under a sent message. | ||
| * | ||
| * Purely presentational: the caller supplies the user's time/date formats, so | ||
| * the component has no dependency on extension state and renders anywhere. The | ||
| * tooltip always carries the full date and time. A semantic <time> element | ||
| * gives assistive tech and copy/paste the exact value. | ||
| */ | ||
| export const MessageTimestamp = ({ ts, timeFormat, dateFormat, className }: MessageTimestampProps) => { | ||
| // Number.isFinite is not enough: a finite value beyond ±8.64e15 ms is an Invalid Date, and | ||
| // toISOString() would throw during render and take the whole chat row down with it. | ||
| const date = new Date(ts) | ||
| if (!Number.isFinite(ts) || ts <= 0 || Number.isNaN(date.getTime())) return null | ||
|
|
||
| return ( | ||
| <StandardTooltip content={formatDateTime(ts, timeFormat, dateFormat)}> | ||
| <time | ||
| dateTime={date.toISOString()} | ||
| className={cn( | ||
| "inline-flex items-center gap-1.5 text-xs text-vscode-descriptionForeground select-none", | ||
| className, | ||
| )} | ||
| data-testid="message-timestamp"> | ||
| <Clock className="size-3.5 shrink-0" aria-hidden="true" /> | ||
| {formatMessageTime(ts, { timeFormat, dateFormat })} | ||
| </time> | ||
| </StandardTooltip> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.