52e42fcd6e
User-facing display strings now read from config.appName so forks can
rebrand without code changes, and localStorage keys are namespaced by
config.appId so forks running on the same origin don't clobber each
other's preferences. Module-level cache-key constants that previously
hardcoded 'ditto:' have been refactored into hook-scoped reads from
config.appId (via a new getStorageKey() helper). The helpContent FAQ
template now uses {appName} placeholders substituted at read-time
through getFAQCategories(appName)/getFAQItem(appName, id).
17 lines
575 B
TypeScript
17 lines
575 B
TypeScript
/**
|
|
* Build a namespaced localStorage key using the app's configured `appId`.
|
|
*
|
|
* This keeps per-fork storage isolated and prevents two forks running on the
|
|
* same origin (e.g. during local development) from clobbering each other's
|
|
* preferences.
|
|
*
|
|
* @example
|
|
* // In a React component / hook:
|
|
* const { config } = useAppContext();
|
|
* const key = getStorageKey(config.appId, 'showGlobalFeed');
|
|
* // → "ditto:showGlobalFeed" (on the default build)
|
|
*/
|
|
export function getStorageKey(appId: string, suffix: string): string {
|
|
return `${appId}:${suffix}`;
|
|
}
|