♻️(frontend) refactor notification preferences to use Field switch
Adopt unified switch component pattern for notification preferences to enable future addition of descriptive text per notification type, improving consistency and providing clearer explanation capability for notification behaviors.
This commit is contained in:
committed by
aleb_the_flash
parent
dbc66c2f07
commit
0c3bcd81c9
@@ -1,5 +1,5 @@
|
||||
import { TabPanel, TabPanelProps } from '@/primitives/Tabs'
|
||||
import { H, Switch } from '@/primitives'
|
||||
import { Field, H } from '@/primitives'
|
||||
import { css } from '@/styled-system/css'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSnapshot } from 'valtio'
|
||||
@@ -23,15 +23,19 @@ export const NotificationsTab = ({ id }: NotificationsTabProps) => {
|
||||
{Array.from(notificationsSnap.soundNotifications).map(
|
||||
([key, value]) => (
|
||||
<li key={key}>
|
||||
<Switch
|
||||
aria-label={`${t(`actions.${value ? 'disable' : 'enable'}`)} ${t('label')} "${t(`items.${key}`)}"`}
|
||||
<Field
|
||||
type="switch"
|
||||
aria-label={`${t(`actions.${value ? 'disable' : 'enable'}`)} ${t('label')} "${t(`items.${key}.label`)}"`}
|
||||
label={t(`items.${key}.label`)}
|
||||
isSelected={value}
|
||||
onChange={(v) => {
|
||||
notificationsStore.soundNotifications.set(key, v)
|
||||
}}
|
||||
>
|
||||
{t(`items.${key}`)}
|
||||
</Switch>
|
||||
wrapperProps={{
|
||||
noMargin: true,
|
||||
fullWidth: true,
|
||||
}}
|
||||
/>
|
||||
</li>
|
||||
)
|
||||
)}
|
||||
|
||||
@@ -76,9 +76,15 @@
|
||||
"enable": "Aktivieren"
|
||||
},
|
||||
"items": {
|
||||
"participantJoined": "Teilnehmer beigetreten",
|
||||
"handRaised": "Hand gehoben",
|
||||
"messageReceived": "Nachricht erhalten"
|
||||
"participantJoined": {
|
||||
"label": "Teilnehmer beigetreten"
|
||||
},
|
||||
"handRaised": {
|
||||
"label": "Hand gehoben"
|
||||
},
|
||||
"messageReceived": {
|
||||
"label": "Nachricht erhalten"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dialog": {
|
||||
|
||||
@@ -76,9 +76,15 @@
|
||||
"enable": "Enable"
|
||||
},
|
||||
"items": {
|
||||
"participantJoined": "Participant joined",
|
||||
"handRaised": "Hand raised",
|
||||
"messageReceived": "Message received"
|
||||
"participantJoined": {
|
||||
"label": "Participant joined"
|
||||
},
|
||||
"handRaised": {
|
||||
"label": "Hand raised"
|
||||
},
|
||||
"messageReceived": {
|
||||
"label": "Message received"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dialog": {
|
||||
|
||||
@@ -76,9 +76,15 @@
|
||||
"enable": "Activer"
|
||||
},
|
||||
"items": {
|
||||
"participantJoined": "Un nouveau participant",
|
||||
"handRaised": "Une main levée",
|
||||
"messageReceived": "Un message reçu"
|
||||
"participantJoined": {
|
||||
"label": "Un nouveau participant"
|
||||
},
|
||||
"handRaised": {
|
||||
"label": "Une main levée"
|
||||
},
|
||||
"messageReceived": {
|
||||
"label": "Un message reçu"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dialog": {
|
||||
|
||||
@@ -76,9 +76,15 @@
|
||||
"enable": "Inschakelen"
|
||||
},
|
||||
"items": {
|
||||
"participantJoined": "Deelnemer is toegevoegd",
|
||||
"handRaised": "Hand opgestoken",
|
||||
"messageReceived": "Bericht ontvangen"
|
||||
"participantJoined": {
|
||||
"label": "Deelnemer is toegevoegd"
|
||||
},
|
||||
"handRaised": {
|
||||
"label": "Hand opgestoken"
|
||||
},
|
||||
"messageReceived": {
|
||||
"label": "Bericht ontvangen"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dialog": {
|
||||
|
||||
Reference in New Issue
Block a user