Skip to content

Commit 3a0f58a

Browse files
authored
improvement: Hide Windows App Settings Group (#954)
* shouldnt render the App settings group since they are for mac only * formatting
1 parent 12a6e25 commit 3a0f58a

File tree

1 file changed

+97
-89
lines changed
  • apps/desktop/src/routes/(window-chrome)/settings

1 file changed

+97
-89
lines changed

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

Lines changed: 97 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
164164

165165
type SettingsGroup = {
166166
title: string;
167+
os?: "macos" | "windows" | "linux";
167168
titleStyling?: string;
168169
items: SettingItem[];
169170
};
@@ -190,6 +191,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
190191
},
191192
{
192193
title: "App",
194+
os: "macos",
193195
items: [
194196
{
195197
label: "Hide dock icon",
@@ -383,100 +385,106 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {
383385

384386
<For each={settingsGroups}>
385387
{(group) => (
386-
<div>
387-
<h3
388-
class={cx(
389-
"mb-3 text-sm text-gray-12 w-fit",
390-
group.titleStyling,
391-
)}
392-
>
393-
{group.title}
394-
</h3>
395-
<div class="px-3 rounded-xl border divide-y divide-gray-3 border-gray-3 bg-gray-2">
396-
<For each={group.items}>
397-
{(item) => {
398-
// Check OS compatibility
399-
if (
400-
item.type === "toggle" &&
401-
item.os &&
402-
item.os !== ostype
403-
) {
404-
return null;
405-
}
406-
407-
if (item.type === "toggle") {
408-
return (
409-
<ToggleSetting
410-
pro={group.title === "Cap Pro"}
411-
label={item.label}
412-
description={item.description}
413-
value={item.value}
414-
onChange={item.onChange}
415-
/>
416-
);
417-
} else if (item.type === "select") {
388+
<Show when={group.os === ostype || !group.os}>
389+
<div>
390+
<h3
391+
class={cx(
392+
"mb-3 text-sm text-gray-12 w-fit",
393+
group.titleStyling,
394+
)}
395+
>
396+
{group.title}
397+
</h3>
398+
<div class="px-3 rounded-xl border divide-y divide-gray-3 border-gray-3 bg-gray-2">
399+
<For each={group.items}>
400+
{(item) => {
401+
// Check OS compatibility
418402
if (
419-
item.label === "Main window recording start behaviour"
420-
) {
421-
return renderRecordingSelect(
422-
item.label,
423-
item.description,
424-
() => item.value,
425-
item.onChange,
426-
[
427-
{ text: "Close", value: "close" },
428-
{ text: "Minimise", value: "minimise" },
429-
],
430-
);
431-
} else if (
432-
item.label === "Studio recording finish behaviour"
433-
) {
434-
return renderRecordingSelect(
435-
item.label,
436-
item.description,
437-
() => item.value,
438-
item.onChange,
439-
[
440-
{ text: "Open editor", value: "openEditor" },
441-
{ text: "Show in overlay", value: "showOverlay" },
442-
],
443-
);
444-
} else if (item.label === "Recording countdown") {
445-
return renderRecordingSelect(
446-
item.label,
447-
item.description,
448-
() => item.value,
449-
item.onChange,
450-
[
451-
{ text: "Off", value: 0 },
452-
{ text: "3 seconds", value: 3 },
453-
{ text: "5 seconds", value: 5 },
454-
{ text: "10 seconds", value: 10 },
455-
],
456-
);
457-
} else if (
458-
item.label === "After deleting recording behaviour"
403+
item.type === "toggle" &&
404+
item.os &&
405+
item.os !== ostype
459406
) {
460-
return renderRecordingSelect(
461-
item.label,
462-
item.description,
463-
() => item.value,
464-
item.onChange,
465-
[
466-
{ text: "Do Nothing", value: "doNothing" },
467-
{
468-
text: "Reopen Recording Window",
469-
value: "reopenRecordingWindow",
470-
},
471-
],
407+
return null;
408+
}
409+
410+
if (item.type === "toggle") {
411+
return (
412+
<ToggleSetting
413+
pro={group.title === "Cap Pro"}
414+
label={item.label}
415+
description={item.description}
416+
value={item.value}
417+
onChange={item.onChange}
418+
/>
472419
);
420+
} else if (item.type === "select") {
421+
if (
422+
item.label ===
423+
"Main window recording start behaviour"
424+
) {
425+
return renderRecordingSelect(
426+
item.label,
427+
item.description,
428+
() => item.value,
429+
item.onChange,
430+
[
431+
{ text: "Close", value: "close" },
432+
{ text: "Minimise", value: "minimise" },
433+
],
434+
);
435+
} else if (
436+
item.label === "Studio recording finish behaviour"
437+
) {
438+
return renderRecordingSelect(
439+
item.label,
440+
item.description,
441+
() => item.value,
442+
item.onChange,
443+
[
444+
{ text: "Open editor", value: "openEditor" },
445+
{
446+
text: "Show in overlay",
447+
value: "showOverlay",
448+
},
449+
],
450+
);
451+
} else if (item.label === "Recording countdown") {
452+
return renderRecordingSelect(
453+
item.label,
454+
item.description,
455+
() => item.value,
456+
item.onChange,
457+
[
458+
{ text: "Off", value: 0 },
459+
{ text: "3 seconds", value: 3 },
460+
{ text: "5 seconds", value: 5 },
461+
{ text: "10 seconds", value: 10 },
462+
],
463+
);
464+
} else if (
465+
item.label === "After deleting recording behaviour"
466+
) {
467+
return renderRecordingSelect(
468+
item.label,
469+
item.description,
470+
() => item.value,
471+
item.onChange,
472+
[
473+
{ text: "Do Nothing", value: "doNothing" },
474+
{
475+
text: "Reopen Recording Window",
476+
value: "reopenRecordingWindow",
477+
},
478+
],
479+
);
480+
}
473481
}
474-
}
475-
return null;
476-
}}
477-
</For>
482+
return null;
483+
}}
484+
</For>
485+
</div>
478486
</div>
479-
</div>
487+
</Show>
480488
)}
481489
</For>
482490

0 commit comments

Comments
 (0)