mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-16 05:13:36 +00:00
fix: sync cloud preference storage mode (#1058)
This commit is contained in:
+3
-1
@@ -1683,7 +1683,9 @@ export function AppShell({
|
|||||||
onLogout={onLogout}
|
onLogout={onLogout}
|
||||||
onChangeServer={onChangeServer}
|
onChangeServer={onChangeServer}
|
||||||
userPrefs={userPrefs}
|
userPrefs={userPrefs}
|
||||||
onPrefsChange={setUserPrefs}
|
onPrefsChange={(updates) =>
|
||||||
|
setUserPrefs((current) => ({ ...current, ...updates }))
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -445,7 +445,10 @@ export function UserProfilePanel({
|
|||||||
hiddenRailTabs?: string | null;
|
hiddenRailTabs?: string | null;
|
||||||
statusColorScheme?: string | null;
|
statusColorScheme?: string | null;
|
||||||
};
|
};
|
||||||
onPrefsChange?: (prefs: { reopenTabsOnLogin: boolean }) => void;
|
onPrefsChange?: (prefs: {
|
||||||
|
reopenTabsOnLogin?: boolean;
|
||||||
|
storageMode?: "local" | "cloud";
|
||||||
|
}) => void;
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const themeLabel: Record<ThemeId, string> = {
|
const themeLabel: Record<ThemeId, string> = {
|
||||||
@@ -522,6 +525,12 @@ export function UserProfilePanel({
|
|||||||
userPrefs?.storageMode === "cloud" ? "cloud" : "local",
|
userPrefs?.storageMode === "cloud" ? "cloud" : "local",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (userPrefs?.storageMode) {
|
||||||
|
setStorageMode(userPrefs.storageMode === "cloud" ? "cloud" : "local");
|
||||||
|
}
|
||||||
|
}, [userPrefs?.storageMode]);
|
||||||
|
|
||||||
// Settings toggles — all backed by localStorage
|
// Settings toggles — all backed by localStorage
|
||||||
const [commandAutocomplete, setCommandAutocomplete] = useState(
|
const [commandAutocomplete, setCommandAutocomplete] = useState(
|
||||||
() => localStorage.getItem("commandAutocomplete") === "true",
|
() => localStorage.getItem("commandAutocomplete") === "true",
|
||||||
@@ -623,6 +632,7 @@ export function UserProfilePanel({
|
|||||||
|
|
||||||
async function handleStorageModeChange(mode: "local" | "cloud") {
|
async function handleStorageModeChange(mode: "local" | "cloud") {
|
||||||
setStorageMode(mode);
|
setStorageMode(mode);
|
||||||
|
onPrefsChange?.({ storageMode: mode });
|
||||||
if (mode === "cloud") {
|
if (mode === "cloud") {
|
||||||
// Snapshot current browser localStorage values so any tab can restore them later
|
// Snapshot current browser localStorage values so any tab can restore them later
|
||||||
const SNAPSHOT_KEYS = [
|
const SNAPSHOT_KEYS = [
|
||||||
|
|||||||
Reference in New Issue
Block a user