Repository navigation
feat: show opted-in local time in Remotes #1065
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
base: production
Are you sure you want to change the base?
Changes from all commits
fed0289
1eb2641
20dbc3d
e30cc30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { LocalTime } from '@/components/local-time'; | ||
| import type { User } from '@/types'; | ||
|
|
||
| export function RemoteLocalTime({ | ||
| partner, | ||
| }: { | ||
| partner: Pick<User, 'timezone' | 'show_local_time'>; | ||
| }) { | ||
| if (!partner.show_local_time || !partner.timezone) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <ul | ||
| title={partner.timezone} | ||
| className="min-h-4 min-w-0 font-mono text-[11px] text-muted-foreground [&_li]:min-w-0 [&_li]:gap-1 [&_li_span]:truncate [&_svg]:size-3 [&_svg]:shrink-0" | ||
| data-test="remote-local-time" | ||
| > | ||
| <LocalTime timeZone={partner.timezone} /> | ||
| </ul> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ import { ConversationActions } from '@/components/chat/conversation-actions'; | |
| import { ConversationThread } from '@/components/chat/conversation-thread'; | ||
| import { InboxPanel } from '@/components/chat/inbox-panel'; | ||
| import { OrgHeader, OrgPeopleDialog } from '@/components/chat/org'; | ||
| import { RemoteLocalTime } from '@/components/chat/remote-local-time'; | ||
| import { RemoteSettingsMenu } from '@/components/chat/remote-settings-menu'; | ||
| import { SearchDialog } from '@/components/search-dialog'; | ||
| import { Button } from '@/components/ui/button'; | ||
|
|
@@ -43,13 +44,22 @@ export default function Index({ | |
| thread: Thread | OrgThread | null; | ||
| }) { | ||
| const { user } = useUser(); | ||
| const conversations = useInbox(); | ||
| const dock = useChatDock(); | ||
| const [isPicking, setIsPicking] = useState(false); | ||
| const [isStartingOrg, setIsStartingOrg] = useState(false); | ||
| const [seededFrom, setSeededFrom] = useState<object | null>(null); | ||
| const currentPartner = | ||
| partner === null | ||
| ? null | ||
| : (conversations?.find( | ||
| (conversation) => | ||
| conversation.kind === 'direct' && | ||
| conversation.partner?.id === partner.id, | ||
| )?.partner ?? partner); | ||
| const target: ChatTarget | null = | ||
| partner !== null | ||
| ? { kind: 'direct', partner } | ||
| currentPartner !== null | ||
| ? { kind: 'direct', partner: currentPartner } | ||
| : org !== null | ||
| ? { kind: 'org', org } | ||
| : null; | ||
|
|
@@ -63,8 +73,6 @@ export default function Index({ | |
| } | ||
| } | ||
|
|
||
| useInbox(); | ||
|
|
||
| // Keeps the inbox's tab and search while moving between conversations. | ||
| const visit = (href: Parameters<typeof router.visit>[0]) => | ||
| router.visit(href, { preserveScroll: true, preserveState: true }); | ||
|
|
@@ -90,8 +98,8 @@ export default function Index({ | |
| <> | ||
| <Head | ||
| title={ | ||
| partner | ||
| ? `@${partner.handle} · Remotes` | ||
| currentPartner | ||
| ? `@${currentPartner.handle} · Remotes` | ||
| : org | ||
| ? `${org.name ?? 'Org'} · Remotes` | ||
| : 'Remotes' | ||
|
|
@@ -287,7 +295,7 @@ function ThreadHeader({ | |
| } as React.CSSProperties | ||
| } | ||
| /> | ||
| <span className="min-w-0"> | ||
| <div className="min-w-0"> | ||
| <span | ||
| className="block truncate text-[15px] font-semibold hover:underline" | ||
| title={partner.name} | ||
|
|
@@ -297,7 +305,8 @@ function ThreadHeader({ | |
| <span className="block truncate font-mono text-xs text-muted-foreground"> | ||
| @{partner.handle} | ||
| </span> | ||
| </span> | ||
| <RemoteLocalTime partner={partner} /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refresh the header from a complete partner payload. The header uses the page-load Update the stored partner and read it in the header only from a refresh payload that includes both fields. Keep the API serialization change that supplies those fields separate from this stale-header correction.
|
||
| </div> | ||
| </Link> | ||
| <ConversationActions | ||
| target={{ kind: 'direct', partner }} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.