-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Allow disabling job overlay (#542)
* ✨ Allow disabling job overlay Resolves #531 * 🗃️ Add migration
- Loading branch information
1 parent
21cced8
commit 821c1bc
Showing
10 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
core/prisma/migrations/20241226172540_job_overlay_preference/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_user_preferences" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"preferred_layout_mode" TEXT NOT NULL DEFAULT 'GRID', | ||
"locale" TEXT NOT NULL DEFAULT 'en', | ||
"app_theme" TEXT NOT NULL DEFAULT 'LIGHT', | ||
"app_font" TEXT NOT NULL DEFAULT 'inter', | ||
"primary_navigation_mode" TEXT NOT NULL DEFAULT 'SIDEBAR', | ||
"layout_max_width_px" INTEGER DEFAULT 1280, | ||
"show_query_indicator" BOOLEAN NOT NULL DEFAULT false, | ||
"enable_live_refetch" BOOLEAN NOT NULL DEFAULT false, | ||
"enable_discord_presence" BOOLEAN NOT NULL DEFAULT false, | ||
"enable_compact_display" BOOLEAN NOT NULL DEFAULT false, | ||
"enable_gradients" BOOLEAN NOT NULL DEFAULT false, | ||
"enable_double_sidebar" BOOLEAN NOT NULL DEFAULT true, | ||
"enable_replace_primary_sidebar" BOOLEAN NOT NULL DEFAULT false, | ||
"enable_hide_scrollbar" BOOLEAN NOT NULL DEFAULT false, | ||
"prefer_accent_color" BOOLEAN NOT NULL DEFAULT true, | ||
"show_thumbnails_in_headers" BOOLEAN NOT NULL DEFAULT false, | ||
"enable_job_overlay" BOOLEAN NOT NULL DEFAULT true, | ||
"navigation_arrangement" BLOB, | ||
"home_arrangement" BLOB, | ||
"user_id" TEXT | ||
); | ||
INSERT INTO "new_user_preferences" ("app_font", "app_theme", "enable_compact_display", "enable_discord_presence", "enable_double_sidebar", "enable_gradients", "enable_hide_scrollbar", "enable_live_refetch", "enable_replace_primary_sidebar", "home_arrangement", "id", "layout_max_width_px", "locale", "navigation_arrangement", "prefer_accent_color", "preferred_layout_mode", "primary_navigation_mode", "show_query_indicator", "show_thumbnails_in_headers", "user_id") SELECT "app_font", "app_theme", "enable_compact_display", "enable_discord_presence", "enable_double_sidebar", "enable_gradients", "enable_hide_scrollbar", "enable_live_refetch", "enable_replace_primary_sidebar", "home_arrangement", "id", "layout_max_width_px", "locale", "navigation_arrangement", "prefer_accent_color", "preferred_layout_mode", "primary_navigation_mode", "show_query_indicator", "show_thumbnails_in_headers", "user_id" FROM "user_preferences"; | ||
DROP TABLE "user_preferences"; | ||
ALTER TABLE "new_user_preferences" RENAME TO "user_preferences"; | ||
CREATE UNIQUE INDEX "user_preferences_user_id_key" ON "user_preferences"("user_id"); | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/browser/src/scenes/settings/app/appearance/EnableJobOverlayToggle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useUpdatePreferences } from '@stump/client' | ||
import { UpdateUserPreferences } from '@stump/sdk' | ||
|
||
import { useUserStore } from '@/stores' | ||
|
||
import PreferenceToggle from '../../PreferenceToggle' | ||
|
||
export default function EnableJobOverlayToggle() { | ||
const { preferences, setPreferences } = useUserStore((state) => ({ | ||
preferences: state.userPreferences, | ||
setPreferences: state.setUserPreferences, | ||
})) | ||
|
||
const { update } = useUpdatePreferences({ | ||
onSuccess: setPreferences, | ||
}) | ||
|
||
const handleChange = () => { | ||
if (preferences) { | ||
update({ | ||
...preferences, | ||
enable_job_overlay: !preferences.enable_job_overlay, | ||
} as UpdateUserPreferences) | ||
} | ||
} | ||
|
||
return ( | ||
<PreferenceToggle | ||
formId="enable_job_overlay" | ||
label="Job overlay" | ||
description="Show a floating overlay while a job is running" | ||
isChecked={preferences?.enable_job_overlay} | ||
onToggle={handleChange} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters