@kelpie/ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/api/resources/account.d.ts +5 -0
  2. package/dist/api/resources/account.d.ts.map +1 -1
  3. package/dist/api/resources/account.js +11 -0
  4. package/dist/api/resources/account.js.map +1 -1
  5. package/dist/api/resources/apiKeys.d.ts +15 -0
  6. package/dist/api/resources/apiKeys.d.ts.map +1 -0
  7. package/dist/api/resources/apiKeys.js +50 -0
  8. package/dist/api/resources/apiKeys.js.map +1 -0
  9. package/dist/api/resources/invites.d.ts +0 -2
  10. package/dist/api/resources/invites.d.ts.map +1 -1
  11. package/dist/api/resources/invites.js +5 -10
  12. package/dist/api/resources/invites.js.map +1 -1
  13. package/dist/api/resources/session.d.ts +17 -3
  14. package/dist/api/resources/session.d.ts.map +1 -1
  15. package/dist/api/resources/session.js +34 -6
  16. package/dist/api/resources/session.js.map +1 -1
  17. package/dist/app/KelpieApp.d.ts.map +1 -1
  18. package/dist/app/KelpieApp.js +5 -1
  19. package/dist/app/KelpieApp.js.map +1 -1
  20. package/dist/app/SessionGate.d.ts +6 -2
  21. package/dist/app/SessionGate.d.ts.map +1 -1
  22. package/dist/app/SessionGate.js +10 -3
  23. package/dist/app/SessionGate.js.map +1 -1
  24. package/dist/components/ActivitiesPanel.d.ts.map +1 -1
  25. package/dist/components/ActivitiesPanel.js +10 -7
  26. package/dist/components/ActivitiesPanel.js.map +1 -1
  27. package/dist/components/ApiKeysPanel.d.ts +20 -0
  28. package/dist/components/ApiKeysPanel.d.ts.map +1 -0
  29. package/dist/components/ApiKeysPanel.js +70 -0
  30. package/dist/components/ApiKeysPanel.js.map +1 -0
  31. package/dist/components/DecisionsPanel.d.ts.map +1 -1
  32. package/dist/components/DecisionsPanel.js +3 -1
  33. package/dist/components/DecisionsPanel.js.map +1 -1
  34. package/dist/components/NotesPanel.d.ts.map +1 -1
  35. package/dist/components/NotesPanel.js +3 -1
  36. package/dist/components/NotesPanel.js.map +1 -1
  37. package/dist/components/Shell.d.ts.map +1 -1
  38. package/dist/components/Shell.js +1 -0
  39. package/dist/components/Shell.js.map +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +1 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/lib/dates.d.ts +25 -5
  45. package/dist/lib/dates.d.ts.map +1 -1
  46. package/dist/lib/dates.js +49 -20
  47. package/dist/lib/dates.js.map +1 -1
  48. package/dist/pages/DecisionsPage.d.ts.map +1 -1
  49. package/dist/pages/DecisionsPage.js +4 -2
  50. package/dist/pages/DecisionsPage.js.map +1 -1
  51. package/dist/pages/HiringPage.d.ts.map +1 -1
  52. package/dist/pages/HiringPage.js +3 -1
  53. package/dist/pages/HiringPage.js.map +1 -1
  54. package/dist/pages/PlanningPage.js +1 -1
  55. package/dist/pages/PlanningPage.js.map +1 -1
  56. package/dist/pages/account/AccountLayout.d.ts.map +1 -1
  57. package/dist/pages/account/AccountLayout.js +1 -0
  58. package/dist/pages/account/AccountLayout.js.map +1 -1
  59. package/dist/pages/account/PersonalApiKeysPage.d.ts +9 -0
  60. package/dist/pages/account/PersonalApiKeysPage.d.ts.map +1 -0
  61. package/dist/pages/account/PersonalApiKeysPage.js +14 -0
  62. package/dist/pages/account/PersonalApiKeysPage.js.map +1 -0
  63. package/dist/pages/account/PreferencesPage.js +1 -1
  64. package/dist/pages/account/PreferencesPage.js.map +1 -1
  65. package/dist/pages/account/SecurityPage.d.ts.map +1 -1
  66. package/dist/pages/account/SecurityPage.js +3 -2
  67. package/dist/pages/account/SecurityPage.js.map +1 -1
  68. package/dist/pages/admin/ApiKeysPage.d.ts +9 -0
  69. package/dist/pages/admin/ApiKeysPage.d.ts.map +1 -0
  70. package/dist/pages/admin/ApiKeysPage.js +20 -0
  71. package/dist/pages/admin/ApiKeysPage.js.map +1 -0
  72. package/dist/pages/admin/McpPage.d.ts.map +1 -1
  73. package/dist/pages/admin/McpPage.js +6 -3
  74. package/dist/pages/admin/McpPage.js.map +1 -1
  75. package/dist/pages/admin/WebhookDeliveries.d.ts.map +1 -1
  76. package/dist/pages/admin/WebhookDeliveries.js +4 -2
  77. package/dist/pages/admin/WebhookDeliveries.js.map +1 -1
  78. package/dist/pages/admin/WebhooksPage.d.ts.map +1 -1
  79. package/dist/pages/admin/WebhooksPage.js +5 -3
  80. package/dist/pages/admin/WebhooksPage.js.map +1 -1
  81. package/dist/pages/auth/ForgotPasswordPage.js +2 -2
  82. package/dist/pages/auth/ForgotPasswordPage.js.map +1 -1
  83. package/dist/pages/auth/SignUpPage.d.ts +5 -3
  84. package/dist/pages/auth/SignUpPage.d.ts.map +1 -1
  85. package/dist/pages/auth/SignUpPage.js +12 -6
  86. package/dist/pages/auth/SignUpPage.js.map +1 -1
  87. package/dist/pages/auth/VerifyEmailConfirmPage.d.ts +9 -0
  88. package/dist/pages/auth/VerifyEmailConfirmPage.d.ts.map +1 -0
  89. package/dist/pages/auth/VerifyEmailConfirmPage.js +58 -0
  90. package/dist/pages/auth/VerifyEmailConfirmPage.js.map +1 -0
  91. package/dist/pages/auth/VerifyEmailPendingPage.d.ts +10 -0
  92. package/dist/pages/auth/VerifyEmailPendingPage.d.ts.map +1 -0
  93. package/dist/pages/auth/VerifyEmailPendingPage.js +35 -0
  94. package/dist/pages/auth/VerifyEmailPendingPage.js.map +1 -0
  95. package/dist/pages/dashboard/DashboardPage.d.ts.map +1 -1
  96. package/dist/pages/dashboard/DashboardPage.js +6 -4
  97. package/dist/pages/dashboard/DashboardPage.js.map +1 -1
  98. package/dist/pages/dashboard/sections.d.ts +6 -3
  99. package/dist/pages/dashboard/sections.d.ts.map +1 -1
  100. package/dist/pages/dashboard/sections.js +6 -6
  101. package/dist/pages/dashboard/sections.js.map +1 -1
  102. package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
  103. package/dist/pages/forms/SubmissionsTable.js +3 -1
  104. package/dist/pages/forms/SubmissionsTable.js.map +1 -1
  105. package/dist/pages/handbook/HandbookPage.d.ts.map +1 -1
  106. package/dist/pages/handbook/HandbookPage.js +3 -1
  107. package/dist/pages/handbook/HandbookPage.js.map +1 -1
  108. package/package.json +2 -2
  109. package/src/api/resources/account.ts +13 -0
  110. package/src/api/resources/apiKeys.ts +60 -0
  111. package/src/api/resources/invites.ts +5 -15
  112. package/src/api/resources/session.ts +42 -6
  113. package/src/app/KelpieApp.tsx +11 -2
  114. package/src/app/SessionGate.tsx +11 -3
  115. package/src/components/ActivitiesPanel.tsx +15 -4
  116. package/src/components/ApiKeysPanel.tsx +307 -0
  117. package/src/components/DecisionsPanel.tsx +5 -2
  118. package/src/components/NotesPanel.tsx +4 -1
  119. package/src/components/Shell.tsx +1 -0
  120. package/src/index.ts +0 -1
  121. package/src/lib/dates.ts +54 -20
  122. package/src/pages/DecisionsPage.tsx +6 -2
  123. package/src/pages/HiringPage.tsx +3 -1
  124. package/src/pages/PlanningPage.tsx +1 -1
  125. package/src/pages/account/AccountLayout.tsx +1 -0
  126. package/src/pages/account/PersonalApiKeysPage.tsx +27 -0
  127. package/src/pages/account/PreferencesPage.tsx +1 -1
  128. package/src/pages/account/SecurityPage.tsx +4 -1
  129. package/src/pages/admin/ApiKeysPage.tsx +43 -0
  130. package/src/pages/admin/McpPage.tsx +7 -4
  131. package/src/pages/admin/WebhookDeliveries.tsx +4 -2
  132. package/src/pages/admin/WebhooksPage.tsx +5 -3
  133. package/src/pages/auth/ForgotPasswordPage.tsx +2 -2
  134. package/src/pages/auth/SignUpPage.tsx +12 -6
  135. package/src/pages/auth/VerifyEmailConfirmPage.tsx +81 -0
  136. package/src/pages/auth/VerifyEmailPendingPage.tsx +65 -0
  137. package/src/pages/dashboard/DashboardPage.tsx +14 -4
  138. package/src/pages/dashboard/sections.tsx +9 -3
  139. package/src/pages/forms/SubmissionsTable.tsx +3 -1
  140. package/src/pages/handbook/HandbookPage.tsx +3 -1
@@ -0,0 +1,43 @@
1
+ import { useSession } from '../../api/resources/session.ts'
2
+ import { ApiKeysPanel } from '../../components/ApiKeysPanel.tsx'
3
+ import { PageHeader } from '../../components/PageHeader.tsx'
4
+
5
+ /**
6
+ * Workspace keys, for shared agents and CI.
7
+ *
8
+ * `GET /v1/api-keys?kind=workspace` needs the admin role; the server answers
9
+ * `403` to anyone else. This page shows that plainly instead of rendering an
10
+ * empty table, the same shape `WebhooksPage` uses for the same reason.
11
+ */
12
+
13
+ export function ApiKeysPage(): React.JSX.Element {
14
+ const { session } = useSession()
15
+ const isAdmin = session?.role === 'owner' || session?.role === 'admin'
16
+
17
+ return (
18
+ <div className="animate-slide-in mx-auto max-w-4xl space-y-4">
19
+ <PageHeader
20
+ title="API keys"
21
+ description="Workspace keys for shared agents and CI. Personal keys live under Account → API keys."
22
+ />
23
+ {isAdmin ? (
24
+ <ApiKeysPanel
25
+ kind="workspace"
26
+ namePlaceholder="CI pipeline"
27
+ createTitle="Create API key"
28
+ emptyMessage="No API keys yet."
29
+ />
30
+ ) : (
31
+ <MemberNotice />
32
+ )}
33
+ </div>
34
+ )
35
+ }
36
+
37
+ function MemberNotice(): React.JSX.Element {
38
+ return (
39
+ <p className="rounded-md border border-border px-4 py-3 text-[13px] text-ink-muted">
40
+ Workspace keys are managed by workspace admins.
41
+ </p>
42
+ )
43
+ }
@@ -3,6 +3,7 @@ import type { AgentRun, McpTool } from '@kelpie/schemas'
3
3
  import { useMemo, useState } from 'react'
4
4
  import { Link } from 'react-router'
5
5
 
6
+ import { useTimezone } from '../../api/resources/account.ts'
6
7
  import {
7
8
  useAgentRuns,
8
9
  useAgents,
@@ -107,8 +108,8 @@ export function McpPage(): React.JSX.Element {
107
108
  </div>
108
109
  <p className="mt-1 text-[12px] text-ink-muted">
109
110
  Paste into your MCP client config, and replace the bearer token with a workspace key from{' '}
110
- <Link to="/admin/workspace" className="text-accent hover:underline">
111
- workspace settings
111
+ <Link to="/admin/api-keys" className="text-accent hover:underline">
112
+ API keys
112
113
  </Link>
113
114
  .
114
115
  </p>
@@ -133,6 +134,7 @@ function RegisteredAgents(): React.JSX.Element {
133
134
  const { records, isLoading, error } = useAgents()
134
135
  const createAgent = useCreateAgent()
135
136
  const deleteAgent = useDeleteAgent()
137
+ const timezone = useTimezone()
136
138
  const [adding, setAdding] = useState(false)
137
139
  const [name, setName] = useState('')
138
140
  const [endpoint, setEndpoint] = useState('')
@@ -253,7 +255,7 @@ function RegisteredAgents(): React.JSX.Element {
253
255
  <span>
254
256
  {agent.lastRunAt === null
255
257
  ? 'Never run'
256
- : `Last run ${formatRelativeTime(agent.lastRunAt)}`}
258
+ : `Last run ${formatRelativeTime(agent.lastRunAt, timezone)}`}
257
259
  </span>
258
260
  <button
259
261
  type="button"
@@ -283,6 +285,7 @@ function RecentRuns(): React.JSX.Element {
283
285
  const { records: runs, isLoading, error } = useAgentRuns()
284
286
  const catalog = useAllAgentTasks()
285
287
  const agents = useAgents()
288
+ const timezone = useTimezone()
286
289
 
287
290
  const taskLabels = useMemo(
288
291
  () => new Map(catalog.records.map((task) => [task.id, task.label])),
@@ -333,7 +336,7 @@ function RecentRuns(): React.JSX.Element {
333
336
  <span className={run.status === 'failed' ? 'font-medium text-danger' : 'text-ink-muted'}>
334
337
  {AGENT_RUN_STATUS_LABELS[run.status]}
335
338
  </span>
336
- <span className="text-ink-faint">{formatRelativeTime(run.updatedAt)}</span>
339
+ <span className="text-ink-faint">{formatRelativeTime(run.updatedAt, timezone)}</span>
337
340
  </div>
338
341
  </li>
339
342
  ))}
@@ -1,6 +1,7 @@
1
1
  import type { WebhookDelivery, WebhookDeliveryStatus } from '@kelpie/schemas'
2
2
  import { useState } from 'react'
3
3
 
4
+ import { useTimezone } from '../../api/resources/account.ts'
4
5
  import { useWebhookDeliveries } from '../../api/resources/webhooks.ts'
5
6
  import { Chip } from '../../components/Chip.tsx'
6
7
  import type { ChipTone } from '../../components/Chip.tsx'
@@ -37,6 +38,7 @@ const STATUS_TONES: Readonly<Record<WebhookDeliveryStatus, ChipTone>> = {
37
38
  export function WebhookDeliveries({ webhookId }: { readonly webhookId: string }): React.JSX.Element {
38
39
  const [status, setStatus] = useState<StatusFilter>('all')
39
40
  const [openPayloadId, setOpenPayloadId] = useState<string | null>(null)
41
+ const timezone = useTimezone()
40
42
  const deliveries = useWebhookDeliveries(webhookId, {
41
43
  status: status === 'all' ? undefined : status,
42
44
  })
@@ -68,7 +70,7 @@ export function WebhookDeliveries({ webhookId }: { readonly webhookId: string })
68
70
  className: 'w-32',
69
71
  render: (delivery) => (
70
72
  <span className="font-mono text-[12px] text-ink-muted">
71
- {formatDateTime(delivery.createdAt)}
73
+ {formatDateTime(delivery.createdAt, timezone)}
72
74
  </span>
73
75
  ),
74
76
  },
@@ -80,7 +82,7 @@ export function WebhookDeliveries({ webhookId }: { readonly webhookId: string })
80
82
  // reader is looking for. An em dash says "never" without claiming a time.
81
83
  render: (delivery) => (
82
84
  <span className="font-mono text-[12px] text-ink-muted">
83
- {delivery.deliveredAt === null ? '—' : formatDateTime(delivery.deliveredAt)}
85
+ {delivery.deliveredAt === null ? '—' : formatDateTime(delivery.deliveredAt, timezone)}
84
86
  </span>
85
87
  ),
86
88
  },
@@ -7,6 +7,7 @@ import type { CreatedWebhook, Webhook, WebhookEvent, WebhookStatus } from '@kelp
7
7
  import { useState } from 'react'
8
8
  import type { FormEvent } from 'react'
9
9
 
10
+ import { useTimezone } from '../../api/resources/account.ts'
10
11
  import { useSession } from '../../api/resources/session.ts'
11
12
  import {
12
13
  useCreateWebhook,
@@ -250,6 +251,7 @@ function WebhookRow({
250
251
  const updateWebhook = useUpdateWebhook()
251
252
  const deleteWebhook = useDeleteWebhook()
252
253
  const rotateSecret = useRotateWebhookSecret()
254
+ const timezone = useTimezone()
253
255
  const [isConfirmingRemoval, setIsConfirmingRemoval] = useState(false)
254
256
  const [isShowingDeliveries, setIsShowingDeliveries] = useState(false)
255
257
  const [isRotating, setIsRotating] = useState(false)
@@ -319,7 +321,7 @@ function WebhookRow({
319
321
 
320
322
  <div className="mt-3 flex flex-wrap items-center gap-4 text-[11px] text-ink-faint">
321
323
  <span className="font-mono">Secret {webhook.secretPrefix}</span>
322
- <span>Last delivery: {describeLastDelivery(webhook)}</span>
324
+ <span>Last delivery: {describeLastDelivery(webhook, timezone)}</span>
323
325
  <button
324
326
  type="button"
325
327
  aria-expanded={isShowingDeliveries}
@@ -434,10 +436,10 @@ function RotatePanel({
434
436
  }
435
437
 
436
438
  /** Both fields are null together until the first delivery settles. */
437
- function describeLastDelivery(webhook: Webhook): string {
439
+ function describeLastDelivery(webhook: Webhook, timezone: string): string {
438
440
  if (webhook.lastDeliveryAt === null || webhook.lastDeliveryStatus === null) {
439
441
  return 'Never'
440
442
  }
441
443
 
442
- return `${formatDateTime(webhook.lastDeliveryAt)} (${webhook.lastDeliveryStatus})`
444
+ return `${formatDateTime(webhook.lastDeliveryAt, timezone)} (${webhook.lastDeliveryStatus})`
443
445
  }
@@ -2,7 +2,7 @@ import { useState } from 'react'
2
2
  import type { FormEvent } from 'react'
3
3
  import { Link } from 'react-router'
4
4
 
5
- import { resetUrlTemplate, useRequestPasswordReset } from '../../api/resources/session.ts'
5
+ import { useRequestPasswordReset } from '../../api/resources/session.ts'
6
6
  import { ErrorPanel } from '../../components/QueryState.tsx'
7
7
  import { SubmitButton, TextField } from './AuthForm.tsx'
8
8
  import { AuthLayout } from './AuthLayout.tsx'
@@ -29,7 +29,7 @@ export function ForgotPasswordPage(): React.JSX.Element {
29
29
  const address = email.trim()
30
30
 
31
31
  request
32
- .runAsync({ email: address, resetUrlTemplate: resetUrlTemplate(window.location.origin) })
32
+ .runAsync({ email: address })
33
33
  .then(() => {
34
34
  setSentTo(address)
35
35
  })
@@ -11,9 +11,11 @@ import { AuthLayout } from './AuthLayout.tsx'
11
11
  /**
12
12
  * Creating an account, against `POST /v1/auth/signup`.
13
13
  *
14
- * Signup makes the user and nothing else, per `onboarding.md`, so success lands
15
- * on the first onboarding step rather than in the app. The response sets the
16
- * session cookie, which is why the next page can already write.
14
+ * Signup makes the user and nothing else, per `onboarding.md`, so success
15
+ * lands on the email-verification screen rather than in the app or the first
16
+ * onboarding step: the account cannot create a workspace until it verifies.
17
+ * The response sets the session cookie, which is why that next page can
18
+ * already act as the signed-in account.
17
19
  *
18
20
  * The mockup collected this into `sessionStorage` and committed the lot at the
19
21
  * end of the wizard. Here each step commits as it is finished: a draft account
@@ -41,15 +43,19 @@ export function SignUpPage(): React.JSX.Element {
41
43
  setLocalError(null)
42
44
 
43
45
  signUp
44
- .runAsync({ name: name.trim(), email: email.trim(), password })
45
- .then(() => navigate('/onboarding/workspace', { replace: true }))
46
+ .runAsync({
47
+ name: name.trim(),
48
+ email: email.trim(),
49
+ password,
50
+ })
51
+ .then(() => navigate('/verify-email/pending', { replace: true }))
46
52
  .catch(() => undefined)
47
53
  }
48
54
 
49
55
  return (
50
56
  <AuthLayout
51
57
  title="Create account"
52
- description="Next you will create a workspace for your company."
58
+ description="Next you will verify your email, then create a workspace for your company."
53
59
  footer={
54
60
  <span className="text-ink-muted">
55
61
  Already have an account?{' '}
@@ -0,0 +1,81 @@
1
+ import { useEffect, useRef, useState } from 'react'
2
+ import { Navigate, useSearchParams } from 'react-router'
3
+
4
+ import { useConfirmEmailVerification, useSession } from '../../api/resources/session.ts'
5
+ import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
6
+ import { AuthLayout } from './AuthLayout.tsx'
7
+
8
+ /**
9
+ * Where a verification email lands: `/verify-email?token=…`.
10
+ *
11
+ * Spent automatically on load, unlike accepting an invitation: confirming
12
+ * only flips whether the account is verified. There is no workspace
13
+ * membership or other side effect a confirmation button would be guarding.
14
+ */
15
+ export function VerifyEmailConfirmPage(): React.JSX.Element {
16
+ const [searchParameters] = useSearchParams()
17
+ const token = searchParameters.get('token') ?? ''
18
+ const confirm = useConfirmEmailVerification()
19
+ // `confirm` is a fresh object every render, so the effect below reads it
20
+ // through a ref rather than depending on it: depending on it would spend
21
+ // the token again on every render instead of once per token.
22
+ const confirmRef = useRef(confirm)
23
+ confirmRef.current = confirm
24
+ const { isLoading, isSignedOut, needsWorkspace } = useSession()
25
+ const [succeeded, setSucceeded] = useState(false)
26
+
27
+ useEffect(() => {
28
+ if (token.length === 0) {
29
+ return
30
+ }
31
+
32
+ // Guards a state update after the token was already spent by an earlier
33
+ // mount of this effect, not a retry: the request itself only ever fires
34
+ // once per token, since `token` is the only dependency.
35
+ let active = true
36
+
37
+ confirmRef.current
38
+ .runAsync({ token })
39
+ .then(() => {
40
+ if (active) {
41
+ setSucceeded(true)
42
+ }
43
+ })
44
+ .catch(() => undefined)
45
+
46
+ return () => {
47
+ active = false
48
+ }
49
+ }, [token])
50
+
51
+ if (token.length === 0) {
52
+ return (
53
+ <AuthLayout title="This link is incomplete">
54
+ <p className="mt-4 text-[13px] text-ink-muted">It carries no verification token.</p>
55
+ </AuthLayout>
56
+ )
57
+ }
58
+
59
+ if (confirm.error !== null) {
60
+ return (
61
+ <AuthLayout title="This link is invalid or has expired">
62
+ <div className="mt-4">
63
+ <ErrorPanel error={confirm.error} />
64
+ </div>
65
+ </AuthLayout>
66
+ )
67
+ }
68
+
69
+ if (!succeeded || isLoading) {
70
+ return <LoadingPanel />
71
+ }
72
+
73
+ // Confirmed. A signed-in caller moves on; `SessionGate` and the onboarding
74
+ // routes take it from there. A signed-out one goes to sign in.
75
+ return (
76
+ <Navigate
77
+ to={isSignedOut ? '/login' : needsWorkspace ? '/onboarding/workspace' : '/dashboard'}
78
+ replace
79
+ />
80
+ )
81
+ }
@@ -0,0 +1,65 @@
1
+ import { useState } from 'react'
2
+ import { Navigate } from 'react-router'
3
+
4
+ import { useLogOut, useRequestEmailVerification, useSession } from '../../api/resources/session.ts'
5
+ import { ErrorPanel } from '../../components/QueryState.tsx'
6
+ import { AuthLayout } from './AuthLayout.tsx'
7
+
8
+ /**
9
+ * Where `SessionGate` sends a signed-in account with no workspace and an
10
+ * unverified email, and where `SignUpPage` navigates straight after signup.
11
+ *
12
+ * There is nothing to submit here: the account already exists, and the first
13
+ * verification link already went out with `POST /v1/auth/signup`. The only
14
+ * actions from this screen are asking for a fresh link and signing out.
15
+ */
16
+ export function VerifyEmailPendingPage(): React.JSX.Element {
17
+ const { isSignedOut } = useSession()
18
+ const requestVerification = useRequestEmailVerification()
19
+ const logOut = useLogOut()
20
+ const [resent, setResent] = useState(false)
21
+
22
+ if (isSignedOut) {
23
+ return <Navigate to="/login" replace />
24
+ }
25
+
26
+ function resend(): void {
27
+ requestVerification
28
+ .runAsync()
29
+ .then(() => {
30
+ setResent(true)
31
+ })
32
+ .catch(() => undefined)
33
+ }
34
+
35
+ return (
36
+ <AuthLayout
37
+ title="Check your email"
38
+ description="Click the link we sent to finish setting up your account."
39
+ footer={
40
+ <button
41
+ type="button"
42
+ onClick={() => {
43
+ logOut.runAsync().catch(() => undefined)
44
+ }}
45
+ className="font-medium text-accent hover:underline"
46
+ >
47
+ Sign out
48
+ </button>
49
+ }
50
+ >
51
+ <div className="mt-5 space-y-3">
52
+ {resent && <p className="text-[12px] text-ink-muted">A new link is on its way.</p>}
53
+ {requestVerification.error !== null && <ErrorPanel error={requestVerification.error} />}
54
+ <button
55
+ type="button"
56
+ disabled={requestVerification.isPending}
57
+ onClick={resend}
58
+ className="w-full rounded-md bg-accent px-3.5 py-2 text-[12px] font-semibold text-accent-fg transition hover:bg-accent-hover disabled:opacity-50"
59
+ >
60
+ {requestVerification.isPending ? 'Sending…' : 'Resend link'}
61
+ </button>
62
+ </div>
63
+ </AuthLayout>
64
+ )
65
+ }
@@ -1,5 +1,6 @@
1
1
  import type { Dashboard } from '@kelpie/schemas'
2
2
 
3
+ import { useTimezone } from '../../api/resources/account.ts'
3
4
  import { useDashboard } from '../../api/resources/dashboard.ts'
4
5
  import { useMembers } from '../../api/resources/members.ts'
5
6
  import { useWorkspace } from '../../api/resources/workspace.ts'
@@ -20,7 +21,7 @@ import { ActivityFeed, AttentionList, DecisionsList, NotesList } from './section
20
21
 
21
22
  /** The heading date, written in the workspace's own day rather than the browser's. */
22
23
  function briefHeading(dashboard: Dashboard): string {
23
- return new Intl.DateTimeFormat('en-AU', {
24
+ return new Intl.DateTimeFormat(undefined, {
24
25
  weekday: 'long',
25
26
  month: 'short',
26
27
  day: 'numeric',
@@ -32,6 +33,7 @@ export function DashboardPage(): React.JSX.Element {
32
33
  const { dashboard, isLoading, error } = useDashboard()
33
34
  const { workspace } = useWorkspace()
34
35
  const { nameById } = useMembers()
36
+ const timezone = useTimezone()
35
37
 
36
38
  return (
37
39
  <div className="animate-fade-in">
@@ -46,6 +48,7 @@ export function DashboardPage(): React.JSX.Element {
46
48
  workspaceId={workspace?.id}
47
49
  workspaceName={workspace?.name ?? 'This workspace'}
48
50
  nameById={nameById}
51
+ timezone={timezone}
49
52
  />
50
53
  )}
51
54
  </div>
@@ -57,11 +60,13 @@ function DashboardBody({
57
60
  workspaceId,
58
61
  workspaceName,
59
62
  nameById,
63
+ timezone,
60
64
  }: {
61
65
  readonly dashboard: Dashboard
62
66
  readonly workspaceId: string | undefined
63
67
  readonly workspaceName: string
64
68
  readonly nameById: ReadonlyMap<string, string>
69
+ readonly timezone: string
65
70
  }): React.JSX.Element {
66
71
  // `generatedAt` rather than a fresh `new Date()`: every relative time on the
67
72
  // page is then measured from the same instant the counts were, so a tab left
@@ -97,11 +102,16 @@ function DashboardBody({
97
102
 
98
103
  <div className="mb-8 grid gap-8 lg:grid-cols-2">
99
104
  <AttentionList rows={attentionRows(dashboard)} />
100
- <ActivityFeed activities={dashboard.recentActivity} nameById={nameById} now={now} />
105
+ <ActivityFeed
106
+ activities={dashboard.recentActivity}
107
+ nameById={nameById}
108
+ now={now}
109
+ timezone={timezone}
110
+ />
101
111
  </div>
102
112
  <div className="grid gap-8 lg:grid-cols-2">
103
- <NotesList notes={dashboard.recentNotes} nameById={nameById} now={now} />
104
- <DecisionsList decisions={dashboard.recentDecisions} nameById={nameById} />
113
+ <NotesList notes={dashboard.recentNotes} nameById={nameById} now={now} timezone={timezone} />
114
+ <DecisionsList decisions={dashboard.recentDecisions} nameById={nameById} timezone={timezone} />
105
115
  </div>
106
116
  </div>
107
117
  )
@@ -106,10 +106,12 @@ export function ActivityFeed({
106
106
  activities,
107
107
  nameById,
108
108
  now,
109
+ timezone,
109
110
  }: {
110
111
  readonly activities: readonly DashboardActivity[]
111
112
  readonly nameById: ReadonlyMap<string, string>
112
113
  readonly now: Date
114
+ readonly timezone: string
113
115
  }): React.JSX.Element {
114
116
  return (
115
117
  <section>
@@ -145,7 +147,7 @@ export function ActivityFeed({
145
147
  dateTime={activity.createdAt.toISOString()}
146
148
  className="shrink-0 text-[11px] text-ink-faint"
147
149
  >
148
- {formatRelativeTime(activity.createdAt, now)}
150
+ {formatRelativeTime(activity.createdAt, timezone, now)}
149
151
  </time>
150
152
  </div>
151
153
  <p className="text-[11px] leading-snug text-ink-faint">
@@ -184,10 +186,12 @@ export function NotesList({
184
186
  notes,
185
187
  nameById,
186
188
  now,
189
+ timezone,
187
190
  }: {
188
191
  readonly notes: readonly DashboardNote[]
189
192
  readonly nameById: ReadonlyMap<string, string>
190
193
  readonly now: Date
194
+ readonly timezone: string
191
195
  }): React.JSX.Element {
192
196
  return (
193
197
  <section>
@@ -211,7 +215,7 @@ export function NotesList({
211
215
  <span>·</span>
212
216
  <span>{note.authorId === null ? 'System' : (nameById.get(note.authorId) ?? 'Unknown')}</span>
213
217
  <span>·</span>
214
- <span>{formatRelativeTime(note.createdAt, now)}</span>
218
+ <span>{formatRelativeTime(note.createdAt, timezone, now)}</span>
215
219
  </div>
216
220
  </li>
217
221
  ))}
@@ -224,9 +228,11 @@ export function NotesList({
224
228
  export function DecisionsList({
225
229
  decisions,
226
230
  nameById,
231
+ timezone,
227
232
  }: {
228
233
  readonly decisions: readonly DashboardDecision[]
229
234
  readonly nameById: ReadonlyMap<string, string>
235
+ readonly timezone: string
230
236
  }): React.JSX.Element {
231
237
  return (
232
238
  <section>
@@ -254,7 +260,7 @@ export function DecisionsList({
254
260
  <div className="mt-2 flex flex-wrap items-center gap-2 text-[11px] text-ink-faint">
255
261
  <TargetLink target={decision} />
256
262
  <span>·</span>
257
- <span>{formatDate(decision.decidedAt)}</span>
263
+ <span>{formatDate(decision.decidedAt, timezone)}</span>
258
264
  <span>·</span>
259
265
  <span>
260
266
  {decision.ownerId === null ? '—' : (nameById.get(decision.ownerId) ?? 'Unknown')}
@@ -3,6 +3,7 @@ import { useMemo } from 'react'
3
3
  import { Link } from 'react-router'
4
4
 
5
5
  import type { RecordListResult } from '../../api/resource.ts'
6
+ import { useTimezone } from '../../api/resources/account.ts'
6
7
  import { useCompanies } from '../../api/resources/companies.ts'
7
8
  import { usePeople } from '../../api/resources/people.ts'
8
9
  import { DataTable } from '../../components/DataTable.tsx'
@@ -31,6 +32,7 @@ export interface SubmissionsTableProps {
31
32
  export function SubmissionsTable({ form, submissions }: SubmissionsTableProps): React.JSX.Element {
32
33
  const people = usePeople({ limit: MAX_PAGE })
33
34
  const companies = useCompanies({ limit: MAX_PAGE })
35
+ const timezone = useTimezone()
34
36
 
35
37
  const nameById = useMemo(
36
38
  () => new Map([...people.records, ...companies.records].map((record) => [record.id, record.name])),
@@ -44,7 +46,7 @@ export function SubmissionsTable({ form, submissions }: SubmissionsTableProps):
44
46
  className: 'w-40',
45
47
  render: (submission) => (
46
48
  <span className="font-mono text-[12px] text-ink-muted">
47
- {formatDateTime(submission.submittedAt)}
49
+ {formatDateTime(submission.submittedAt, timezone)}
48
50
  </span>
49
51
  ),
50
52
  },
@@ -13,6 +13,7 @@ import type { HandbookPage } from '@kelpie/schemas'
13
13
  import { useEffect, useMemo, useState } from 'react'
14
14
  import { Link, useNavigate, useParams } from 'react-router'
15
15
 
16
+ import { useTimezone } from '../../api/resources/account.ts'
16
17
  import {
17
18
  useCreateHandbookPage,
18
19
  useDeleteHandbookPage,
@@ -384,6 +385,7 @@ function HandbookEditor({
384
385
  const [editing, setEditing] = useState(false)
385
386
  const [title, setTitle] = useState(page.title)
386
387
  const [body, setBody] = useState(page.body)
388
+ const timezone = useTimezone()
387
389
 
388
390
  useEffect(() => {
389
391
  setTitle(page.title)
@@ -415,7 +417,7 @@ function HandbookEditor({
415
417
  <h1 className="text-[18px] font-semibold tracking-tight text-ink">{page.title}</h1>
416
418
  )}
417
419
  <div className="mt-1 text-[11px] text-ink-faint">
418
- Updated {formatDateTime(page.updatedAt)}
420
+ Updated {formatDateTime(page.updatedAt, timezone)}
419
421
  {authorName === undefined ? '' : ` · ${authorName}`}
420
422
  </div>
421
423
  </div>