Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/feat-collpase-folder-setting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: minor
---

Add a setting to collapse sidebar folders by default.
19 changes: 19 additions & 0 deletions src/app/features/settings/cosmetics/Themes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ function PageZoomInput() {
export function Appearance() {
const [twitterEmoji, setTwitterEmoji] = useSetting(settingsAtom, 'twitterEmoji');
const [showEasterEggs, setShowEasterEggs] = useSetting(settingsAtom, 'showEasterEggs');
const [closeFoldersByDefault, setCloseFoldersByDefault] = useSetting(
settingsAtom,
'closeFoldersByDefault'
);

return (
<Box direction="Column" gap="700">
Expand All @@ -500,6 +504,21 @@ export function Appearance() {
/>
</SequenceCard>

<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
<SettingTile
title="Close Space Folders by Default"
focusId="collapse-folders-by-default"
description="Collapse sidebar folders upon loading."
after={
<Switch
variant="Primary"
value={closeFoldersByDefault}
onChange={setCloseFoldersByDefault}
/>
}
/>
</SequenceCard>

<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
<SettingTile
title="Show Easter Eggs"
Expand Down
5 changes: 5 additions & 0 deletions src/app/state/openedSidebarFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getLocalStorageItem,
setLocalStorageItem,
} from './utils/atomWithLocalStorage';
import { getSettings } from './settings';

const OPENED_SIDEBAR_FOLDER = 'openedSidebarFolder';

Expand All @@ -30,6 +31,10 @@ export const makeOpenedSidebarFolderAtom = (userId: string): OpenedSidebarFolder
const baseOpenedSidebarFolderAtom = atomWithLocalStorage<Set<string>>(
storeKey,
(key) => {
const settings = getSettings();
if (settings.closeFoldersByDefault) {
return new Set<string>();
}
const arrayValue = getLocalStorageItem<string[]>(key, []);
return new Set(arrayValue);
},
Expand Down
5 changes: 2 additions & 3 deletions src/app/state/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,11 @@ export interface Settings {
alwaysShowCallButton: boolean;
faviconForMentionsOnly: boolean;
highlightMentions: boolean;
/**
* whether to enable pk compat
*/
pkCompat: boolean;
pmpProxying: boolean;
mentionInReplies: boolean;
showPersonaSetting: boolean;
closeFoldersByDefault: boolean;

// furry stuff
renderAnimals: boolean;
Expand Down Expand Up @@ -216,6 +214,7 @@ const defaultSettings: Settings = {
pmpProxying: false,
mentionInReplies: true,
showPersonaSetting: false,
closeFoldersByDefault: false,

// furry stuff
renderAnimals: true,
Expand Down
Loading