Skip to content

Commit f272bbf

Browse files
Merge pull request #1396 from ItsEeleeya/new-theme-previews
New theme preview icons
2 parents 563e238 + bab0348 commit f272bbf

File tree

7 files changed

+40
-9
lines changed

7 files changed

+40
-9
lines changed
-23.9 KB
Loading
-23 KB
Loading
48.7 KB
Loading
33.8 KB
Loading
38.9 KB
Loading
-44.4 KB
Loading

apps/desktop/src/routes/(window-chrome)/settings/general.tsx

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ import {
2020
import { createStore, reconcile } from "solid-js/store";
2121
import themePreviewAuto from "~/assets/theme-previews/auto.jpg";
2222
import themePreviewDark from "~/assets/theme-previews/dark.jpg";
23+
import themePreviewLegacyAuto from "~/assets/theme-previews/legacy-auto.jpg";
24+
import themePreviewLegacyDark from "~/assets/theme-previews/legacy-dark.jpg";
25+
import themePreviewLegacyLight from "~/assets/theme-previews/legacy-light.jpg";
2326
import themePreviewLight from "~/assets/theme-previews/light.jpg";
2427
import { Input } from "~/routes/editor/ui";
2528
import { authStore, generalSettingsStore } from "~/store";
@@ -111,13 +114,35 @@ export default function GeneralSettings() {
111114

112115
function AppearanceSection(props: {
113116
currentTheme: AppTheme;
117+
newRecordingFlow: boolean;
114118
onThemeChange: (theme: AppTheme) => void;
115119
}) {
116120
const options = [
117-
{ id: "system", name: "System", preview: themePreviewAuto },
118-
{ id: "light", name: "Light", preview: themePreviewLight },
119-
{ id: "dark", name: "Dark", preview: themePreviewDark },
120-
] satisfies { id: AppTheme; name: string; preview: string }[];
121+
{
122+
id: "system",
123+
name: "System",
124+
},
125+
{
126+
id: "light",
127+
name: "Light",
128+
},
129+
{
130+
id: "dark",
131+
name: "Dark",
132+
},
133+
] satisfies { id: AppTheme; name: string }[];
134+
135+
const previews = createMemo(() => {
136+
return {
137+
system: props.newRecordingFlow
138+
? themePreviewAuto
139+
: themePreviewLegacyAuto,
140+
light: props.newRecordingFlow
141+
? themePreviewLight
142+
: themePreviewLegacyLight,
143+
dark: props.newRecordingFlow ? themePreviewDark : themePreviewLegacyDark,
144+
};
145+
});
121146

122147
return (
123148
<div class="flex flex-col gap-4">
@@ -155,11 +180,16 @@ function AppearanceSection(props: {
155180
aria-label={`Select theme: ${theme.name}`}
156181
>
157182
<div class="flex justify-center items-center w-full h-full">
158-
<img
159-
draggable={false}
160-
src={theme.preview}
161-
alt={`Preview of ${theme.name} theme`}
162-
/>
183+
<Show when={previews()[theme.id]} keyed>
184+
{(preview) => (
185+
<img
186+
class="animate-in fade-in duration-300"
187+
draggable={false}
188+
src={preview}
189+
alt={`Preview of ${theme.name} theme`}
190+
/>
191+
)}
192+
</Show>
163193
</div>
164194
</div>
165195
<span
@@ -376,6 +406,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
376406
<div class="p-4 space-y-6">
377407
<AppearanceSection
378408
currentTheme={settings.theme ?? "system"}
409+
newRecordingFlow={settings.enableNewRecordingFlow}
379410
onThemeChange={(newTheme) => {
380411
setSettings("theme", newTheme);
381412
generalSettingsStore.set({ theme: newTheme });

0 commit comments

Comments
 (0)