diff --git a/KNOWLEDGE_BASE.md b/KNOWLEDGE_BASE.md index 06c5c7bc3..14fedef49 100644 --- a/KNOWLEDGE_BASE.md +++ b/KNOWLEDGE_BASE.md @@ -400,7 +400,7 @@ Settings → Appearance offers: These appearance choices are saved in the browser, not on the account, so each browser keeps its own. Settings → Profile lets you choose one of six lane colors (Orange, Green, Violet, Teal, Rose, Ochre), a custom color, or the automatic color used around your identity and activity graph. -Profile settings also let you share a timezone. Timestamps can show the author's local time as well as the viewer's when a timezone is shared. Leaving it unset uses the browser's timezone for your display without publishing your timezone. A separate, off-by-default setting shows your current local time on your profile, next to your location and website; it only applies while a timezone is set, and clearing the timezone turns it off. These /dev/null preferences are separate from your GitHub-managed profile information. +Profile settings also let you share a timezone. Timestamps can show the author's local time as well as the viewer's when a timezone is shared. Leaving it unset uses the browser's timezone for your display without publishing your timezone. A separate, off-by-default setting shows your current local time on your profile, next to your location and website, and in the header of direct Remotes with you. It only applies while a timezone is set, and clearing the timezone turns it off. These /dev/null preferences are separate from your GitHub-managed profile information. Sources: [appearance settings](resources/js/pages/appearance/update.tsx), [lane picker](resources/js/components/lane-picker.tsx), [timezone picker](resources/js/components/timezone-picker.tsx), [local time](resources/js/components/local-time.tsx), [timestamp tooltip](resources/js/components/timestamp-tooltip.tsx). diff --git a/resources/js/components/chat/chat-dock.tsx b/resources/js/components/chat/chat-dock.tsx index 7a544ca1f..5db6fe8c7 100644 --- a/resources/js/components/chat/chat-dock.tsx +++ b/resources/js/components/chat/chat-dock.tsx @@ -14,6 +14,7 @@ import OrgController from '@/actions/App/Http/Controllers/OrgController'; import { ConversationActions } from '@/components/chat/conversation-actions'; import { ConversationThread } from '@/components/chat/conversation-thread'; import { InboxPanel } from '@/components/chat/inbox-panel'; +import { RemoteLocalTime } from '@/components/chat/remote-local-time'; import { MemberStack, OrgHeader, orgTitle } from '@/components/chat/org'; import { SearchDialog } from '@/components/search-dialog'; import { @@ -306,7 +307,7 @@ function DirectDockHeader({ /> @@ -315,6 +316,7 @@ function DirectDockHeader({ @{partner.username} + ; +}) { + if (!partner.show_local_time || !partner.timezone) { + return null; + } + + return ( +
    + +
+ ); +} diff --git a/resources/js/components/timezone-picker.tsx b/resources/js/components/timezone-picker.tsx index 5a91e147c..4b4b78f2e 100644 --- a/resources/js/components/timezone-picker.tsx +++ b/resources/js/components/timezone-picker.tsx @@ -71,7 +71,7 @@ export default function TimezonePicker() {
- Show my local time on my profile + Show my local time on my profile and in Remotes - Anyone who opens your profile sees the - current time in your timezone. + People viewing your profile or chatting + with you can see your current local time. diff --git a/resources/js/pages/conversation/index.tsx b/resources/js/pages/conversation/index.tsx index 83f7a2425..38244ba69 100644 --- a/resources/js/pages/conversation/index.tsx +++ b/resources/js/pages/conversation/index.tsx @@ -11,6 +11,7 @@ import OrgController from '@/actions/App/Http/Controllers/OrgController'; import { ConversationActions } from '@/components/chat/conversation-actions'; import { ConversationThread } from '@/components/chat/conversation-thread'; import { InboxPanel } from '@/components/chat/inbox-panel'; +import { RemoteLocalTime } from '@/components/chat/remote-local-time'; import { OrgHeader, OrgPeopleDialog } from '@/components/chat/org'; import { RemoteSettingsMenu } from '@/components/chat/remote-settings-menu'; import { SearchDialog } from '@/components/search-dialog'; @@ -275,7 +276,7 @@ function ThreadHeader({ } as React.CSSProperties } /> - +
@{partner.username} - + +
{ + assert.equal( + RemoteLocalTime({ + partner: { timezone: 'Asia/Kolkata', show_local_time: false }, + }), + null, + ); + assert.equal( + RemoteLocalTime({ partner: { timezone: null, show_local_time: true } }), + null, + ); + + const result = RemoteLocalTime({ + partner: { timezone: 'Asia/Kolkata', show_local_time: true }, + }); + + assert.ok( + isValidElement<{ + title: string; + children: ReactElement<{ timeZone: string }>; + }>(result), + ); + assert.equal(result.props.title, 'Asia/Kolkata'); + assert.equal(result.props.children.props.timeZone, 'Asia/Kolkata'); +}); diff --git a/tests/draft-images.config.ts b/tests/draft-images.config.ts index 2696cc162..8a72e795c 100644 --- a/tests/draft-images.config.ts +++ b/tests/draft-images.config.ts @@ -12,6 +12,7 @@ export default defineConfig({ VITE_APP_NAME: '/dev/null', }, include: [ + 'tests/Unit/RemoteLocalTime.test.tsx', 'tests/Unit/CommitPhoto.test.tsx', 'tests/Unit/CommitSize.test.tsx', 'tests/Unit/ThreadHistory.test.tsx', diff --git a/tests/tsconfig.json b/tests/tsconfig.json index f27bb359f..c6255593a 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -6,6 +6,7 @@ }, "include": [ "Unit/**/*.test.ts", + "Unit/RemoteLocalTime.test.tsx", "Unit/CommitPhoto.test.tsx", "Unit/DraftStash.test.tsx", "Unit/ComposerDraft.test.tsx",