translate page agent admin guide to English
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-07-08 14:40:46 +09:00
parent 71eeac278f
commit 403d3ac0ed
4 changed files with 363 additions and 136 deletions
+30
View File
@@ -1,4 +1,5 @@
export const selectedAppStorageKey = 'studio-admin:selected-app-id';
export const selectedComponentByAppStorageKey = 'studio-admin:selected-component-by-app-id';
const legacySelectedAppStorageKey = 'studio-selected-app-id';
export function getStoredSelectedAppId() {
@@ -19,3 +20,32 @@ export function setStoredSelectedAppId(appId: string) {
if (!appId) return;
window.localStorage.setItem(selectedAppStorageKey, appId);
}
function readSelectedComponentMap(): Record<string, string> {
const raw = window.localStorage.getItem(selectedComponentByAppStorageKey);
if (!raw) return {};
try {
const parsed = JSON.parse(raw) as unknown;
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return {};
return Object.fromEntries(
Object.entries(parsed)
.filter((entry): entry is [string, string] => typeof entry[0] === 'string' && typeof entry[1] === 'string')
);
} catch {
return {};
}
}
export function getStoredSelectedComponentId(appId: string) {
if (!appId) return '';
return readSelectedComponentMap()[appId] ?? '';
}
export function setStoredSelectedComponentId(appId: string, componentId: string) {
if (!appId || !componentId) return;
window.localStorage.setItem(selectedComponentByAppStorageKey, JSON.stringify({
...readSelectedComponentMap(),
[appId]: componentId,
}));
}