What changed:
- Onboarding tracking: admin_app_opened on first authenticated dashboard load; event_created, branding_configured,
and invite_created on their respective actions.
- Tour replay: Settings now has an “Experience” section to replay the tour (clears tour seen flag and opens via ?tour=1).
- Empty states: Tasks, Members, and Guest Messages now include richer copy + quick actions.
- New helpers + copy: Tour storage helpers, new translations, and related UI wiring.
67 lines
1.4 KiB
TypeScript
67 lines
1.4 KiB
TypeScript
export type InstallBannerVariant = 'prompt' | 'ios';
|
|
|
|
export type InstallBannerState = {
|
|
variant: InstallBannerVariant;
|
|
};
|
|
|
|
export type InstallBannerInput = {
|
|
isInstalled: boolean;
|
|
isStandalone: boolean;
|
|
canInstall: boolean;
|
|
isIos: boolean;
|
|
};
|
|
|
|
export const INSTALL_BANNER_DISMISS_KEY = 'admin-install-banner-dismissed-v1';
|
|
|
|
export function resolveInstallBannerState(input: InstallBannerInput): InstallBannerState | null {
|
|
if (input.isInstalled || input.isStandalone) {
|
|
return null;
|
|
}
|
|
|
|
if (input.canInstall) {
|
|
return { variant: 'prompt' };
|
|
}
|
|
|
|
if (input.isIos) {
|
|
return { variant: 'ios' };
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
export function shouldShowInstallBanner(input: InstallBannerInput, dismissed: boolean): InstallBannerState | null {
|
|
if (dismissed) {
|
|
return null;
|
|
}
|
|
|
|
return resolveInstallBannerState(input);
|
|
}
|
|
|
|
export function getInstallBannerDismissed(): boolean {
|
|
if (typeof window === 'undefined') {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
return window.localStorage.getItem(INSTALL_BANNER_DISMISS_KEY) === '1';
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export function setInstallBannerDismissed(value: boolean): void {
|
|
if (typeof window === 'undefined') {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
if (value) {
|
|
window.localStorage.setItem(INSTALL_BANNER_DISMISS_KEY, '1');
|
|
} else {
|
|
window.localStorage.removeItem(INSTALL_BANNER_DISMISS_KEY);
|
|
}
|
|
} catch {
|
|
// Ignore storage errors.
|
|
}
|
|
}
|