Share my setup, panel: Backup & sync gets "Share my setup" (Copy link, Save file) and "Use a setup" (paste a waybetter://setup link or open a file, then What will change with Apply and Cancel); shown only for an app that sets PanelSite.setup; English words
This commit is contained in:
parent
fe019f19a7
commit
81d2295a50
6 changed files with 222 additions and 2 deletions
|
|
@ -32,6 +32,8 @@ const getError = (error: unknown) => error instanceof Error ? error.message : St
|
|||
const listeners = new Set<(state: ModeState) => void>();
|
||||
let cached: ModeState | null = null;
|
||||
const share = (next: ModeState) => { cached = next; for (const listener of listeners) listener(next); };
|
||||
/** Tells the mode screens a mode was stored from elsewhere (an imported setup). */
|
||||
export const rememberModeState = share;
|
||||
|
||||
/** The mode state, loaded once and shared by the first-run screen and Settings. Null until loaded (or without modes). */
|
||||
export function useModeState(): [ModeState | null, (next: ModeState) => void] {
|
||||
|
|
@ -74,7 +76,7 @@ const presetSeen = (table: FeatureTable, state: ModeState) =>
|
|||
invoke<ModeState>('mode_set', { mode: state.mode, onboarded: state.onboarded, preset: modeById(table, state.mode)?.flags ?? {} });
|
||||
|
||||
/** A flag as the owner knows it: the feature's label, or the area's name for its switch. */
|
||||
function flagName(table: FeatureTable, id: string): string {
|
||||
export function flagName(table: FeatureTable, id: string): string {
|
||||
const area = table.areas.find(entry => areaFlag(entry.id) === id);
|
||||
if (area) return area.name;
|
||||
const feature = table.features.find(entry => entry.id === id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue