feat(settings): sync navigation and card customization by client family (#538)
* test(web): use safe auth placeholders * feat(settings): sync navigation and card customization * fix(settings): address customization review feedback * fix(settings): address customization review feedback * fix(settings): harden customization capability handling
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { createContext } from "react";
|
||||
|
||||
import {
|
||||
DEFAULT_CARD_PRESENTATION,
|
||||
type CardPresentation,
|
||||
type PrimaryMenuDocument,
|
||||
type ShortcutDocument,
|
||||
} from "@/lib/uiCustomization";
|
||||
import type { SettingSource } from "@/hooks/queries/settingValues";
|
||||
|
||||
export interface UICustomizationValue {
|
||||
cardPresentation: CardPresentation;
|
||||
cardPresentationSource: SettingSource;
|
||||
primaryMenu: PrimaryMenuDocument | null;
|
||||
primaryMenuSource: SettingSource;
|
||||
shortcuts: ShortcutDocument;
|
||||
/** All revision-5 customization definitions are understood by this server. */
|
||||
isSupported: boolean;
|
||||
/** The server can merge shortcut item mutations without lost updates. */
|
||||
supportsAtomicShortcuts: boolean;
|
||||
isLoading: boolean;
|
||||
/** Capability or effective-value loading failed, so whole-document editors must stay closed. */
|
||||
isUnavailable: boolean;
|
||||
}
|
||||
|
||||
export const UICustomizationContext = createContext<UICustomizationValue>({
|
||||
cardPresentation: DEFAULT_CARD_PRESENTATION,
|
||||
cardPresentationSource: "default",
|
||||
primaryMenu: null,
|
||||
primaryMenuSource: "default",
|
||||
shortcuts: { items: [] },
|
||||
isSupported: false,
|
||||
supportsAtomicShortcuts: false,
|
||||
isLoading: false,
|
||||
isUnavailable: false,
|
||||
});
|
||||
Reference in New Issue
Block a user