create-principles-disciple 1.146.3 → 1.146.6
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.
- package/_release/product-identity.json +1 -1
- package/console/dist/web/assets/app.js +26 -26
- package/console/package.json +1 -1
- package/package.json +3 -3
- package/pd-cli/package.json +1 -1
- package/release-manager/package.json +3 -3
- package/console/dist/ui/App.d.ts +0 -1
- package/console/dist/ui/App.js +0 -172
- package/console/dist/ui/api.d.ts +0 -611
- package/console/dist/ui/api.js +0 -1094
- package/console/dist/ui/components/auth/login-form.d.ts +0 -4
- package/console/dist/ui/components/auth/login-form.js +0 -142
- package/console/dist/ui/components/auth/splash-screen.d.ts +0 -9
- package/console/dist/ui/components/auth/splash-screen.js +0 -22
- package/console/dist/ui/components/error-boundary.d.ts +0 -15
- package/console/dist/ui/components/error-boundary.js +0 -30
- package/console/dist/ui/components/focus/daily-thought-card.d.ts +0 -1
- package/console/dist/ui/components/focus/daily-thought-card.js +0 -41
- package/console/dist/ui/components/language-switcher.d.ts +0 -2
- package/console/dist/ui/components/language-switcher.js +0 -17
- package/console/dist/ui/components/layout/app-sidebar.d.ts +0 -27
- package/console/dist/ui/components/layout/app-sidebar.js +0 -128
- package/console/dist/ui/components/layout/page-loading.d.ts +0 -13
- package/console/dist/ui/components/layout/page-loading.js +0 -14
- package/console/dist/ui/components/layout/page-shell.d.ts +0 -12
- package/console/dist/ui/components/layout/page-shell.js +0 -11
- package/console/dist/ui/components/layout/section-title.d.ts +0 -10
- package/console/dist/ui/components/layout/section-title.js +0 -9
- package/console/dist/ui/components/notifications/NotificationProvider.d.ts +0 -14
- package/console/dist/ui/components/notifications/NotificationProvider.js +0 -136
- package/console/dist/ui/components/notifications/favicon-badge.d.ts +0 -3
- package/console/dist/ui/components/notifications/favicon-badge.js +0 -68
- package/console/dist/ui/components/notifications/notification-reducer.d.ts +0 -9
- package/console/dist/ui/components/notifications/notification-reducer.js +0 -9
- package/console/dist/ui/components/notifications/sound-storage.d.ts +0 -3
- package/console/dist/ui/components/notifications/sound-storage.js +0 -37
- package/console/dist/ui/components/notifications/useNotifications.d.ts +0 -1
- package/console/dist/ui/components/notifications/useNotifications.js +0 -9
- package/console/dist/ui/components/onboarding/CircuitDiagram.d.ts +0 -8
- package/console/dist/ui/components/onboarding/CircuitDiagram.js +0 -18
- package/console/dist/ui/components/onboarding/DemoResultView.d.ts +0 -22
- package/console/dist/ui/components/onboarding/DemoResultView.js +0 -33
- package/console/dist/ui/components/onboarding/SlashCommandsCard.d.ts +0 -16
- package/console/dist/ui/components/onboarding/SlashCommandsCard.js +0 -20
- package/console/dist/ui/components/onboarding/slashCommands.d.ts +0 -20
- package/console/dist/ui/components/onboarding/slashCommands.js +0 -22
- package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.d.ts +0 -6
- package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.js +0 -66
- package/console/dist/ui/components/theme-provider.d.ts +0 -14
- package/console/dist/ui/components/theme-provider.js +0 -40
- package/console/dist/ui/components/theme-toggle.d.ts +0 -2
- package/console/dist/ui/components/theme-toggle.js +0 -11
- package/console/dist/ui/components/ui/alert-dialog.d.ts +0 -20
- package/console/dist/ui/components/ui/alert-dialog.js +0 -26
- package/console/dist/ui/components/ui/badge.d.ts +0 -9
- package/console/dist/ui/components/ui/badge.js +0 -22
- package/console/dist/ui/components/ui/button.d.ts +0 -11
- package/console/dist/ui/components/ui/button.js +0 -34
- package/console/dist/ui/components/ui/card.d.ts +0 -8
- package/console/dist/ui/components/ui/card.js +0 -16
- package/console/dist/ui/components/ui/charts.d.ts +0 -51
- package/console/dist/ui/components/ui/charts.js +0 -72
- package/console/dist/ui/components/ui/dialog.d.ts +0 -19
- package/console/dist/ui/components/ui/dialog.js +0 -22
- package/console/dist/ui/components/ui/input.d.ts +0 -3
- package/console/dist/ui/components/ui/input.js +0 -8
- package/console/dist/ui/components/ui/markdown.d.ts +0 -24
- package/console/dist/ui/components/ui/markdown.js +0 -119
- package/console/dist/ui/components/ui/progress-bar.d.ts +0 -20
- package/console/dist/ui/components/ui/progress-bar.js +0 -38
- package/console/dist/ui/components/ui/select.d.ts +0 -13
- package/console/dist/ui/components/ui/select.js +0 -26
- package/console/dist/ui/components/ui/separator.d.ts +0 -3
- package/console/dist/ui/components/ui/separator.js +0 -6
- package/console/dist/ui/components/ui/sheet.d.ts +0 -25
- package/console/dist/ui/components/ui/sheet.js +0 -37
- package/console/dist/ui/components/ui/shiny-text.d.ts +0 -28
- package/console/dist/ui/components/ui/shiny-text.js +0 -46
- package/console/dist/ui/components/ui/skeleton.d.ts +0 -3
- package/console/dist/ui/components/ui/skeleton.js +0 -6
- package/console/dist/ui/components/ui/sonner.d.ts +0 -3
- package/console/dist/ui/components/ui/sonner.js +0 -13
- package/console/dist/ui/components/ui/tooltip.d.ts +0 -7
- package/console/dist/ui/components/ui/tooltip.js +0 -10
- package/console/dist/ui/data/daily-thoughts.d.ts +0 -15
- package/console/dist/ui/data/daily-thoughts.js +0 -164
- package/console/dist/ui/hooks/useNotificationSound.d.ts +0 -12
- package/console/dist/ui/hooks/useNotificationSound.js +0 -74
- package/console/dist/ui/i18n/en.json +0 -2399
- package/console/dist/ui/i18n/index.d.ts +0 -2
- package/console/dist/ui/i18n/index.js +0 -32
- package/console/dist/ui/i18n/zh-CN.json +0 -2399
- package/console/dist/ui/main.d.ts +0 -1
- package/console/dist/ui/main.js +0 -9
- package/console/dist/ui/pages/ReportProblemValidators.d.ts +0 -144
- package/console/dist/ui/pages/ReportProblemValidators.js +0 -418
- package/console/dist/ui/pages/activation/ActivationPage.d.ts +0 -1
- package/console/dist/ui/pages/activation/ActivationPage.js +0 -512
- package/console/dist/ui/pages/activation/ActivationValidators.d.ts +0 -20
- package/console/dist/ui/pages/activation/ActivationValidators.js +0 -160
- package/console/dist/ui/pages/control-center/AgentCard.d.ts +0 -31
- package/console/dist/ui/pages/control-center/AgentCard.js +0 -212
- package/console/dist/ui/pages/control-center/AgentGroup.d.ts +0 -26
- package/console/dist/ui/pages/control-center/AgentGroup.js +0 -38
- package/console/dist/ui/pages/control-center/ControlCenterPage.d.ts +0 -1
- package/console/dist/ui/pages/control-center/ControlCenterPage.js +0 -509
- package/console/dist/ui/pages/control-center/DesignGatePanel.d.ts +0 -1
- package/console/dist/ui/pages/control-center/DesignGatePanel.js +0 -137
- package/console/dist/ui/pages/control-center/RuntimeProfileManager.d.ts +0 -31
- package/console/dist/ui/pages/control-center/RuntimeProfileManager.js +0 -199
- package/console/dist/ui/pages/control-center/WorkflowDiagram.d.ts +0 -17
- package/console/dist/ui/pages/control-center/WorkflowDiagram.js +0 -55
- package/console/dist/ui/pages/debt/DebtPage.d.ts +0 -2
- package/console/dist/ui/pages/debt/DebtPage.js +0 -222
- package/console/dist/ui/pages/design-system/DesignSystemPage.d.ts +0 -2
- package/console/dist/ui/pages/design-system/DesignSystemPage.js +0 -30
- package/console/dist/ui/pages/examiner/ExaminerPage.d.ts +0 -15
- package/console/dist/ui/pages/examiner/ExaminerPage.js +0 -158
- package/console/dist/ui/pages/failed-tasks/FailedTasksPage.d.ts +0 -1
- package/console/dist/ui/pages/failed-tasks/FailedTasksPage.js +0 -421
- package/console/dist/ui/pages/focus/ApprovalSubjectReading.d.ts +0 -24
- package/console/dist/ui/pages/focus/ApprovalSubjectReading.js +0 -133
- package/console/dist/ui/pages/focus/FocusPage.d.ts +0 -123
- package/console/dist/ui/pages/focus/FocusPage.js +0 -567
- package/console/dist/ui/pages/focus/OwnerDecisionCard.d.ts +0 -9
- package/console/dist/ui/pages/focus/OwnerDecisionCard.js +0 -111
- package/console/dist/ui/pages/focus/OwnerWorkbench.d.ts +0 -19
- package/console/dist/ui/pages/focus/OwnerWorkbench.js +0 -75
- package/console/dist/ui/pages/focus/RuleCandidateBindingPanel.d.ts +0 -34
- package/console/dist/ui/pages/focus/RuleCandidateBindingPanel.js +0 -298
- package/console/dist/ui/pages/focus/focus-validation.d.ts +0 -40
- package/console/dist/ui/pages/focus/focus-validation.js +0 -211
- package/console/dist/ui/pages/intent/IntentOnboarding.d.ts +0 -67
- package/console/dist/ui/pages/intent/IntentOnboarding.js +0 -289
- package/console/dist/ui/pages/intent/IntentPage.d.ts +0 -1
- package/console/dist/ui/pages/intent/IntentPage.js +0 -252
- package/console/dist/ui/pages/pain/PainEvidenceValidators.d.ts +0 -59
- package/console/dist/ui/pages/pain/PainEvidenceValidators.js +0 -125
- package/console/dist/ui/pages/pain/PainPage.d.ts +0 -1
- package/console/dist/ui/pages/pain/PainPage.js +0 -420
- package/console/dist/ui/pages/pain/pain-card-helpers.d.ts +0 -175
- package/console/dist/ui/pages/pain/pain-card-helpers.js +0 -181
- package/console/dist/ui/pages/principles/CorePrinciplesPage.d.ts +0 -10
- package/console/dist/ui/pages/principles/CorePrinciplesPage.js +0 -59
- package/console/dist/ui/pages/principles/PrincipleDetailPage.d.ts +0 -60
- package/console/dist/ui/pages/principles/PrincipleDetailPage.js +0 -602
- package/console/dist/ui/pages/principles/PrinciplesPage.d.ts +0 -1
- package/console/dist/ui/pages/principles/PrinciplesPage.js +0 -327
- package/console/dist/ui/pages/principles/PrinciplesViewNav.d.ts +0 -8
- package/console/dist/ui/pages/principles/PrinciplesViewNav.js +0 -15
- package/console/dist/ui/pages/report-problem/ReportProblemPage.d.ts +0 -1
- package/console/dist/ui/pages/report-problem/ReportProblemPage.js +0 -467
- package/console/dist/ui/pages/settings/SettingsPage.d.ts +0 -4
- package/console/dist/ui/pages/settings/SettingsPage.js +0 -457
- package/console/dist/ui/pages/settings/UpdatePage.d.ts +0 -1
- package/console/dist/ui/pages/settings/UpdatePage.js +0 -215
- package/console/dist/ui/pages/welcome/WelcomePage.d.ts +0 -5
- package/console/dist/ui/pages/welcome/WelcomePage.js +0 -187
- package/console/dist/ui/utils/agent-metadata.d.ts +0 -71
- package/console/dist/ui/utils/agent-metadata.js +0 -284
- package/console/dist/ui/utils/approval-review.d.ts +0 -30
- package/console/dist/ui/utils/approval-review.js +0 -50
- package/console/dist/ui/utils/approval-warning-localization.d.ts +0 -34
- package/console/dist/ui/utils/approval-warning-localization.js +0 -148
- package/console/dist/ui/utils/attention-presentation.d.ts +0 -35
- package/console/dist/ui/utils/attention-presentation.js +0 -46
- package/console/dist/ui/utils/blocker-localization.d.ts +0 -23
- package/console/dist/ui/utils/blocker-localization.js +0 -36
- package/console/dist/ui/utils/control-center-helpers.d.ts +0 -79
- package/console/dist/ui/utils/control-center-helpers.js +0 -189
- package/console/dist/ui/utils/enum-labels.d.ts +0 -50
- package/console/dist/ui/utils/enum-labels.js +0 -171
- package/console/dist/ui/utils/format-date.d.ts +0 -11
- package/console/dist/ui/utils/format-date.js +0 -17
- package/console/dist/ui/utils/onboarding-state.d.ts +0 -25
- package/console/dist/ui/utils/onboarding-state.js +0 -77
- package/console/dist/ui/utils/reading-layout.d.ts +0 -20
- package/console/dist/ui/utils/reading-layout.js +0 -46
- package/console/dist/ui/utils/rule-binding-validators.d.ts +0 -13
- package/console/dist/ui/utils/rule-binding-validators.js +0 -188
- package/console/dist/ui/utils/runtime-mode.d.ts +0 -11
- package/console/dist/ui/utils/runtime-mode.js +0 -11
- package/console/dist/ui/utils/token-storage.d.ts +0 -22
- package/console/dist/ui/utils/token-storage.js +0 -47
- package/console/dist/ui/utils/validators.d.ts +0 -1178
- package/console/dist/ui/utils/validators.js +0 -3297
- package/release-manager/dist/bootstrap-entry.d.ts +0 -2
- package/release-manager/dist/bootstrap-entry.d.ts.map +0 -1
- package/release-manager/dist/bootstrap-entry.js.map +0 -1
- package/release-manager/dist/i18n.d.ts +0 -6
- package/release-manager/dist/i18n.d.ts.map +0 -1
- package/release-manager/dist/i18n.js.map +0 -1
- package/release-manager/dist/index.d.ts +0 -7
- package/release-manager/dist/index.d.ts.map +0 -1
- package/release-manager/dist/index.js +0 -656
- package/release-manager/dist/index.js.map +0 -1
- package/release-manager/dist/installer.d.ts +0 -629
- package/release-manager/dist/installer.d.ts.map +0 -1
- package/release-manager/dist/installer.js.map +0 -1
- package/release-manager/dist/installers/codex-host-installer.d.ts +0 -39
- package/release-manager/dist/installers/codex-host-installer.d.ts.map +0 -1
- package/release-manager/dist/installers/codex-host-installer.js.map +0 -1
- package/release-manager/dist/installers/index.d.ts +0 -51
- package/release-manager/dist/installers/index.d.ts.map +0 -1
- package/release-manager/dist/installers/index.js.map +0 -1
- package/release-manager/dist/installers/openclaw-host-installer.d.ts +0 -14
- package/release-manager/dist/installers/openclaw-host-installer.d.ts.map +0 -1
- package/release-manager/dist/installers/openclaw-host-installer.js.map +0 -1
- package/release-manager/dist/installers/workbuddy-host-installer.d.ts +0 -335
- package/release-manager/dist/installers/workbuddy-host-installer.d.ts.map +0 -1
- package/release-manager/dist/installers/workbuddy-host-installer.js.map +0 -1
- package/release-manager/dist/mvp-config.d.ts +0 -233
- package/release-manager/dist/mvp-config.d.ts.map +0 -1
- package/release-manager/dist/mvp-config.js.map +0 -1
- package/release-manager/dist/prompts.d.ts +0 -43
- package/release-manager/dist/prompts.d.ts.map +0 -1
- package/release-manager/dist/prompts.js +0 -268
- package/release-manager/dist/prompts.js.map +0 -1
- package/release-manager/dist/skill-language.d.ts +0 -32
- package/release-manager/dist/skill-language.d.ts.map +0 -1
- package/release-manager/dist/skill-language.js.map +0 -1
- package/release-manager/dist/uninstaller.d.ts +0 -68
- package/release-manager/dist/uninstaller.d.ts.map +0 -1
- package/release-manager/dist/uninstaller.js +0 -746
- package/release-manager/dist/uninstaller.js.map +0 -1
- package/release-manager/dist/update/apply-payload.d.ts +0 -143
- package/release-manager/dist/update/apply-payload.d.ts.map +0 -1
- package/release-manager/dist/update/apply-payload.js.map +0 -1
- package/release-manager/dist/update/atomic-file.d.ts +0 -35
- package/release-manager/dist/update/atomic-file.d.ts.map +0 -1
- package/release-manager/dist/update/atomic-file.js.map +0 -1
- package/release-manager/dist/update/bootstrap-executor.d.ts +0 -21
- package/release-manager/dist/update/bootstrap-executor.d.ts.map +0 -1
- package/release-manager/dist/update/bootstrap-executor.js.map +0 -1
- package/release-manager/dist/update/bootstrap-protocol.d.ts +0 -56
- package/release-manager/dist/update/bootstrap-protocol.d.ts.map +0 -1
- package/release-manager/dist/update/bootstrap-protocol.js.map +0 -1
- package/release-manager/dist/update/channel-metadata.d.ts +0 -28
- package/release-manager/dist/update/channel-metadata.d.ts.map +0 -1
- package/release-manager/dist/update/channel-metadata.js.map +0 -1
- package/release-manager/dist/update/channel-promotion.d.ts +0 -39
- package/release-manager/dist/update/channel-promotion.d.ts.map +0 -1
- package/release-manager/dist/update/channel-promotion.js +0 -55
- package/release-manager/dist/update/channel-promotion.js.map +0 -1
- package/release-manager/dist/update/console-surface.d.ts +0 -19
- package/release-manager/dist/update/console-surface.d.ts.map +0 -1
- package/release-manager/dist/update/console-surface.js.map +0 -1
- package/release-manager/dist/update/data-compatibility.d.ts +0 -35
- package/release-manager/dist/update/data-compatibility.d.ts.map +0 -1
- package/release-manager/dist/update/data-compatibility.js +0 -45
- package/release-manager/dist/update/data-compatibility.js.map +0 -1
- package/release-manager/dist/update/install-layout.d.ts +0 -105
- package/release-manager/dist/update/install-layout.d.ts.map +0 -1
- package/release-manager/dist/update/install-layout.js.map +0 -1
- package/release-manager/dist/update/product-identity.d.ts +0 -70
- package/release-manager/dist/update/product-identity.d.ts.map +0 -1
- package/release-manager/dist/update/product-identity.js.map +0 -1
- package/release-manager/dist/update/release-asset-manifest.d.ts +0 -31
- package/release-manager/dist/update/release-asset-manifest.d.ts.map +0 -1
- package/release-manager/dist/update/release-asset-manifest.js.map +0 -1
- package/release-manager/dist/update/release-identity.d.ts +0 -33
- package/release-manager/dist/update/release-identity.d.ts.map +0 -1
- package/release-manager/dist/update/release-identity.js.map +0 -1
- package/release-manager/dist/update/release-manager-authority.d.ts +0 -39
- package/release-manager/dist/update/release-manager-authority.d.ts.map +0 -1
- package/release-manager/dist/update/release-manager-authority.js.map +0 -1
- package/release-manager/dist/update/release-manager.d.ts +0 -156
- package/release-manager/dist/update/release-manager.d.ts.map +0 -1
- package/release-manager/dist/update/release-manager.js.map +0 -1
- package/release-manager/dist/update/release-metadata-publisher.d.ts +0 -199
- package/release-manager/dist/update/release-metadata-publisher.d.ts.map +0 -1
- package/release-manager/dist/update/release-metadata-publisher.js +0 -478
- package/release-manager/dist/update/release-metadata-publisher.js.map +0 -1
- package/release-manager/dist/update/release-metadata-source.d.ts +0 -85
- package/release-manager/dist/update/release-metadata-source.d.ts.map +0 -1
- package/release-manager/dist/update/release-metadata-source.js.map +0 -1
- package/release-manager/dist/update/release-metadata.d.ts +0 -60
- package/release-manager/dist/update/release-metadata.d.ts.map +0 -1
- package/release-manager/dist/update/release-metadata.js.map +0 -1
- package/release-manager/dist/update/release-policy.d.ts +0 -51
- package/release-manager/dist/update/release-policy.d.ts.map +0 -1
- package/release-manager/dist/update/release-policy.js.map +0 -1
- package/release-manager/dist/update/rollback-policy.d.ts +0 -56
- package/release-manager/dist/update/rollback-policy.d.ts.map +0 -1
- package/release-manager/dist/update/rollback-policy.js +0 -61
- package/release-manager/dist/update/rollback-policy.js.map +0 -1
- package/release-manager/dist/update/transaction-journal.d.ts +0 -212
- package/release-manager/dist/update/transaction-journal.d.ts.map +0 -1
- package/release-manager/dist/update/transaction-journal.js.map +0 -1
- package/release-manager/dist/update/trust-metadata.d.ts +0 -55
- package/release-manager/dist/update/trust-metadata.d.ts.map +0 -1
- package/release-manager/dist/update/trust-metadata.js.map +0 -1
- package/release-manager/dist/update/trust-root-provisioning.d.ts +0 -99
- package/release-manager/dist/update/trust-root-provisioning.d.ts.map +0 -1
- package/release-manager/dist/update/trust-root-provisioning.js.map +0 -1
- package/release-manager/dist/update/update-history.d.ts +0 -46
- package/release-manager/dist/update/update-history.d.ts.map +0 -1
- package/release-manager/dist/update/update-history.js +0 -123
- package/release-manager/dist/update/update-history.js.map +0 -1
- package/release-manager/dist/utils/config-file-io.d.ts +0 -34
- package/release-manager/dist/utils/config-file-io.d.ts.map +0 -1
- package/release-manager/dist/utils/config-file-io.js.map +0 -1
- package/release-manager/dist/utils/env.d.ts +0 -94
- package/release-manager/dist/utils/env.d.ts.map +0 -1
- package/release-manager/dist/utils/env.js.map +0 -1
- package/release-manager/dist/utils/logger.d.ts +0 -15
- package/release-manager/dist/utils/logger.d.ts.map +0 -1
- package/release-manager/dist/utils/logger.js.map +0 -1
- package/release-manager/dist/utils/workspace-divergence.d.ts +0 -36
- package/release-manager/dist/utils/workspace-divergence.d.ts.map +0 -1
- package/release-manager/dist/utils/workspace-divergence.js.map +0 -1
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { ThemeToggle } from "../theme-toggle.js";
|
|
5
|
-
import { setToken, clearToken, checkAuth } from "../../api.js";
|
|
6
|
-
import { toast } from "sonner";
|
|
7
|
-
function getCompanionBridge() {
|
|
8
|
-
if (typeof window === "undefined")
|
|
9
|
-
return undefined;
|
|
10
|
-
return window.pdCompanion;
|
|
11
|
-
}
|
|
12
|
-
export function LoginForm({ onAuthSuccess }) {
|
|
13
|
-
const { t } = useTranslation();
|
|
14
|
-
const [phase, setPhase] = React.useState({ kind: "checking" });
|
|
15
|
-
const [token, setTokenInput] = React.useState("");
|
|
16
|
-
const [error, setError] = React.useState(null);
|
|
17
|
-
// Auto-restore: ask the Companion for the stored credential and connect
|
|
18
|
-
// without user input. Absent companion / absent credential degrade to the
|
|
19
|
-
// manual form; a rejected read degrades to the manual form PLUS an
|
|
20
|
-
// observable diagnostic (rc-9) so version skew is not mistaken for "no
|
|
21
|
-
// credential". Runs once per mount (onAuthSuccess is a stable useCallback
|
|
22
|
-
// in App.tsx); the 重新连接 button re-enters the route to re-run it.
|
|
23
|
-
React.useEffect(() => {
|
|
24
|
-
const companion = getCompanionBridge();
|
|
25
|
-
if (companion === undefined) {
|
|
26
|
-
setPhase({ kind: "form" });
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
let cancelled = false;
|
|
30
|
-
void (async () => {
|
|
31
|
-
let status;
|
|
32
|
-
try {
|
|
33
|
-
status = await companion.getConsoleToken();
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
if (!cancelled)
|
|
37
|
-
setPhase({ kind: "form-with-read-error" });
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (cancelled)
|
|
41
|
-
return;
|
|
42
|
-
if (!status.available || status.token === undefined) {
|
|
43
|
-
setPhase({ kind: "form" });
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
setPhase({ kind: "connecting" });
|
|
47
|
-
setToken(status.token);
|
|
48
|
-
const valid = await checkAuth();
|
|
49
|
-
if (cancelled)
|
|
50
|
-
return;
|
|
51
|
-
if (valid) {
|
|
52
|
-
onAuthSuccess();
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
// checkAuth's 401 path only cleared the session when it was still
|
|
56
|
-
// this token (api.ts staleness guard).
|
|
57
|
-
setPhase({ kind: "recovery" });
|
|
58
|
-
}
|
|
59
|
-
})();
|
|
60
|
-
return () => {
|
|
61
|
-
cancelled = true;
|
|
62
|
-
};
|
|
63
|
-
}, [onAuthSuccess]);
|
|
64
|
-
// The 401 redirect appends session_expired=true before auto-restore has had
|
|
65
|
-
// a chance to run; that banner would be wrong ("expired") for a fresh
|
|
66
|
-
// browser session with a valid stored credential, so it is only surfaced on
|
|
67
|
-
// the manual-entry form.
|
|
68
|
-
React.useEffect(() => {
|
|
69
|
-
if (phase.kind !== "form" && phase.kind !== "form-with-read-error")
|
|
70
|
-
return;
|
|
71
|
-
if (window.location.hash.includes("session_expired=true")) {
|
|
72
|
-
setError(t("pages.login.errorExpired"));
|
|
73
|
-
}
|
|
74
|
-
}, [phase.kind, t]);
|
|
75
|
-
const persistToCompanion = async (value) => {
|
|
76
|
-
const companion = getCompanionBridge();
|
|
77
|
-
if (companion === undefined)
|
|
78
|
-
return;
|
|
79
|
-
try {
|
|
80
|
-
const result = await companion.configureConsoleToken(value);
|
|
81
|
-
if (!result.persisted) {
|
|
82
|
-
// rc-9: never fake success — the workspace opens, but the Owner must
|
|
83
|
-
// know the credential was NOT durably saved.
|
|
84
|
-
toast.error(t("pages.login.persistFailed"));
|
|
85
|
-
if (result.nextAction)
|
|
86
|
-
toast.info(result.nextAction, { duration: 8000 });
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (result.reason === "external_console_attached") {
|
|
90
|
-
toast.info(t("pages.login.persistAttached"));
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
toast.success(t("pages.login.persistSucceeded"));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
toast.error(t("pages.login.persistFailed"));
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
const handleSubmit = async (e) => {
|
|
101
|
-
e.preventDefault();
|
|
102
|
-
const trimmed = token.trim();
|
|
103
|
-
if (!trimmed)
|
|
104
|
-
return;
|
|
105
|
-
setError(null);
|
|
106
|
-
setPhase({ kind: "connecting" });
|
|
107
|
-
setToken(trimmed);
|
|
108
|
-
const valid = await checkAuth();
|
|
109
|
-
if (valid) {
|
|
110
|
-
await persistToCompanion(trimmed);
|
|
111
|
-
onAuthSuccess();
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
setError(t("pages.login.errorInvalid"));
|
|
115
|
-
setPhase({ kind: "form" });
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
// The detection effect keys on mount, so an honest retry re-enters the
|
|
119
|
-
// route with a clean state instead of duplicating the async body here.
|
|
120
|
-
const retryCompanionConnect = () => {
|
|
121
|
-
setError(null);
|
|
122
|
-
clearToken();
|
|
123
|
-
window.location.reload();
|
|
124
|
-
};
|
|
125
|
-
const showCard = (children) => (_jsxs("div", { className: "min-h-screen flex items-center justify-center bg-paper relative", style: {
|
|
126
|
-
backgroundImage: `linear-gradient(color-mix(in srgb, var(--color-gov) 3.5%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--color-gov) 3.5%, transparent) 1px, transparent 1px)`,
|
|
127
|
-
backgroundSize: "32px 32px",
|
|
128
|
-
}, children: [_jsx("div", { className: "absolute top-4 right-4", children: _jsx(ThemeToggle, {}) }), _jsxs("div", { className: "w-full max-w-[400px] mx-4 p-8 bg-surface rounded-[var(--radius-md)] border border-line shadow-card", children: [_jsxs("div", { className: "flex flex-col items-center mb-6", children: [_jsxs("svg", { viewBox: "0 0 28 28", className: "w-12 h-12 text-gov mb-3", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [_jsx("path", { d: "M6 4V24M22 4V24M2 14H26", strokeLinecap: "square" }), _jsx("circle", { cx: "14", cy: "14", r: "2.5", fill: "currentColor", stroke: "none" })] }), _jsx("div", { className: "font-mono text-[14px] tracking-[0.16em] font-bold text-ink", children: "PD" }), _jsx("div", { className: "font-mono text-[11px] tracking-[0.14em] text-ink-3 mt-1", children: "GOVERNANCE WORKSPACE" }), _jsx("div", { className: "text-[13px] text-ink-3 mt-3", children: t("pages.login.connectWorkspace") })] }), _jsx("div", { className: "border-t border-line my-5" }), children] })] }));
|
|
129
|
-
if (phase.kind === "checking" || phase.kind === "connecting") {
|
|
130
|
-
return showCard(_jsxs("div", { className: "flex flex-col items-center gap-4 py-6", "data-testid": "login-connecting", children: [_jsx("div", { className: "w-8 h-8 border-2 border-gov border-t-transparent rounded-full animate-spin" }), _jsx("span", { className: "text-[13px] text-ink-3", children: phase.kind === "checking" ? t("pages.login.detecting") : t("pages.login.connecting") })] }));
|
|
131
|
-
}
|
|
132
|
-
if (phase.kind === "recovery") {
|
|
133
|
-
return showCard(_jsxs("div", { className: "flex flex-col gap-4", "data-testid": "login-recovery", children: [_jsx("p", { className: "text-[13px] text-amber", children: t("pages.login.recoveryTitle") }), _jsx("p", { className: "text-[13px] text-ink-3 leading-relaxed", children: t("pages.login.recoveryReason") }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("button", { type: "button", onClick: retryCompanionConnect, className: "w-full py-2 px-4 bg-gov text-paper rounded-[var(--radius-sm)] text-[12.5px] font-medium hover:bg-gov-2 transition-colors focus:outline-2 focus:outline-offset-2 focus:outline-gov", children: t("pages.login.reconnect") }), _jsx("button", { type: "button", onClick: () => {
|
|
134
|
-
clearToken();
|
|
135
|
-
setTokenInput("");
|
|
136
|
-
setError(null);
|
|
137
|
-
setPhase({ kind: "form" });
|
|
138
|
-
}, className: "w-full py-2 px-4 border border-line text-ink rounded-[var(--radius-sm)] text-[12.5px] font-medium hover:border-gov transition-colors focus:outline-2 focus:outline-offset-2 focus:outline-gov", children: t("pages.login.manualEntry") })] }), _jsx("p", { className: "text-[12px] text-ink-4 leading-relaxed", children: t("pages.login.manualEntryHint") })] }));
|
|
139
|
-
}
|
|
140
|
-
const showReadError = phase.kind === "form-with-read-error";
|
|
141
|
-
return showCard(_jsxs("form", { onSubmit: handleSubmit, children: [showReadError && (_jsxs("div", { className: "mb-4 border border-amber rounded-[var(--radius-sm)] px-3 py-2", "data-testid": "login-read-error", children: [_jsx("p", { className: "text-[12.5px] font-medium text-amber", children: t("pages.login.readFailedTitle") }), _jsx("p", { className: "text-[12px] text-ink-3 mt-1 leading-relaxed", children: t("pages.login.readFailedHint") })] })), _jsx("label", { htmlFor: "access-token", className: "font-mono text-[11px] tracking-[0.08em] text-ink-3 uppercase mb-2 block", children: t("pages.login.accessToken") }), _jsx("input", { id: "access-token", type: "password", value: token, onChange: (e) => setTokenInput(e.target.value), className: "w-full px-3 py-2 bg-panel border border-line rounded-[var(--radius-sm)] font-mono text-[13px] text-ink focus:border-gov focus:outline-2 focus:outline-offset-2 focus:outline-gov transition-colors", placeholder: t("pages.login.enterAccessToken"), autoFocus: true }), error && _jsx("p", { className: "mt-2 text-[13px] text-amber", children: error }), _jsx("button", { type: "submit", disabled: !token.trim(), className: "mt-4 w-full py-2 px-4 bg-gov text-paper rounded-[var(--radius-sm)] text-[12.5px] font-medium hover:bg-gov-2 disabled:opacity-50 transition-colors focus:outline-2 focus:outline-offset-2 focus:outline-gov", children: t("pages.login.connect") })] }));
|
|
142
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Splash screen — 1-2s loading transition (C.0).
|
|
4
|
-
* Shows threshold mark + "PD" + "GOVERNANCE WORKSPACE" + progress bar.
|
|
5
|
-
* Auto-redirects after animation completes.
|
|
6
|
-
*/
|
|
7
|
-
export declare function SplashScreen({ onComplete }: {
|
|
8
|
-
onComplete: () => void;
|
|
9
|
-
}): React.JSX.Element;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
/**
|
|
4
|
-
* Splash screen — 1-2s loading transition (C.0).
|
|
5
|
-
* Shows threshold mark + "PD" + "GOVERNANCE WORKSPACE" + progress bar.
|
|
6
|
-
* Auto-redirects after animation completes.
|
|
7
|
-
*/
|
|
8
|
-
export function SplashScreen({ onComplete }) {
|
|
9
|
-
React.useEffect(() => {
|
|
10
|
-
const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
11
|
-
const timeout = prefersReducedMotion ? 100 : 2200;
|
|
12
|
-
const timer = setTimeout(onComplete, timeout);
|
|
13
|
-
return () => clearTimeout(timer);
|
|
14
|
-
}, [onComplete]);
|
|
15
|
-
return (_jsxs("div", { className: "min-h-screen flex flex-col items-center justify-center bg-paper", style: {
|
|
16
|
-
backgroundImage: `linear-gradient(color-mix(in srgb, var(--color-gov) 3.5%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--color-gov) 3.5%, transparent) 1px, transparent 1px)`,
|
|
17
|
-
backgroundSize: "32px 32px",
|
|
18
|
-
}, children: [_jsxs("svg", { viewBox: "0 0 28 28", className: "w-16 h-16 text-gov animate-[fadeIn_200ms_ease-out]", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [_jsx("path", { d: "M6 4V24M22 4V24M2 14H26", strokeLinecap: "square" }), _jsx("circle", { cx: "14", cy: "14", r: "2.5", fill: "currentColor", stroke: "none" })] }), _jsx("div", { className: "mt-6 font-mono text-[14px] tracking-[0.16em] font-bold text-ink animate-[fadeIn_500ms_ease-out_200ms_both]", children: "PD" }), _jsx("div", { className: "mt-2 font-mono text-[11px] tracking-[0.14em] text-ink-3 animate-[fadeIn_500ms_ease-out_400ms_both]", children: "GOVERNANCE WORKSPACE" }), _jsx("div", { className: "mt-8 w-48 h-1 bg-line rounded-full overflow-hidden animate-[fadeIn_500ms_ease-out_600ms_both]", children: _jsx("div", { className: "h-full bg-gov rounded-full animate-[progressFill_600ms_ease-out_1.2s_both]" }) }), _jsx("style", { children: `
|
|
19
|
-
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
20
|
-
@keyframes progressFill { from { width: 0; } to { width: 100%; } }
|
|
21
|
-
` })] }));
|
|
22
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Component, type ReactNode } from "react";
|
|
2
|
-
interface ErrorBoundaryProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
fallback?: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
interface ErrorBoundaryState {
|
|
7
|
-
hasError: boolean;
|
|
8
|
-
error: Error | null;
|
|
9
|
-
}
|
|
10
|
-
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
11
|
-
constructor(props: ErrorBoundaryProps);
|
|
12
|
-
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
13
|
-
render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Component } from "react";
|
|
3
|
-
import { useLocation, useNavigate } from "react-router-dom";
|
|
4
|
-
import i18n from "../i18n/index.js";
|
|
5
|
-
import { Card, CardContent } from "./ui/card.js";
|
|
6
|
-
import { Button } from "./ui/button.js";
|
|
7
|
-
import { AlertCircle, MessageSquare } from "lucide-react";
|
|
8
|
-
export class ErrorBoundary extends Component {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
this.state = { hasError: false, error: null };
|
|
12
|
-
}
|
|
13
|
-
static getDerivedStateFromError(error) {
|
|
14
|
-
return { hasError: true, error };
|
|
15
|
-
}
|
|
16
|
-
render() {
|
|
17
|
-
if (this.state.hasError) {
|
|
18
|
-
if (this.props.fallback)
|
|
19
|
-
return this.props.fallback;
|
|
20
|
-
return (_jsx(ErrorBoundaryCard, { error: this.state.error, onRetry: () => this.setState({ hasError: false, error: null }) }));
|
|
21
|
-
}
|
|
22
|
-
return this.props.children;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function ErrorBoundaryCard({ error, onRetry }) {
|
|
26
|
-
const navigate = useNavigate();
|
|
27
|
-
const location = useLocation();
|
|
28
|
-
const reportHref = `/report-problem?source=${encodeURIComponent("error")}&message=${encodeURIComponent(error?.message ?? "")}&from=${encodeURIComponent(location.pathname + location.search)}`;
|
|
29
|
-
return (_jsx(Card, { className: "border-destructive/50", children: _jsxs(CardContent, { className: "p-6", children: [_jsxs("div", { className: "flex items-center gap-3 mb-4", children: [_jsx(AlertCircle, { className: "h-5 w-5 text-destructive" }), _jsx("h3", { className: "font-semibold text-destructive", children: i18n.t("components:errorBoundary.title") })] }), _jsx("p", { className: "text-sm text-muted-foreground mb-4", children: error?.message ?? i18n.t("components:errorBoundary.description") }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Button, { variant: "outline", onClick: onRetry, children: i18n.t("components:errorBoundary.retry") }), _jsxs(Button, { variant: "ghost", onClick: () => navigate(reportHref), children: [_jsx(MessageSquare, { className: "h-4 w-4 mr-2" }), i18n.t("components:errorBoundary.reportAction")] })] })] }) }));
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function DailyThoughtCard(): import("react").JSX.Element | null;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useMemo, useState } from "react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { RefreshCw } from "lucide-react";
|
|
5
|
-
import { DAILY_THOUGHTS, getDailyThoughtIndex } from "../../data/daily-thoughts.js";
|
|
6
|
-
const FEATURE_DAILY_THOUGHT_ENABLED = true;
|
|
7
|
-
function formatLocalDate(d) {
|
|
8
|
-
const year = d.getFullYear();
|
|
9
|
-
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
10
|
-
const day = String(d.getDate()).padStart(2, "0");
|
|
11
|
-
return `${year}-${month}-${day}`;
|
|
12
|
-
}
|
|
13
|
-
export function DailyThoughtCard() {
|
|
14
|
-
const { t, i18n } = useTranslation();
|
|
15
|
-
const [overrideIndex, setOverrideIndex] = useState(null);
|
|
16
|
-
const [isChanging, setIsChanging] = useState(false);
|
|
17
|
-
const dailyIndex = useMemo(() => getDailyThoughtIndex(DAILY_THOUGHTS, formatLocalDate(new Date())), []);
|
|
18
|
-
const currentIndex = overrideIndex ?? dailyIndex;
|
|
19
|
-
const thought = DAILY_THOUGHTS[currentIndex] ?? DAILY_THOUGHTS[0];
|
|
20
|
-
const locale = i18n.language === "zh-CN" ? "zh" : "en";
|
|
21
|
-
const content = thought?.[locale];
|
|
22
|
-
const handleNext = useCallback(() => {
|
|
23
|
-
if (isChanging)
|
|
24
|
-
return;
|
|
25
|
-
setIsChanging(true);
|
|
26
|
-
window.setTimeout(() => {
|
|
27
|
-
setOverrideIndex((prev) => {
|
|
28
|
-
const base = prev ?? dailyIndex;
|
|
29
|
-
return (base + 1) % DAILY_THOUGHTS.length;
|
|
30
|
-
});
|
|
31
|
-
setIsChanging(false);
|
|
32
|
-
}, 200);
|
|
33
|
-
}, [isChanging, dailyIndex]);
|
|
34
|
-
if (!FEATURE_DAILY_THOUGHT_ENABLED) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
if (!thought || !content) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
return (_jsxs("article", { "aria-label": t("pages.focus.dailyThought.ariaLabel"), className: "daily-thought-entrance bg-panel border border-line rounded-[6px] px-[18px] py-[14px] mb-7", children: [_jsxs("div", { className: "flex items-center justify-between mb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "breathing-dot", "aria-hidden": "true" }), _jsx("span", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4", children: t("pages.focus.dailyThought.eyebrow") })] }), _jsxs("button", { type: "button", onClick: handleNext, disabled: isChanging, "aria-label": t("pages.focus.dailyThought.nextAriaLabel"), className: "inline-flex items-center gap-1.5 text-[12px] text-gov hover:text-gov-2 transition-colors disabled:opacity-50", children: [_jsx(RefreshCw, { className: "h-3 w-3", "aria-hidden": "true" }), t("pages.focus.dailyThought.next")] })] }), _jsxs("div", { className: `transition-opacity duration-200 ${isChanging ? "opacity-0" : "opacity-100"}`, children: [_jsx("p", { className: "font-semibold text-ink text-[15px] leading-snug", children: content.quote }), _jsxs("p", { className: "mt-1 text-ink-3 text-[13px]", children: [t("pages.focus.dailyThought.authorPrefix", { defaultValue: "——" }), content.author] }), _jsx("p", { className: "mt-3 text-ink-3 text-[13px] leading-relaxed", children: content.note })] })] }));
|
|
41
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { Button } from "./ui/button.js";
|
|
4
|
-
const LANGUAGES = [
|
|
5
|
-
{ code: "zh-CN", label: "中文", englishLabel: "Chinese" },
|
|
6
|
-
{ code: "en", label: "English", englishLabel: "English" },
|
|
7
|
-
];
|
|
8
|
-
export function LanguageSwitcher() {
|
|
9
|
-
const { i18n } = useTranslation();
|
|
10
|
-
const currentLang = LANGUAGES.find((lang) => lang.code === i18n.language);
|
|
11
|
-
const toggleLanguage = () => {
|
|
12
|
-
const nextLang = i18n.language === "zh-CN" ? "en" : "zh-CN";
|
|
13
|
-
i18n.changeLanguage(nextLang);
|
|
14
|
-
localStorage.setItem("pd-language", nextLang);
|
|
15
|
-
};
|
|
16
|
-
return (_jsx(Button, { variant: "ghost", size: "sm", onClick: toggleLanguage, className: "min-w-[70px]", children: currentLang?.label }));
|
|
17
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* The Examiner is a shipped product surface: the offline research panel ships
|
|
4
|
-
* with the console payload, so the navigation entry is build-mode independent.
|
|
5
|
-
*/
|
|
6
|
-
export declare function visibleMainNavItems(): {
|
|
7
|
-
id: string;
|
|
8
|
-
labelKey: string;
|
|
9
|
-
href: string;
|
|
10
|
-
icon: React.ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
11
|
-
}[];
|
|
12
|
-
export declare function AppSidebar({ featureFlags }: {
|
|
13
|
-
featureFlags?: Record<string, {
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
}>;
|
|
16
|
-
}): React.JSX.Element;
|
|
17
|
-
/**
|
|
18
|
-
* Narrow-screen shell replacement for the fixed 256px sidebar (R3): a top bar
|
|
19
|
-
* with a 44px menu button opening a left Sheet drawer. Radix Dialog provides
|
|
20
|
-
* focus trapping, Esc-to-close and focus return to the trigger; selecting a
|
|
21
|
-
* route closes the drawer. Desktop keeps the fixed sidebar (lg and up).
|
|
22
|
-
*/
|
|
23
|
-
export declare function MobileNav({ featureFlags }: {
|
|
24
|
-
featureFlags?: Record<string, {
|
|
25
|
-
enabled: boolean;
|
|
26
|
-
}>;
|
|
27
|
-
}): React.JSX.Element;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { Link, useLocation, useNavigate } from "react-router-dom";
|
|
4
|
-
import { Sun, Moon, Focus, AlertTriangle, AlertCircle, BookOpen, Zap, Archive, Compass, FlaskConical, Settings, MessageSquare, RefreshCw, LogOut, Languages, Menu, } from "lucide-react";
|
|
5
|
-
import { useTheme } from "../theme-provider.js";
|
|
6
|
-
import { useTranslation } from "react-i18next";
|
|
7
|
-
import { useNotifications } from "../notifications/useNotifications.js";
|
|
8
|
-
import { clearToken } from "../../api.js";
|
|
9
|
-
import { cn } from "../../../lib/utils.js";
|
|
10
|
-
import { Sheet, SheetContent, SheetDescription, SheetTitle, SheetTrigger } from "../ui/sheet.js";
|
|
11
|
-
function ThresholdMark({ className }) {
|
|
12
|
-
return (_jsxs("svg", { viewBox: "0 0 28 28", className: className, fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: [_jsx("path", { d: "M6 4V24M22 4V24M2 14H26", strokeLinecap: "square" }), _jsx("circle", { cx: "14", cy: "14", r: "2.5", fill: "currentColor", stroke: "none" })] }));
|
|
13
|
-
}
|
|
14
|
-
const mainNavItems = [
|
|
15
|
-
{ id: "focus", labelKey: "components.sidebar.focus", href: "/focus", icon: Focus },
|
|
16
|
-
{ id: "pain", labelKey: "components.sidebar.pain", href: "/pain", icon: AlertTriangle },
|
|
17
|
-
{ id: "principles", labelKey: "components.sidebar.principles", href: "/principles", icon: BookOpen },
|
|
18
|
-
{ id: "activation", labelKey: "components.sidebar.activation", href: "/activation", icon: Zap },
|
|
19
|
-
{ id: "debt", labelKey: "components.sidebar.debt", href: "/debt", icon: Archive },
|
|
20
|
-
{ id: "examiner", labelKey: "components.sidebar.examiner", href: "/examiner", icon: FlaskConical },
|
|
21
|
-
{ id: "intent", labelKey: "components.sidebar.intent", href: "/intent", icon: Compass },
|
|
22
|
-
];
|
|
23
|
-
/**
|
|
24
|
-
* The Examiner is a shipped product surface: the offline research panel ships
|
|
25
|
-
* with the console payload, so the navigation entry is build-mode independent.
|
|
26
|
-
*/
|
|
27
|
-
export function visibleMainNavItems() {
|
|
28
|
-
return mainNavItems;
|
|
29
|
-
}
|
|
30
|
-
const toolNavItems = [
|
|
31
|
-
{ id: "control-center", labelKey: "components.sidebar.controlCenter", href: "/control-center", icon: Settings },
|
|
32
|
-
{ id: "report-problem", labelKey: "components.sidebar.reportProblem", href: "/report-problem", icon: MessageSquare },
|
|
33
|
-
{ id: "failed-tasks", labelKey: "components.sidebar.failedTasks", href: "/failed-tasks", icon: AlertCircle },
|
|
34
|
-
{ id: "settings", labelKey: "components.sidebar.settings", href: "/settings", icon: Settings },
|
|
35
|
-
{ id: "update", labelKey: "components.sidebar.update", href: "/update", icon: RefreshCw },
|
|
36
|
-
];
|
|
37
|
-
/**
|
|
38
|
-
* Shared sidebar body — rendered by the desktop aside and by the narrow-screen
|
|
39
|
-
* drawer (SPEC-PD-UIUX-001 R3). Display-only: navigation targets and flags are
|
|
40
|
-
* unchanged; `onNavigate` lets the drawer close after a selection.
|
|
41
|
-
*/
|
|
42
|
-
function SidebarContent({ featureFlags, onNavigate, touchTargets, }) {
|
|
43
|
-
const location = useLocation();
|
|
44
|
-
const navigate = useNavigate();
|
|
45
|
-
const { theme, setTheme } = useTheme();
|
|
46
|
-
const { t, i18n } = useTranslation();
|
|
47
|
-
const { pendingCount, degradedCount } = useNotifications();
|
|
48
|
-
const isActive = (href) => {
|
|
49
|
-
if (href === "/")
|
|
50
|
-
return location.pathname === "/";
|
|
51
|
-
return location.pathname === href || location.pathname.startsWith(href + "/");
|
|
52
|
-
};
|
|
53
|
-
const handleSignOut = () => {
|
|
54
|
-
clearToken();
|
|
55
|
-
navigate("/login");
|
|
56
|
-
};
|
|
57
|
-
const toggleLanguage = () => {
|
|
58
|
-
const nextLang = i18n.language === "zh-CN" ? "en" : "zh-CN";
|
|
59
|
-
i18n.changeLanguage(nextLang);
|
|
60
|
-
localStorage.setItem("pd-language", nextLang);
|
|
61
|
-
};
|
|
62
|
-
return (_jsxs(_Fragment, { children: [_jsxs("nav", { className: "flex-1 py-2 overflow-y-auto", "aria-label": t("components.sidebar.navigation", { defaultValue: "主导航" }), children: [_jsx("div", { className: "px-2", children: visibleMainNavItems().map((item) => {
|
|
63
|
-
const Icon = item.icon;
|
|
64
|
-
const active = isActive(item.href);
|
|
65
|
-
return (_jsxs(Link, { to: item.href, "data-testid": `nav-${item.id}`, "aria-current": active ? "page" : undefined, onClick: onNavigate, className: cn("flex items-center gap-3 px-3 rounded-[var(--radius-sm)] text-[13px] transition-all duration-150", touchTargets ? "min-h-[44px] py-2" : "py-2", active
|
|
66
|
-
? "border-l-2 border-l-gov bg-paper-2 text-ink"
|
|
67
|
-
: "border-l-2 border-l-transparent text-ink-3 hover:text-ink hover:bg-paper-2"), children: [_jsx(Icon, { className: "h-4 w-4 flex-shrink-0", "aria-hidden": "true" }), _jsx("span", { className: "flex-1", children: t(item.labelKey) }), item.id === "focus" && pendingCount > 0 ? (_jsx("span", { className: "ml-auto h-2 w-2 rotate-45 rounded-[1px] border border-rose-400/50 bg-rose-400/15 shadow-[0_0_3px_rgba(251,113,133,0.35)]", role: "status", "aria-label": t("components.sidebar.pendingApprovalsAria", { count: pendingCount }) })) : null] }, item.id));
|
|
68
|
-
}) }), _jsxs("div", { className: "mt-4 pt-3 border-t border-line mx-4", children: [_jsx("div", { className: "px-1 pb-1 text-[10px] font-mono tracking-[0.1em] uppercase text-ink-4", children: "Tools" }), _jsx("div", { className: "px-0", children: toolNavItems.map((item) => {
|
|
69
|
-
// Feature-flag gate: failed-tasks entry only shows when
|
|
70
|
-
// failed_tasks_observability is enabled. When featureFlags is
|
|
71
|
-
// undefined (still loading) or the flag is missing, hide the
|
|
72
|
-
// entry to avoid surfacing a page the backend will 403.
|
|
73
|
-
if (item.id === "failed-tasks" && featureFlags?.failed_tasks_observability?.enabled !== true) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
const Icon = item.icon;
|
|
77
|
-
const active = isActive(item.href);
|
|
78
|
-
return (_jsxs(Link, { to: item.href, "data-testid": `nav-${item.id}`, "aria-current": active ? "page" : undefined, onClick: onNavigate, className: cn("flex items-center gap-3 px-3 rounded-[var(--radius-sm)] text-[12px] transition-all duration-150", touchTargets ? "min-h-[44px] py-2" : "py-1.5", active
|
|
79
|
-
? "border-l-2 border-l-gov bg-paper-2 text-ink"
|
|
80
|
-
: "border-l-2 border-l-transparent text-ink-4 hover:text-ink-3 hover:bg-paper-2"), children: [_jsx(Icon, { className: "h-3.5 w-3.5 flex-shrink-0", "aria-hidden": "true" }), _jsx("span", { className: "flex-1", children: t(item.labelKey) }), item.id === "control-center" && degradedCount > 0 ? (_jsx("span", { className: "ml-auto h-[7px] w-[7px] rotate-45 rounded-[1px] border border-amber-400/50 bg-amber-400/15 shadow-[0_0_3px_rgba(251,191,36,0.35)]", role: "status", "aria-label": t("components.sidebar.degradedSignalsAria", { count: degradedCount }) })) : null] }, item.id));
|
|
81
|
-
}) })] })] }), _jsxs("div", { className: "px-3 py-3 border-t border-line space-y-1", children: [_jsxs("button", { type: "button", onClick: () => setTheme(theme === "dark" ? "light" : "dark"), className: cn("flex items-center gap-3 px-3 rounded-[var(--radius-sm)] text-[12px] text-ink-4 hover:text-ink-3 hover:bg-paper-2 transition-colors w-full", touchTargets ? "min-h-[44px] py-2" : "py-1.5"), title: theme === "dark" ? t("components.sidebar.themeToLight") : t("components.sidebar.themeToDark"), children: [theme === "dark" ? (_jsx(Sun, { className: "h-3.5 w-3.5 flex-shrink-0", "aria-hidden": "true" })) : (_jsx(Moon, { className: "h-3.5 w-3.5 flex-shrink-0", "aria-hidden": "true" })), _jsx("span", { children: theme === "dark" ? t("components.sidebar.themeToLight") : t("components.sidebar.themeToDark") })] }), _jsxs("button", { type: "button", onClick: toggleLanguage, className: cn("flex items-center gap-3 px-3 rounded-[var(--radius-sm)] text-[12px] text-ink-4 hover:text-ink-3 hover:bg-paper-2 transition-colors w-full", touchTargets ? "min-h-[44px] py-2" : "py-1.5"), title: t("components.sidebar.switchLanguage"), children: [_jsx(Languages, { className: "h-3.5 w-3.5 flex-shrink-0", "aria-hidden": "true" }), _jsx("span", { children: i18n.language === "zh-CN" ? "English" : "中文" })] }), _jsxs("button", { type: "button", onClick: handleSignOut, className: cn("flex items-center gap-3 px-3 rounded-[var(--radius-sm)] text-[12px] text-ink-4 hover:text-ink-3 hover:bg-paper-2 transition-colors w-full", touchTargets ? "min-h-[44px] py-2" : "py-1.5"), children: [_jsx(LogOut, { className: "h-3.5 w-3.5 flex-shrink-0", "aria-hidden": "true" }), _jsx("span", { children: t("components.sidebar.signOut") })] })] })] }));
|
|
82
|
-
}
|
|
83
|
-
export function AppSidebar({ featureFlags }) {
|
|
84
|
-
return (_jsxs("aside", { className: "w-[256px] h-screen fixed left-0 top-0 hidden lg:flex flex-col bg-surface border-r border-line flex-shrink-0 z-20", children: [_jsx("div", { className: "px-5 pt-5 pb-4", children: _jsxs("div", { className: "flex items-center gap-2.5", children: [_jsx(ThresholdMark, { className: "w-6 h-6 text-gov" }), _jsxs("div", { children: [_jsx("div", { className: "font-mono text-[14px] tracking-[0.16em] font-bold text-ink", children: "PD" }), _jsx("div", { className: "font-mono text-[10px] tracking-[0.14em] text-ink-3", children: "GOVERNANCE WORKSPACE" })] })] }) }), _jsx(SidebarContent, { featureFlags: featureFlags })] }));
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Narrow-screen shell replacement for the fixed 256px sidebar (R3): a top bar
|
|
88
|
-
* with a 44px menu button opening a left Sheet drawer. Radix Dialog provides
|
|
89
|
-
* focus trapping, Esc-to-close and focus return to the trigger; selecting a
|
|
90
|
-
* route closes the drawer. Desktop keeps the fixed sidebar (lg and up).
|
|
91
|
-
*/
|
|
92
|
-
export function MobileNav({ featureFlags }) {
|
|
93
|
-
const { t } = useTranslation();
|
|
94
|
-
const [open, setOpen] = React.useState(false);
|
|
95
|
-
const location = useLocation();
|
|
96
|
-
// Route changes (e.g. browser back/forward) close the drawer so the main
|
|
97
|
-
// content is never left behind a stale overlay.
|
|
98
|
-
React.useEffect(() => {
|
|
99
|
-
setOpen(false);
|
|
100
|
-
}, [location.pathname]);
|
|
101
|
-
// SPEC-PD-UIUX-001 R3 (Owner review Q2): the Sheet portals to <body>, so
|
|
102
|
-
// growing a 390px window to desktop left the overlay + focus trap alive over
|
|
103
|
-
// the now-visible fixed sidebar. Crossing INTO the desktop breakpoint closes
|
|
104
|
-
// the drawer; where focus lands is decided in onCloseAutoFocus below (the
|
|
105
|
-
// hidden trigger cannot receive it on desktop).
|
|
106
|
-
React.useEffect(() => {
|
|
107
|
-
const desktop = window.matchMedia("(min-width: 1024px)");
|
|
108
|
-
const onChange = (event) => {
|
|
109
|
-
if (event.matches && open) {
|
|
110
|
-
setOpen(false);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
desktop.addEventListener("change", onChange);
|
|
114
|
-
return () => desktop.removeEventListener("change", onChange);
|
|
115
|
-
}, [open]);
|
|
116
|
-
return (_jsxs("header", { className: "lg:hidden fixed top-0 left-0 right-0 z-30 h-14 flex items-center gap-2 px-3 bg-surface border-b border-line", children: [_jsxs(Sheet, { open: open, onOpenChange: setOpen, children: [_jsx(SheetTrigger, { asChild: true, children: _jsx("button", { type: "button", "data-testid": "mobile-nav-trigger", "aria-label": t("components.sidebar.openMenu"), className: "inline-flex items-center justify-center h-11 w-11 rounded-[var(--radius-sm)] text-ink-3 hover:text-ink hover:bg-paper-2 transition-colors", children: _jsx(Menu, { className: "h-5 w-5", "aria-hidden": "true" }) }) }), _jsxs(SheetContent, { side: "left", className: "w-[280px] max-w-[85vw] p-0 border-r border-line bg-surface flex flex-col", "data-testid": "mobile-nav-drawer", onCloseAutoFocus: (event) => {
|
|
117
|
-
// On desktop the trigger is display:none and cannot take focus
|
|
118
|
-
// back (review Q2): hand focus to the main content instead. On
|
|
119
|
-
// mobile keep Radix's default return-to-trigger behavior.
|
|
120
|
-
if (window.matchMedia("(min-width: 1024px)").matches) {
|
|
121
|
-
event.preventDefault();
|
|
122
|
-
const main = document.getElementById("main-content");
|
|
123
|
-
if (main instanceof HTMLElement) {
|
|
124
|
-
main.focus({ preventScroll: true });
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}, children: [_jsx(SheetTitle, { className: "sr-only", children: t("components.sidebar.navigation") }), _jsx(SheetDescription, { className: "sr-only", children: t("components.sidebar.navigationDescription") }), _jsx("div", { className: "px-5 pt-5 pb-4 border-b border-line", children: _jsxs("div", { className: "flex items-center gap-2.5", children: [_jsx(ThresholdMark, { className: "w-6 h-6 text-gov" }), _jsxs("div", { children: [_jsx("div", { className: "font-mono text-[14px] tracking-[0.16em] font-bold text-ink", children: "PD" }), _jsx("div", { className: "font-mono text-[10px] tracking-[0.14em] text-ink-3", children: "GOVERNANCE WORKSPACE" })] })] }) }), _jsx(SidebarContent, { featureFlags: featureFlags, onNavigate: () => setOpen(false), touchTargets: true })] })] }), _jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [_jsx(ThresholdMark, { className: "w-5 h-5 text-gov flex-shrink-0" }), _jsx("span", { className: "font-mono text-[12px] tracking-[0.12em] font-bold text-ink truncate", children: "PD" })] })] }));
|
|
128
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reusable loading skeleton for full-page loading states.
|
|
3
|
-
* Shows a title skeleton + N card skeletons with a subtle fade-in.
|
|
4
|
-
* Replaces plain "Loading…" text across all pages for consistent perceived performance.
|
|
5
|
-
*
|
|
6
|
-
* Accessibility: the root container is a live region (role="status" aria-live="polite")
|
|
7
|
-
* with a localized aria-label, so screen readers announce the loading state.
|
|
8
|
-
* Callers MUST pass a localized `label` (e.g. t("common.loading")).
|
|
9
|
-
*/
|
|
10
|
-
export declare function PageLoading({ cardCount, label, }: {
|
|
11
|
-
cardCount?: number;
|
|
12
|
-
label: string;
|
|
13
|
-
}): import("react").JSX.Element;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Skeleton } from "../ui/skeleton.js";
|
|
3
|
-
/**
|
|
4
|
-
* Reusable loading skeleton for full-page loading states.
|
|
5
|
-
* Shows a title skeleton + N card skeletons with a subtle fade-in.
|
|
6
|
-
* Replaces plain "Loading…" text across all pages for consistent perceived performance.
|
|
7
|
-
*
|
|
8
|
-
* Accessibility: the root container is a live region (role="status" aria-live="polite")
|
|
9
|
-
* with a localized aria-label, so screen readers announce the loading state.
|
|
10
|
-
* Callers MUST pass a localized `label` (e.g. t("common.loading")).
|
|
11
|
-
*/
|
|
12
|
-
export function PageLoading({ cardCount = 3, label, }) {
|
|
13
|
-
return (_jsxs("div", { className: "animate-[pdFadeIn_200ms_ease-out]", role: "status", "aria-live": "polite", "aria-label": label, children: [_jsx(Skeleton, { className: "h-8 w-[60%] rounded-[4px] mb-3" }), _jsx(Skeleton, { className: "h-4 w-[80%] rounded-sm mb-2" }), _jsx(Skeleton, { className: "h-4 w-[50%] rounded-sm mb-8" }), _jsx("div", { className: "space-y-4", children: Array.from({ length: cardCount }).map((_, i) => (_jsxs("div", { className: "bg-panel border border-line rounded-[var(--radius-md)] p-4", children: [_jsxs("div", { className: "flex items-center gap-2 mb-3", children: [_jsx(Skeleton, { className: "h-5 w-20 rounded-[2px]" }), _jsx(Skeleton, { className: "h-5 w-16 rounded-[2px]" })] }), _jsx(Skeleton, { className: "h-4 w-full rounded-sm mb-2" }), _jsx(Skeleton, { className: "h-4 w-[75%] rounded-sm mb-4" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton, { className: "h-3.5 w-24 rounded-sm" }), _jsx(Skeleton, { className: "h-3.5 w-20 rounded-sm" })] })] }, i))) })] }));
|
|
14
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
interface PageShellProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* 712px centered container — the "slow thinking" physical layout.
|
|
7
|
-
* Blueprint grid background is on body (globals.css), this adds
|
|
8
|
-
* the centered content column with generous whitespace.
|
|
9
|
-
* Includes a subtle fade-in on mount for page transitions.
|
|
10
|
-
*/
|
|
11
|
-
export declare function PageShell({ children, className, ...props }: PageShellProps): React.JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "../../../lib/utils.js";
|
|
3
|
-
/**
|
|
4
|
-
* 712px centered container — the "slow thinking" physical layout.
|
|
5
|
-
* Blueprint grid background is on body (globals.css), this adds
|
|
6
|
-
* the centered content column with generous whitespace.
|
|
7
|
-
* Includes a subtle fade-in on mount for page transitions.
|
|
8
|
-
*/
|
|
9
|
-
export function PageShell({ children, className, ...props }) {
|
|
10
|
-
return (_jsx("div", { className: cn("mx-auto max-w-[712px] px-6 py-8 animate-[pdFadeIn_200ms_ease-out]", className), ...props, children: children }));
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
interface SectionTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* 11px uppercase monospace section title with bottom border (B.4.6).
|
|
7
|
-
* Used for governance page section headings.
|
|
8
|
-
*/
|
|
9
|
-
export declare function SectionTitle({ children, className, ...props }: SectionTitleProps): React.JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "../../../lib/utils.js";
|
|
3
|
-
/**
|
|
4
|
-
* 11px uppercase monospace section title with bottom border (B.4.6).
|
|
5
|
-
* Used for governance page section headings.
|
|
6
|
-
*/
|
|
7
|
-
export function SectionTitle({ children, className, ...props }) {
|
|
8
|
-
return (_jsx("h2", { className: cn("font-mono text-[11px] uppercase tracking-[var(--tracking-wide)] text-ink-3", "border-b border-line pb-2 mb-4", className), ...props, children: children }));
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
export type NotificationState = {
|
|
3
|
-
pendingCount: number;
|
|
4
|
-
degradedCount: number;
|
|
5
|
-
soundEnabled: boolean;
|
|
6
|
-
};
|
|
7
|
-
export type NotificationContextValue = NotificationState & {
|
|
8
|
-
setSoundEnabled: (enabled: boolean) => void;
|
|
9
|
-
audioUnlocked: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare const NotificationContext: import("react").Context<NotificationContextValue | null>;
|
|
12
|
-
export declare function NotificationProvider({ children }: {
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
}): import("react").JSX.Element;
|