mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
feat: show managed integration status
- Render a record-keyed status view for managed profiles\n- Refuse shared Settings links before actor controls mount\n- Localize intentional unavailable states
This commit is contained in:
1 parent
54cd3e3959
commit
03ee01ba56
17 files changed
+343
-32
No files matched your search
@@ -12,4 +12,11 @@ export const recordSettingsKeys = {
|
||||
["record-settings", recordId, "integrations"] as const,
|
||||
profile: (recordId: string) =>
|
||||
["record-settings", recordId, "profile"] as const,
|
||||
/** Named aliases stay unambiguous when assembled into `queryKeys`. */
|
||||
recordSettingsDetail: (recordId: string) =>
|
||||
["record-settings", recordId, "detail"] as const,
|
||||
recordSettingsIntegrations: (recordId: string) =>
|
||||
["record-settings", recordId, "integrations"] as const,
|
||||
recordSettingsProfile: (recordId: string) =>
|
||||
["record-settings", recordId, "profile"] as const,
|
||||
};
|
||||
@@ -1,7 +1,4 @@
|
||||
export type RecordSettingsRelationship =
|
||||
| "guardian"
|
||||
| "self"
|
||||
| "adult-manager";
|
||||
export type RecordSettingsRelationship = "guardian" | "self" | "adult-manager";
|
||||
|
||||
export interface RecordSettingsAccess {
|
||||
actorId: string;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import type { SettingsSectionSlug } from "@/components/settings/section-slugs";
|
||||
|
||||
export type SettingsDestinationKind =
|
||||
| "personal"
|
||||
| "managed-guardian"
|
||||
| "adult-shared-unavailable"
|
||||
| "unavailable";
|
||||
"personal" | "managed-guardian" | "adult-shared-unavailable" | "unavailable";
|
||||
|
||||
export interface SettingsDestinationClassification {
|
||||
kind: SettingsDestinationKind;
|
||||
@@ -72,15 +69,17 @@ export const SETTINGS_DESTINATION_INVENTORY = {
|
||||
advanced: PERSONAL,
|
||||
privacy: PERSONAL,
|
||||
about: PERSONAL,
|
||||
} as const satisfies Record<SettingsSectionSlug, SettingsDestinationClassification>;
|
||||
} as const satisfies Record<
|
||||
SettingsSectionSlug,
|
||||
SettingsDestinationClassification
|
||||
>;
|
||||
|
||||
export function classifySettingsDestination(
|
||||
destination: string,
|
||||
): SettingsDestinationClassification {
|
||||
return (
|
||||
SETTINGS_DESTINATION_INVENTORY[
|
||||
destination as SettingsSectionSlug
|
||||
] ?? UNAVAILABLE
|
||||
SETTINGS_DESTINATION_INVENTORY[destination as SettingsSectionSlug] ??
|
||||
UNAVAILABLE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ export {
|
||||
type RecordSettingsAccess,
|
||||
} from "./access";
|
||||
export { toRecordSettingsDto, type RecordSettingsDto } from "./dto";
|
||||
export { resolveManagedIntegrationState } from "./integrations";
|
||||
export {
|
||||
classifySettingsDestination,
|
||||
isGuardianSettingsWriteAllowed,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import type {
|
||||
IntegrationKey,
|
||||
IntegrationState,
|
||||
} from "@/lib/integrations/status";
|
||||
|
||||
/**
|
||||
* A status-ledger row alone cannot prove a connection: integrations without a
|
||||
* row synthesize a healthy ledger state for the owner Settings dashboard. The
|
||||
* managed projection must instead report those as disconnected until its
|
||||
* record carries a real credential or connection row.
|
||||
*/
|
||||
export function resolveManagedIntegrationState(
|
||||
state: IntegrationState,
|
||||
connected: Record<IntegrationKey, boolean>,
|
||||
integration: IntegrationKey,
|
||||
): IntegrationState {
|
||||
return connected[integration] ? state : "disconnected";
|
||||
}
|
||||
Reference in new issue
Block a user