diff --git a/KNOWLEDGE_BASE.md b/KNOWLEDGE_BASE.md index 26b649c54..8e604ebb2 100644 --- a/KNOWLEDGE_BASE.md +++ b/KNOWLEDGE_BASE.md @@ -423,7 +423,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 91544f3df..d0cefe01b 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 { @@ -212,17 +213,22 @@ function DockedChat({ user }: { user: User }) { avatarClassName="size-6" /> )} - - {target.kind === 'direct' - ? target.partner.name - : orgTitle( - target.org, - thread?.members ?? - summary?.members ?? - null, - user, - )} - +
+ + {target.kind === 'direct' + ? target.partner.name + : orgTitle( + target.org, + thread?.members ?? + summary?.members ?? + null, + user, + )} + + {target.kind === 'direct' && ( + + )} +
{unread > 0 && ( @@ -313,6 +319,7 @@ function DirectDockHeader({ @{partner.handle} + ; +}) { + 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 4d805bed7..8ec786a60 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.handle} - + +
{ + 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'); +});