feat(water-log): cycle 3 — embed Time Tracking tab in admin shell
The water-log admin panel at /admin/water-log becomes a one-stop hub for the customer: today's entries, the headgates, who can log them, AND how many hours those workers put in. - New TimeTrackingTab — thin wrapper that renders the existing TimeTrackingAdminPanel (which already owns its own Summary / Workers / Tasks / Logs / Settings sub-tabs). - Shell.tsx now exposes Today | Headgates | Users | Time Tracking; the new branch just passes brandId through. - TabValue union and TABS[] updated to "time-tracking". This is the customer-facing surface the user asked for. Cycle 4 adds the same tab to the mobile worker portal; Cycle 5 scaffolds the Smartsheet sync (config-deferred).
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
* Each tab is a focused component under ./tabs that consumes the
|
* Each tab is a focused component under ./tabs that consumes the
|
||||||
* state slice it needs.
|
* state slice it needs.
|
||||||
*
|
*
|
||||||
* Adding a new tab (e.g. Time Tracking in Cycle 3) only requires:
|
* Adding a new tab only requires:
|
||||||
* 1. Create the tab component under ./tabs
|
* 1. Create the tab component under ./tabs
|
||||||
* 2. Add a TabValue + tabs[] entry below
|
* 2. Add a TabValue + tabs[] entry below
|
||||||
* 3. Render it conditionally in the {tab === X && ...} block
|
* 3. Render it conditionally in the {tab === X && ...} block
|
||||||
@@ -42,6 +42,7 @@ import { ReportPreviewModal } from "./shared/ReportPreviewModal";
|
|||||||
import { TodayTab } from "./tabs/TodayTab";
|
import { TodayTab } from "./tabs/TodayTab";
|
||||||
import { HeadgatesTab } from "./tabs/HeadgatesTab";
|
import { HeadgatesTab } from "./tabs/HeadgatesTab";
|
||||||
import { UsersTab } from "./tabs/UsersTab";
|
import { UsersTab } from "./tabs/UsersTab";
|
||||||
|
import { TimeTrackingTab } from "./tabs/TimeTrackingTab";
|
||||||
|
|
||||||
// ── Props ────────────────────────────────────────────────────────────────────
|
// ── Props ────────────────────────────────────────────────────────────────────
|
||||||
export type ShellProps = {
|
export type ShellProps = {
|
||||||
@@ -53,7 +54,7 @@ export type ShellProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ── Tab values ───────────────────────────────────────────────────────────────
|
// ── Tab values ───────────────────────────────────────────────────────────────
|
||||||
type TabValue = "today" | "headgates" | "users";
|
type TabValue = "today" | "headgates" | "users" | "time-tracking";
|
||||||
|
|
||||||
const TABS = [
|
const TABS = [
|
||||||
{
|
{
|
||||||
@@ -69,6 +70,14 @@ const TABS = [
|
|||||||
value: "users" as const,
|
value: "users" as const,
|
||||||
label: "Users",
|
label: "Users",
|
||||||
},
|
},
|
||||||
|
// Cycle 3 — embed the existing TimeTrackingAdminPanel (which has
|
||||||
|
// its own sub-tabs) so the water-log shell becomes a one-stop hub
|
||||||
|
// for the customer: today's entries, the headgates, who logs them,
|
||||||
|
// and how many hours they put in.
|
||||||
|
{
|
||||||
|
value: "time-tracking" as const,
|
||||||
|
label: "Time Tracking",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// ── Main component ───────────────────────────────────────────────────────────
|
// ── Main component ───────────────────────────────────────────────────────────
|
||||||
@@ -250,7 +259,9 @@ export default function Shell({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Future tab: Time Tracking (Cycle 3) */}
|
{tab === "time-tracking" && (
|
||||||
|
<TimeTrackingTab brandId={brandId} />
|
||||||
|
)}
|
||||||
|
|
||||||
<ToastNotification toast={state.toast} />
|
<ToastNotification toast={state.toast} />
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Time Tracking tab — embeds the existing TimeTrackingAdminPanel
|
||||||
|
* (which already has its own sub-tabs: Summary / Workers / Tasks /
|
||||||
|
* Logs / Settings) inside the Water Log shell.
|
||||||
|
*
|
||||||
|
* Cycle 3 — this is the customer "hub" surface the water log now
|
||||||
|
* offers: one place to see today's entries, the headgates, who can
|
||||||
|
* log them, AND how many hours those workers put in.
|
||||||
|
*/
|
||||||
|
import TimeTrackingAdminPanel from "@/components/admin/TimeTrackingAdminPanel";
|
||||||
|
|
||||||
|
export type TimeTrackingTabProps = {
|
||||||
|
brandId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function TimeTrackingTab({ brandId }: TimeTrackingTabProps) {
|
||||||
|
return <TimeTrackingAdminPanel brandId={brandId} />;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user