feat(settings): add Show Unread Counts toggle to Visual Tweaks
Hides numeric counts on room and sidebar badges while keeping the dot indicator active. Defaults to on. Exposed in both Appearance and Cosmetics settings panels.
This commit is contained in:
1 parent
c2a43ec43a
commit
3a4961e774
4 files changed
+28
-2
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { CSSProperties, ReactNode } from 'react';
|
||||
import { Box, Badge, toRem, Text } from 'folds';
|
||||
import { millify } from '$plugins/millify';
|
||||
import { useSetting } from '$state/hooks/settings';
|
||||
import { settingsAtom } from '$state/settings';
|
||||
|
||||
type UnreadBadgeProps = {
|
||||
highlight?: boolean;
|
||||
@@ -18,15 +20,17 @@ export function UnreadBadgeCenter({ children }: { children: ReactNode }) {
|
||||
}
|
||||
|
||||
export function UnreadBadge({ highlight, count }: UnreadBadgeProps) {
|
||||
const [showCounts] = useSetting(settingsAtom, 'showUnreadCounts');
|
||||
const showNumber = showCounts && count > 0;
|
||||
return (
|
||||
<Badge
|
||||
variant={highlight ? 'Success' : 'Secondary'}
|
||||
size={count > 0 ? '400' : '200'}
|
||||
size={showNumber ? '400' : '200'}
|
||||
fill="Solid"
|
||||
radii="Pill"
|
||||
outlined={false}
|
||||
>
|
||||
{count > 0 && (
|
||||
{showNumber && (
|
||||
<Text as="span" size="L400">
|
||||
{millify(count)}
|
||||
</Text>
|
||||
|
||||
@@ -171,6 +171,7 @@ function IdentityCosmetics() {
|
||||
);
|
||||
const [uniformIcons, setUniformIcons] = useSetting(settingsAtom, 'uniformIcons');
|
||||
const [rightBubbles, setRightBubbles] = useSetting(settingsAtom, 'useRightBubbles');
|
||||
const [showUnreadCounts, setShowUnreadCounts] = useSetting(settingsAtom, 'showUnreadCounts');
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
@@ -218,6 +219,15 @@ function IdentityCosmetics() {
|
||||
after={<Switch variant="Primary" value={rightBubbles} onChange={setRightBubbles} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Show Unread Counts"
|
||||
description="Display the number of unread messages on room and sidebar badges."
|
||||
after={
|
||||
<Switch variant="Primary" value={showUnreadCounts} onChange={setShowUnreadCounts} />
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -327,6 +327,7 @@ function PageZoomInput() {
|
||||
}
|
||||
export function Appearance() {
|
||||
const [twitterEmoji, setTwitterEmoji] = useSetting(settingsAtom, 'twitterEmoji');
|
||||
const [showUnreadCounts, setShowUnreadCounts] = useSetting(settingsAtom, 'showUnreadCounts');
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="700">
|
||||
@@ -346,6 +347,15 @@ export function Appearance() {
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile title="Page Zoom" after={<PageZoomInput />} />
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Show Unread Counts"
|
||||
description="Display the number of unread messages on room and sidebar badges."
|
||||
after={
|
||||
<Switch variant="Primary" value={showUnreadCounts} onChange={setShowUnreadCounts} />
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -67,6 +67,7 @@ export interface Settings {
|
||||
rightSwipeAction: RightSwipeAction;
|
||||
hideMembershipInReadOnly: boolean;
|
||||
useRightBubbles: boolean;
|
||||
showUnreadCounts: boolean;
|
||||
}
|
||||
|
||||
const defaultSettings: Settings = {
|
||||
@@ -120,6 +121,7 @@ const defaultSettings: Settings = {
|
||||
rightSwipeAction: RightSwipeAction.Reply,
|
||||
hideMembershipInReadOnly: true,
|
||||
useRightBubbles: false,
|
||||
showUnreadCounts: true,
|
||||
};
|
||||
|
||||
export const getSettings = () => {
|
||||
|
||||
Reference in new issue
Block a user