Add render changes

This commit is contained in:
Gigiaj 2025-06-08 20:45:43 -05:00
parent e2fbf9e738
commit a271a5647e

View file

@ -189,20 +189,23 @@ function WebPushNotificationSetting() {
}
export function SystemNotification() {
const notifPermission = usePermissionState('notifications', getNotificationState());
const [showNotifications, setShowNotifications] = useSetting(settingsAtom, 'showNotifications');
const [showInAppNotifs, setShowInAppNotifs] = useSetting(settingsAtom, 'showNotifications');
const [isNotificationSounds, setIsNotificationSounds] = useSetting(
settingsAtom,
'isNotificationSounds'
);
const requestNotificationPermission = () => {
window.Notification.requestPermission();
};
return (
<Box direction="Column" gap="100">
<Text size="L400">System</Text>
<Text size="L400">System & Notifications</Text>
<SequenceCard
className={SequenceCardStyle}
variant="SurfaceVariant"
direction="Column"
gap="400"
>
<WebPushNotificationSetting />
</SequenceCard>
<SequenceCard
className={SequenceCardStyle}
variant="SurfaceVariant"
@ -210,31 +213,9 @@ export function SystemNotification() {
gap="400"
>
<SettingTile
title="Desktop Notifications"
description={
notifPermission === 'denied' ? (
<Text as="span" style={{ color: color.Critical.Main }} size="T200">
{'Notification' in window
? 'Notification permission is blocked. Please allow notification permission from browser address bar.'
: 'Notifications are not supported by the system.'}
</Text>
) : (
<span>Show desktop notifications when message arrive.</span>
)
}
after={
notifPermission === 'prompt' ? (
<Button size="300" radii="300" onClick={requestNotificationPermission}>
<Text size="B300">Enable</Text>
</Button>
) : (
<Switch
disabled={notifPermission !== 'granted'}
value={showNotifications}
onChange={setShowNotifications}
/>
)
}
title="In-App Notifications"
description="Show a notification when a message arrives while the app is open (but not focused on the room)."
after={<Switch value={showInAppNotifs} onChange={setShowInAppNotifs} />}
/>
</SequenceCard>
<SequenceCard
@ -245,7 +226,7 @@ export function SystemNotification() {
>
<SettingTile
title="Notification Sound"
description="Play sound when new message arrive."
description="Play sound when new message arrives and app is open."
after={<Switch value={isNotificationSounds} onChange={setIsNotificationSounds} />}
/>
</SequenceCard>