- In-app reminders: task due (skips rescheduled tasks, catch-up wording) and a per-user morning digest step in the daily job - Frontend: "Als Nächstes" on the colony page, "Heute" on the dashboard, inspection-due card, season chip, apiary overview fields, cleanup sheet for ended colonies - Frontend: plausibility warnings that stay until dismissed, withdrawal spans in the calendar, notification bell with categories and links, notification settings in the profile - ARCHITECTURE.md: T4a sections 11.1-11.10, assumptions 31-41, handler table and daily job step order Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
91 lines
2.5 KiB
TypeScript
91 lines
2.5 KiB
TypeScript
import {
|
|
Bug,
|
|
CalendarCheck,
|
|
ClipboardCheck,
|
|
Crown,
|
|
Droplet,
|
|
Eraser,
|
|
HeartPulse,
|
|
RefreshCw,
|
|
ShoppingCart,
|
|
Snowflake,
|
|
Split,
|
|
Sprout,
|
|
Sun,
|
|
Syringe,
|
|
UserCheck,
|
|
Utensils,
|
|
type LucideIcon,
|
|
} from "lucide-react";
|
|
import type { SuggestionIntent } from "./types";
|
|
|
|
/** Used for combined rows („Durchsicht fällig · 6 Völker“) and as the icon's name. */
|
|
export const INTENT_LABELS: Record<SuggestionIntent, string> = {
|
|
INSPECT: "Durchsicht fällig",
|
|
SWARM_CHECK: "Schwarmkontrolle",
|
|
QUEEN_CHECK: "Königin prüfen",
|
|
QUEEN_ACCEPTANCE: "Zusetzen prüfen",
|
|
QUEEN_REPLACE: "Königin ersetzen",
|
|
SPLIT_PLAN: "Ableger prüfen",
|
|
VARROA_MEASURE: "Varroa messen",
|
|
VARROA_RECHECK: "Varroa nachkontrollieren",
|
|
VARROA_TREAT: "Behandlung prüfen",
|
|
SUMMER_TREATMENT: "Sommerbehandlung",
|
|
FEED: "Füttern",
|
|
HONEY_SUPER: "Honigraum prüfen",
|
|
WINTER_CHECK: "Winterkontrolle",
|
|
HEALTH_CHECK: "Gesundheit prüfen",
|
|
FOLLOW_UP: "Nachkontrolle",
|
|
STOCK_REORDER: "Nachbestellen",
|
|
CLEANUP: "Aufräumen",
|
|
};
|
|
|
|
export const INTENT_ICONS: Record<SuggestionIntent, LucideIcon> = {
|
|
INSPECT: ClipboardCheck,
|
|
SWARM_CHECK: Sprout,
|
|
QUEEN_CHECK: Crown,
|
|
QUEEN_ACCEPTANCE: UserCheck,
|
|
QUEEN_REPLACE: RefreshCw,
|
|
SPLIT_PLAN: Split,
|
|
VARROA_MEASURE: Bug,
|
|
VARROA_RECHECK: Bug,
|
|
VARROA_TREAT: Syringe,
|
|
SUMMER_TREATMENT: Sun,
|
|
FEED: Utensils,
|
|
HONEY_SUPER: Droplet,
|
|
WINTER_CHECK: Snowflake,
|
|
HEALTH_CHECK: HeartPulse,
|
|
FOLLOW_UP: CalendarCheck,
|
|
STOCK_REORDER: ShoppingCart,
|
|
CLEANUP: Eraser,
|
|
};
|
|
|
|
/** The form a DO suggestion („Erfassen“) opens; the inspection form for the rest. */
|
|
const CAPTURE_PATHS: Partial<Record<SuggestionIntent, string>> = {
|
|
VARROA_MEASURE: "/varroa/new",
|
|
VARROA_RECHECK: "/varroa/new",
|
|
FEED: "/feedings/new",
|
|
WINTER_CHECK: "/winter",
|
|
};
|
|
|
|
const DEFAULT_CAPTURE_PATH = "/inspections/new";
|
|
|
|
/** From July on the winter check is the autumn one (as the autopilot's own link says). */
|
|
const FIRST_AUTUMN_MONTH = 7;
|
|
|
|
export function captureHref(
|
|
intent: SuggestionIntent,
|
|
colonyId: string | null,
|
|
now: Date = new Date(),
|
|
): string {
|
|
const path = CAPTURE_PATHS[intent] ?? DEFAULT_CAPTURE_PATH;
|
|
if (!colonyId) return path;
|
|
const query = `colonyId=${encodeURIComponent(colonyId)}`;
|
|
if (path === "/winter") {
|
|
// The winter page opens the dialog of that colony for the season.
|
|
const season = now.getMonth() + 1 >= FIRST_AUTUMN_MONTH ? "AUTUMN" : "SPRING";
|
|
return `${path}?${query}&season=${season}`;
|
|
}
|
|
return `${path}?${query}`;
|
|
}
|