mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
perf(settings): load only the link card on the arrangement pages
The arrangement page imported its link to the module's own page from the module pages file, which also holds the labs, mood and injection-site settings, so every arrangement page shipped all three. The card lives in its own module.
This commit is contained in:
1 parent
ebdb63f0d8
commit
04c9139ca6
3 files changed
+45
-29
No files matched your search
@@ -9,7 +9,7 @@ import {
|
||||
isLayoutGroupId,
|
||||
} from "@/components/settings/layout-groups";
|
||||
import { SettingsShell } from "@/components/settings/settings-shell";
|
||||
import { ModuleSettingsLinkCard } from "@/components/settings/module-settings-pages";
|
||||
import { ModuleSettingsLinkCard } from "@/components/settings/module-settings-link-card";
|
||||
import { isModuleSettingsPageId } from "@/components/settings/module-settings-page-ids";
|
||||
import { SettingsHubBackLink } from "@/components/settings/settings-hub-back-link";
|
||||
import { resolveServerLocale } from "@/lib/i18n/server-locale";
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
"use client";
|
||||
|
||||
/**
|
||||
* The way from a module's arrangement page (`/settings/layout/<id>`) to its
|
||||
* own page under Modules, for the modules that have one.
|
||||
*
|
||||
* Kept apart from `module-settings-pages.tsx` so the arrangement route ships
|
||||
* the card it renders, not the labs, mood and injection-site settings that
|
||||
* module holds.
|
||||
*/
|
||||
|
||||
import Link from "next/link";
|
||||
import { ChevronRight, SlidersHorizontal } from "lucide-react";
|
||||
|
||||
import { SettingsCard } from "@/components/settings/settings-card";
|
||||
import { SettingsCardHeader } from "@/components/settings/_card-header";
|
||||
import { SettingsCardActions } from "@/components/settings/_card-actions";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import type { ModuleSettingsPageId } from "./module-settings-page-ids";
|
||||
|
||||
export function ModuleSettingsLinkCard({ id }: { id: ModuleSettingsPageId }) {
|
||||
const { t } = useTranslations();
|
||||
return (
|
||||
<SettingsCard data-slot="arrangement-module-settings-link">
|
||||
<SettingsCardHeader
|
||||
icon={SlidersHorizontal}
|
||||
title={t("settings.sections.modules.pages.moduleSettingsTitle")}
|
||||
description={t(
|
||||
"settings.sections.modules.pages.moduleSettingsDescription",
|
||||
)}
|
||||
/>
|
||||
<SettingsCardActions align="start">
|
||||
<Button asChild variant="outline" size="sm" className="min-h-11">
|
||||
<Link href={`/settings/modules/${id}`}>
|
||||
{t("settings.sections.modules.openModuleSettings")}
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
</Button>
|
||||
</SettingsCardActions>
|
||||
</SettingsCard>
|
||||
);
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import Link from "next/link";
|
||||
import { ArrowUpDown, ChevronRight, SlidersHorizontal } from "lucide-react";
|
||||
import { ArrowUpDown, ChevronRight } from "lucide-react";
|
||||
|
||||
import { LabsModuleSettings } from "@/components/labs/labs-settings";
|
||||
import { InjectionSitesCard } from "@/components/settings/injection-sites-card";
|
||||
@@ -88,30 +88,3 @@ export function ModuleSettingsPageBody({ id }: { id: ModuleSettingsPageId }) {
|
||||
const Body = MODULE_SETTINGS_PAGE_BODIES[id];
|
||||
return <Body />;
|
||||
}
|
||||
|
||||
/**
|
||||
* The way from a module's arrangement page to its own page under Modules,
|
||||
* for the modules that have one.
|
||||
*/
|
||||
export function ModuleSettingsLinkCard({ id }: { id: ModuleSettingsPageId }) {
|
||||
const { t } = useTranslations();
|
||||
return (
|
||||
<SettingsCard data-slot="arrangement-module-settings-link">
|
||||
<SettingsCardHeader
|
||||
icon={SlidersHorizontal}
|
||||
title={t("settings.sections.modules.pages.moduleSettingsTitle")}
|
||||
description={t(
|
||||
"settings.sections.modules.pages.moduleSettingsDescription",
|
||||
)}
|
||||
/>
|
||||
<SettingsCardActions align="start">
|
||||
<Button asChild variant="outline" size="sm" className="min-h-11">
|
||||
<Link href={`/settings/modules/${id}`}>
|
||||
{t("settings.sections.modules.openModuleSettings")}
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
</Button>
|
||||
</SettingsCardActions>
|
||||
</SettingsCard>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user