mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-31 15:45:23 +00:00
feat: setting to let the hover side menu push content again
This commit is contained in:
1 parent
d2851982a6
commit
3a851ad189
7 files changed
+58
-4
No files matched your search
@@ -1,14 +1,23 @@
|
||||
import { getUserPreferences, saveUserPreferences } from "@/api/open-tabs-api";
|
||||
|
||||
export type RailPreference =
|
||||
"pinAppRail" | "expandAppRailOnHover" | "showPinAppRailButton";
|
||||
| "pinAppRail"
|
||||
| "expandAppRailOnHover"
|
||||
| "showPinAppRailButton"
|
||||
| "appRailHoverPushesContent";
|
||||
|
||||
const CHANGE_EVENT: Record<RailPreference, string> = {
|
||||
pinAppRail: "pinAppRailChanged",
|
||||
expandAppRailOnHover: "expandAppRailOnHoverChanged",
|
||||
showPinAppRailButton: "showPinAppRailButtonChanged",
|
||||
appRailHoverPushesContent: "appRailHoverPushesContentChanged",
|
||||
};
|
||||
|
||||
/** Kept on this device only; the server has no column for it. */
|
||||
const LOCAL_ONLY: ReadonlySet<RailPreference> = new Set([
|
||||
"appRailHoverPushesContent",
|
||||
]);
|
||||
|
||||
// pinAppRail and showPinAppRailButton default off, expandAppRailOnHover
|
||||
// defaults on, so each key needs its own read rather than a shared
|
||||
// === "true" check.
|
||||
@@ -28,6 +37,7 @@ export function readRailPreference(key: RailPreference): boolean {
|
||||
export function setRailPreference(key: RailPreference, value: boolean): void {
|
||||
localStorage.setItem(key, String(value));
|
||||
window.dispatchEvent(new Event(CHANGE_EVENT[key]));
|
||||
if (LOCAL_ONLY.has(key)) return;
|
||||
void getUserPreferences()
|
||||
.then((preferences) => {
|
||||
if (preferences.storageMode === "cloud") {
|
||||
|
||||
Reference in new issue
Block a user