Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+178
-55
@@ -1,74 +1,197 @@
|
||||
// AK-P17a Interim-UI (AD-28) — HR hub launchpad composed from ~/ui (D-HR
|
||||
// "HR-Hub-Start", archetype A1/A6). Pure presentational: the loader gates the
|
||||
// connector + permission and passes the resolved quick-link list in as a prop;
|
||||
// this screen only renders. The richer hub widgets (announcements, pending
|
||||
// duties, birthdays) arrive with their data in follow-up tickets; the interim
|
||||
// screen renders exactly what the loader provides. Final Subframe optics = a
|
||||
// tracked design-nachzug once David's D-HR delta ships.
|
||||
// R-UX3 Interim-UI (AD-28) — task-oriented personnel hub composed from ~/ui.
|
||||
// Visibility, counts and allowed actions arrive in the VM; this component has
|
||||
// no role names, permissions or client-side data filtering.
|
||||
|
||||
import type { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherArrowRight, FeatherLock } from "@subframe/core";
|
||||
import { AppLink } from "~/components/app/AppLink";
|
||||
import {
|
||||
FeatherArrowRight,
|
||||
FeatherBell,
|
||||
FeatherBriefcase,
|
||||
FeatherClipboard,
|
||||
FeatherLock,
|
||||
FeatherUser,
|
||||
} from "@subframe/core";
|
||||
import type { HrHubItem, HrHubSection, HrHubVM } from "@hivegrid/view-models";
|
||||
import {
|
||||
PAGE_HEADER_ICON_CLASS,
|
||||
PageBody,
|
||||
PageHeader,
|
||||
PageShell,
|
||||
} from "../shared/PageShell";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { EmptyState } from "~/ui/components/EmptyState";
|
||||
|
||||
export type HrHubLink = {
|
||||
/** i18n key for the link label (e.g. "hr.nav.directory"). */
|
||||
readonly labelKey: string;
|
||||
readonly href: string;
|
||||
};
|
||||
|
||||
export type HrHubPageProps = {
|
||||
/** False when the tenant has the HR module gated off (locked state). */
|
||||
moduleActive: boolean;
|
||||
links: readonly HrHubLink[];
|
||||
vm: HrHubVM;
|
||||
};
|
||||
|
||||
export function HrHubPage({ moduleActive, links }: HrHubPageProps) {
|
||||
function TaskCount({ count }: { count: number }) {
|
||||
const { t } = useTranslation();
|
||||
if (count <= 0) return null;
|
||||
return (
|
||||
<BadgeFeedback farbe="subtle-warning" size="small">
|
||||
{t("hr.hub.openCount", { count })}
|
||||
</BadgeFeedback>
|
||||
);
|
||||
}
|
||||
|
||||
if (!moduleActive) {
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.hr.hub">
|
||||
<div className="flex items-center gap-2 text-text-neutral-tertiary" data-ui-id="ui.hr.hub.locked">
|
||||
<FeatherLock className="text-heading-3 font-heading-3" />
|
||||
<EmptyState title={t("hr.hub.locked.headline")} body={t("hr.hub.locked.body")} />
|
||||
function HubItemCard({ item, priority = false }: { item: HrHubItem; priority?: boolean }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<AppLink
|
||||
href={item.href}
|
||||
className="group/item min-w-0 no-underline"
|
||||
data-row-id={item.id}
|
||||
data-ui-id={`ui.hr.hub.item.${item.id}`}
|
||||
>
|
||||
<Card>
|
||||
<div
|
||||
className={
|
||||
priority
|
||||
? "flex min-h-28 w-full items-start justify-between gap-4"
|
||||
: "flex min-h-24 w-full items-start justify-between gap-4"
|
||||
}
|
||||
>
|
||||
<div className="flex min-w-0 grow flex-col gap-2">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-body-large-medium-0 font-body-large-medium-0 text-text-neutral-primary">
|
||||
{t(item.labelKey)}
|
||||
</span>
|
||||
<TaskCount count={item.count} />
|
||||
</div>
|
||||
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">
|
||||
{t(item.descriptionKey)}
|
||||
</span>
|
||||
</div>
|
||||
<FeatherArrowRight
|
||||
aria-hidden="true"
|
||||
className="mt-1 shrink-0 text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary transition-transform group-hover/item:translate-x-0.5"
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
</AppLink>
|
||||
);
|
||||
}
|
||||
|
||||
function HubSectionView({
|
||||
section,
|
||||
icon,
|
||||
}: {
|
||||
section: HrHubSection;
|
||||
icon: ReactNode;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
if (!section.visible) return null;
|
||||
return (
|
||||
<section
|
||||
className="flex w-full flex-col gap-4"
|
||||
aria-labelledby={`hr-hub-${section.id}`}
|
||||
data-ui-id={`ui.hr.hub.section.${section.id}`}
|
||||
>
|
||||
<div className="flex items-start gap-3">
|
||||
<span className="mt-0.5 text-heading-3 font-heading-3 text-icon-brand-primary">
|
||||
{icon}
|
||||
</span>
|
||||
<div className="flex min-w-0 grow flex-col gap-1">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<h2
|
||||
id={`hr-hub-${section.id}`}
|
||||
className="text-heading-3 font-heading-3 text-text-neutral-primary"
|
||||
>
|
||||
{t(section.labelKey)}
|
||||
</h2>
|
||||
<TaskCount count={section.count} />
|
||||
</div>
|
||||
<p className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">
|
||||
{t(section.descriptionKey)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3">
|
||||
{section.items.map((item) => (
|
||||
<HubItemCard key={item.id} item={item} />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function HrHubPage({ vm }: HrHubPageProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!vm.moduleActive) {
|
||||
return (
|
||||
<PageShell uiId="ui.hr.hub">
|
||||
<PageHeader
|
||||
icon={<FeatherUser className={PAGE_HEADER_ICON_CLASS} />}
|
||||
title={t("hr.hub.title")}
|
||||
subtitle={t("hr.hub.subtitle")}
|
||||
/>
|
||||
<PageBody>
|
||||
<div className="flex items-center gap-2 text-text-neutral-tertiary" data-ui-id="ui.hr.hub.locked">
|
||||
<FeatherLock className="text-heading-3 font-heading-3" />
|
||||
<EmptyState
|
||||
title={t("hr.hub.locked.headline")}
|
||||
body={t("hr.hub.locked.body")}
|
||||
/>
|
||||
</div>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.hr.hub">
|
||||
{/* Header: title + description (0px rhythm) */}
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-heading-2 font-heading-2 text-text-neutral-primary">{t("hr.hub.title")}</span>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">
|
||||
{t("hr.hub.subtitle")}
|
||||
</span>
|
||||
</div>
|
||||
<PageShell uiId="ui.hr.hub">
|
||||
<PageHeader
|
||||
icon={<FeatherUser className={PAGE_HEADER_ICON_CLASS} />}
|
||||
title={t("hr.hub.title")}
|
||||
subtitle={t("hr.hub.subtitle")}
|
||||
actions={<TaskCount count={vm.openTaskCount} />}
|
||||
/>
|
||||
<PageBody>
|
||||
<section
|
||||
className="flex w-full flex-col gap-4"
|
||||
aria-labelledby="hr-hub-priority"
|
||||
data-ui-id="ui.hr.hub.priority"
|
||||
>
|
||||
<div className="flex flex-col gap-1">
|
||||
<h2
|
||||
id="hr-hub-priority"
|
||||
className="text-heading-3 font-heading-3 text-text-neutral-primary"
|
||||
>
|
||||
{t("hr.hub.priority.title")}
|
||||
</h2>
|
||||
<p className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">
|
||||
{t(
|
||||
vm.openTaskCount > 0
|
||||
? "hr.hub.priority.body"
|
||||
: "hr.hub.priority.emptyBody",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
{vm.priorityActions.map((item) => (
|
||||
<HubItemCard key={item.id} item={item} priority />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<nav
|
||||
className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"
|
||||
data-ui-id="ui.hr.hub.links"
|
||||
>
|
||||
{links.map((link) => (
|
||||
<a
|
||||
key={link.labelKey}
|
||||
href={link.href}
|
||||
className="no-underline"
|
||||
data-row-id={link.labelKey}
|
||||
>
|
||||
<Card>
|
||||
<div className="flex w-full items-center justify-between gap-4">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">
|
||||
{t(link.labelKey)}
|
||||
</span>
|
||||
<FeatherArrowRight className="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary" />
|
||||
</div>
|
||||
</Card>
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
<HubSectionView
|
||||
section={vm.forMe}
|
||||
icon={<FeatherClipboard aria-hidden="true" />}
|
||||
/>
|
||||
<HubSectionView
|
||||
section={vm.myTeam}
|
||||
icon={<FeatherBell aria-hidden="true" />}
|
||||
/>
|
||||
<HubSectionView
|
||||
section={vm.administration}
|
||||
icon={<FeatherBriefcase aria-hidden="true" />}
|
||||
/>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user