From 0bc296a8ee2f592b159548e21d561a21178d6286 Mon Sep 17 00:00:00 2001 From: TalexDreamSoul Date: Fri, 3 Jul 2026 02:04:52 -0700 Subject: [PATCH] feat: wire health workspace pages --- .../app/[organizationSlug]/alerts/page.tsx | 4 +- .../app/[organizationSlug]/devices/page.tsx | 4 +- .../app/[organizationSlug]/family/page.tsx | 4 +- .../app/[organizationSlug]/health/page.tsx | 6 +-- .../app/[organizationSlug]/notices/page.tsx | 4 +- app/(app)/app/alerts/page.tsx | 14 +---- app/(app)/app/dashboard/page.tsx | 2 +- app/(app)/app/devices/page.tsx | 14 +---- app/(app)/app/family/page.tsx | 14 +---- app/(app)/app/health/page.tsx | 16 ++---- app/(app)/app/notices/page.tsx | 14 +---- app/(app)/app/settings/health/page.tsx | 26 +--------- .../health/components/HealthAdminClient.tsx | 2 +- .../health/components/HealthWorkspacePage.tsx | 44 ++++++++++++++++ .../shared/components/ReservedModulePages.tsx | 51 +++++++++++++++++++ modules/shared/lib/navigation.ts | 2 +- next.config.ts | 3 ++ 17 files changed, 125 insertions(+), 99 deletions(-) create mode 100644 modules/health/components/HealthWorkspacePage.tsx create mode 100644 modules/shared/components/ReservedModulePages.tsx diff --git a/app/(app)/app/[organizationSlug]/alerts/page.tsx b/app/(app)/app/[organizationSlug]/alerts/page.tsx index 491e6a7..53b3915 100644 --- a/app/(app)/app/[organizationSlug]/alerts/page.tsx +++ b/app/(app)/app/[organizationSlug]/alerts/page.tsx @@ -1,5 +1,5 @@ -import AlertsPage from "../../alerts/page"; +import { AlertsModulePage } from "@/modules/shared/components/ReservedModulePages"; export default function ScopedAlertsPage(): React.ReactElement { - return AlertsPage(); + return ; } diff --git a/app/(app)/app/[organizationSlug]/devices/page.tsx b/app/(app)/app/[organizationSlug]/devices/page.tsx index a24b9d2..dda3413 100644 --- a/app/(app)/app/[organizationSlug]/devices/page.tsx +++ b/app/(app)/app/[organizationSlug]/devices/page.tsx @@ -1,5 +1,5 @@ -import DevicesPage from "../../devices/page"; +import { DevicesModulePage } from "@/modules/shared/components/ReservedModulePages"; export default function ScopedDevicesPage(): React.ReactElement { - return DevicesPage(); + return ; } diff --git a/app/(app)/app/[organizationSlug]/family/page.tsx b/app/(app)/app/[organizationSlug]/family/page.tsx index 309dbd1..ef33028 100644 --- a/app/(app)/app/[organizationSlug]/family/page.tsx +++ b/app/(app)/app/[organizationSlug]/family/page.tsx @@ -1,5 +1,5 @@ -import FamilyPage from "../../family/page"; +import { FamilyModulePage } from "@/modules/shared/components/ReservedModulePages"; export default function ScopedFamilyPage(): React.ReactElement { - return FamilyPage(); + return ; } diff --git a/app/(app)/app/[organizationSlug]/health/page.tsx b/app/(app)/app/[organizationSlug]/health/page.tsx index 8f3e8d3..c4042f4 100644 --- a/app/(app)/app/[organizationSlug]/health/page.tsx +++ b/app/(app)/app/[organizationSlug]/health/page.tsx @@ -1,5 +1,5 @@ -import HealthPage from "../../health/page"; +import { renderHealthWorkspacePage } from "@/modules/health/components/HealthWorkspacePage"; -export default function ScopedHealthPage(): React.ReactElement { - return HealthPage(); +export default async function ScopedHealthPage(): Promise { + return renderHealthWorkspacePage(); } diff --git a/app/(app)/app/[organizationSlug]/notices/page.tsx b/app/(app)/app/[organizationSlug]/notices/page.tsx index 59386eb..655e5bc 100644 --- a/app/(app)/app/[organizationSlug]/notices/page.tsx +++ b/app/(app)/app/[organizationSlug]/notices/page.tsx @@ -1,5 +1,5 @@ -import NoticesPage from "../../notices/page"; +import { NoticesModulePage } from "@/modules/shared/components/ReservedModulePages"; export default function ScopedNoticesPage(): React.ReactElement { - return NoticesPage(); + return ; } diff --git a/app/(app)/app/alerts/page.tsx b/app/(app)/app/alerts/page.tsx index 972057c..be4c71f 100644 --- a/app/(app)/app/alerts/page.tsx +++ b/app/(app)/app/alerts/page.tsx @@ -1,15 +1,5 @@ -import { Radio } from "lucide-react"; - -import { ModulePage } from "@/modules/shared/components/ModulePage"; +import { AlertsModulePage } from "@/modules/shared/components/ReservedModulePages"; export default function AlertsPage(): React.ReactElement { - return ( - - ); + return ; } diff --git a/app/(app)/app/dashboard/page.tsx b/app/(app)/app/dashboard/page.tsx index d2261ee..7ddcb04 100644 --- a/app/(app)/app/dashboard/page.tsx +++ b/app/(app)/app/dashboard/page.tsx @@ -132,7 +132,7 @@ export default async function DashboardPage(): Promise { careTasks={careTasks} emergencyHref={getWorkspaceHref(context.organization?.slug, "/emergency")} emergencyIncidents={emergencyIncidents} - healthHref={getWorkspaceHref(context.organization?.slug, "/settings/health")} + healthHref={getWorkspaceHref(context.organization?.slug, "/health")} healthReviews={healthReviews} incidents={visibleIncidents} metrics={metrics} diff --git a/app/(app)/app/devices/page.tsx b/app/(app)/app/devices/page.tsx index 3a7faa3..d5f1cf3 100644 --- a/app/(app)/app/devices/page.tsx +++ b/app/(app)/app/devices/page.tsx @@ -1,15 +1,5 @@ -import { Wrench } from "lucide-react"; - -import { ModulePage } from "@/modules/shared/components/ModulePage"; +import { DevicesModulePage } from "@/modules/shared/components/ReservedModulePages"; export default function DevicesPage(): React.ReactElement { - return ( - - ); + return ; } diff --git a/app/(app)/app/family/page.tsx b/app/(app)/app/family/page.tsx index d6d2389..bdf4ec9 100644 --- a/app/(app)/app/family/page.tsx +++ b/app/(app)/app/family/page.tsx @@ -1,15 +1,5 @@ -import { TabletSmartphone } from "lucide-react"; - -import { ModulePage } from "@/modules/shared/components/ModulePage"; +import { FamilyModulePage } from "@/modules/shared/components/ReservedModulePages"; export default function FamilyPage(): React.ReactElement { - return ( - - ); + return ; } diff --git a/app/(app)/app/health/page.tsx b/app/(app)/app/health/page.tsx index 3659057..51faae5 100644 --- a/app/(app)/app/health/page.tsx +++ b/app/(app)/app/health/page.tsx @@ -1,15 +1,5 @@ -import { HeartPulse } from "lucide-react"; +import { renderHealthWorkspacePage } from "@/modules/health/components/HealthWorkspacePage"; -import { ModulePage } from "@/modules/shared/components/ModulePage"; - -export default function HealthPage(): React.ReactElement { - return ( - - ); +export default async function HealthPage(): Promise { + return renderHealthWorkspacePage(); } diff --git a/app/(app)/app/notices/page.tsx b/app/(app)/app/notices/page.tsx index 1603c5f..1124480 100644 --- a/app/(app)/app/notices/page.tsx +++ b/app/(app)/app/notices/page.tsx @@ -1,15 +1,5 @@ -import { Bell } from "lucide-react"; - -import { ModulePage } from "@/modules/shared/components/ModulePage"; +import { NoticesModulePage } from "@/modules/shared/components/ReservedModulePages"; export default function NoticesPage(): React.ReactElement { - return ( - - ); + return ; } diff --git a/app/(app)/app/settings/health/page.tsx b/app/(app)/app/settings/health/page.tsx index 4264136..ee05389 100644 --- a/app/(app)/app/settings/health/page.tsx +++ b/app/(app)/app/settings/health/page.tsx @@ -1,27 +1,5 @@ -import { redirect } from "next/navigation"; - -import { getCurrentAuthContext } from "@/modules/core/server/auth"; -import { hasPermission } from "@/modules/core/server/permissions"; -import { listHealthAdminData } from "@/modules/health/server/operations"; -import { HealthAdminClient } from "@/modules/health/components/HealthAdminClient"; -import { getWorkspaceHref } from "@/modules/shared/lib/workspace-routing"; +import { renderHealthWorkspacePage } from "@/modules/health/components/HealthWorkspacePage"; export default async function HealthSettingsPage(): Promise { - const context = await getCurrentAuthContext(); - if (!context) { - redirect("/login"); - } - - if (!hasPermission(context.permissions, "health:read")) { - redirect(getWorkspaceHref(context.organization?.slug, "/dashboard")); - } - - const organizationId = context.organization?.id; - if (!organizationId) { - redirect(getWorkspaceHref(context.organization?.slug, "/dashboard")); - } - - const data = await listHealthAdminData(organizationId); - - return ; + return renderHealthWorkspacePage(); } diff --git a/modules/health/components/HealthAdminClient.tsx b/modules/health/components/HealthAdminClient.tsx index 12d2ab6..1d0e0b0 100644 --- a/modules/health/components/HealthAdminClient.tsx +++ b/modules/health/components/HealthAdminClient.tsx @@ -368,7 +368,7 @@ export function HealthAdminClient({ canManage, initialData }: HealthAdminClientP } return ( -
+
diff --git a/modules/health/components/HealthWorkspacePage.tsx b/modules/health/components/HealthWorkspacePage.tsx new file mode 100644 index 0000000..95b5da2 --- /dev/null +++ b/modules/health/components/HealthWorkspacePage.tsx @@ -0,0 +1,44 @@ +import { redirect } from "next/navigation"; +import { HeartPulse } from "lucide-react"; + +import { getCurrentAuthContext } from "@/modules/core/server/auth"; +import { hasPermission } from "@/modules/core/server/permissions"; +import { HealthAdminClient } from "@/modules/health/components/HealthAdminClient"; +import { listHealthAdminData } from "@/modules/health/server/operations"; +import { getWorkspaceHref } from "@/modules/shared/lib/workspace-routing"; + +export async function renderHealthWorkspacePage(): Promise { + const context = await getCurrentAuthContext(); + if (!context) { + redirect("/login"); + } + + if (!hasPermission(context.permissions, "health:read")) { + redirect(getWorkspaceHref(context.organization?.slug, "/dashboard")); + } + + const organizationId = context.organization?.id; + if (!organizationId) { + redirect(getWorkspaceHref(context.organization?.slug, "/dashboard")); + } + + const data = await listHealthAdminData(organizationId); + + return ( +
+
+
+ + +
+

健康照护

+

健康档案、生命体征、慢病管理与异常复核

+
+
+
+ + +
+ ); +} diff --git a/modules/shared/components/ReservedModulePages.tsx b/modules/shared/components/ReservedModulePages.tsx new file mode 100644 index 0000000..e67e9c4 --- /dev/null +++ b/modules/shared/components/ReservedModulePages.tsx @@ -0,0 +1,51 @@ +import { Bell, Radio, TabletSmartphone, Wrench } from "lucide-react"; + +import { ModulePage } from "@/modules/shared/components/ModulePage"; + +export function DevicesModulePage(): React.ReactElement { + return ( + + ); +} + +export function FamilyModulePage(): React.ReactElement { + return ( + + ); +} + +export function NoticesModulePage(): React.ReactElement { + return ( + + ); +} + +export function AlertsModulePage(): React.ReactElement { + return ( + + ); +} diff --git a/modules/shared/lib/navigation.ts b/modules/shared/lib/navigation.ts index 3199632..560d066 100644 --- a/modules/shared/lib/navigation.ts +++ b/modules/shared/lib/navigation.ts @@ -55,7 +55,7 @@ export const navGroups: NavGroup[] = [ path: "/health", label: "健康照护", icon: "health", - permission: "elder:read", + permission: "health:read", }, { path: "/care", diff --git a/next.config.ts b/next.config.ts index eae877e..13727bc 100644 --- a/next.config.ts +++ b/next.config.ts @@ -2,6 +2,9 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { outputFileTracingRoot: process.cwd(), + experimental: { + devtoolSegmentExplorer: false, + }, webpack(config, { dev }) { if (dev) { config.watchOptions = {