Add option to hide noStrudel logo in nav bar

This commit is contained in:
hzrd149 2024-09-20 09:33:02 -05:00
parent eaed508fe1
commit 4659ad7f82
4 changed files with 45 additions and 16 deletions

View File

@ -0,0 +1,5 @@
---
"nostrudel": minor
---
Add option to hide noStrudel logo in nav bar

View File

@ -13,6 +13,7 @@ import { offlineMode } from "../../services/offline-mode";
import WifiOff from "../icons/wifi-off";
import { useTaskManagerContext } from "../../views/task-manager/provider";
import TaskManagerButtons from "./task-manager-buttons";
import localSettings from "../../services/local-settings";
const hideScrollbar = css`
-ms-overflow-style: none;
@ -26,6 +27,7 @@ export default function DesktopSideNav(props: Omit<FlexProps, "children">) {
const account = useCurrentAccount();
const { openModal } = useContext(PostModalContext);
const offline = useSubject(offlineMode);
const showBrandLogo = useSubject(localSettings.showBrandLogo);
return (
<Flex
@ -42,22 +44,24 @@ export default function DesktopSideNav(props: Omit<FlexProps, "children">) {
css={hideScrollbar}
>
<Flex direction="column" flexShrink={0} gap="2">
<Flex gap="2" alignItems="center" position="relative" my="2">
<Avatar src="/apple-touch-icon.png" size="md" />
<Heading size="md">
<LinkOverlay as={RouterLink} to="/">
noStrudel
</LinkOverlay>
</Heading>
{offline && (
<IconButton
aria-label="Disable offline mode"
title="Disable offline mode"
icon={<WifiOff boxSize={5} color="orange" />}
onClick={() => offlineMode.next(false)}
/>
)}
</Flex>
{showBrandLogo && (
<Flex gap="2" alignItems="center" position="relative" my="2">
<Avatar src="/apple-touch-icon.png" size="md" />
<Heading size="md">
<LinkOverlay as={RouterLink} to="/">
noStrudel
</LinkOverlay>
</Heading>
{offline && (
<IconButton
aria-label="Disable offline mode"
title="Disable offline mode"
icon={<WifiOff boxSize={5} color="orange" />}
onClick={() => offlineMode.next(false)}
/>
)}
</Flex>
)}
{account && (
<>
<AccountSwitcher />

View File

@ -51,6 +51,9 @@ const addClientTag = new BooleanLocalStorageEntry("add-client-tag", false);
const verifyEventMethod = new LocalStorageEntry("verify-event-method", "wasm"); // wasm, internal, none
const enableKeyboardShortcuts = new BooleanLocalStorageEntry("enable-keyboard-shortcuts", true);
// display settings
const showBrandLogo = new BooleanLocalStorageEntry("show-brand-logo", true);
const localSettings = {
idbMaxEvents,
wasmPersistForDays,
@ -62,6 +65,7 @@ const localSettings = {
addClientTag,
verifyEventMethod,
enableKeyboardShortcuts,
showBrandLogo,
};
if (import.meta.env.DEV) {

View File

@ -23,6 +23,7 @@ export default function DisplaySettings() {
const hideZapBubbles = useSubject(localSettings.hideZapBubbles);
const enableNoteDrawer = useSubject(localSettings.enableNoteThreadDrawer);
const showBrandLogo = useSubject(localSettings.showBrandLogo);
return (
<VerticalPageLayout flex={1}>
@ -165,6 +166,21 @@ export default function DisplaySettings() {
<span>Enabled: Clicking on an embedded note will open it in a side drawer</span>
</FormHelperText>
</FormControl>
<FormControl>
<Flex alignItems="center">
<FormLabel htmlFor="showBrandLogo" mb="0">
Show noStrudel logo
</FormLabel>
<Switch
id="showBrandLogo"
isChecked={showBrandLogo}
onChange={(e) => localSettings.showBrandLogo.next(e.currentTarget.checked)}
/>
</Flex>
<FormHelperText>
<span>Show / Hide the noStrudel logo in the side nav</span>
</FormHelperText>
</FormControl>
<FormControl>
<FormLabel htmlFor="muted-words" mb="0">
Muted words