9 changed files with 125 additions and 56 deletions
@ -1,33 +0,0 @@ |
|||||||
import { Label } from '@/components/ui/label' |
|
||||||
import { Switch } from '@/components/ui/switch' |
|
||||||
import storage from '@/services/local-storage.service' |
|
||||||
import { useEffect, useState } from 'react' |
|
||||||
import { useTranslation } from 'react-i18next' |
|
||||||
|
|
||||||
export default function PublishSuccessToastSetting() { |
|
||||||
const { t } = useTranslation() |
|
||||||
const [enabled, setEnabled] = useState(true) |
|
||||||
|
|
||||||
useEffect(() => { |
|
||||||
setEnabled(storage.getShowPublishSuccessToasts()) |
|
||||||
}, []) |
|
||||||
|
|
||||||
const onChange = (checked: boolean) => { |
|
||||||
setEnabled(checked) |
|
||||||
storage.setShowPublishSuccessToasts(checked) |
|
||||||
} |
|
||||||
|
|
||||||
return ( |
|
||||||
<div className="space-y-2"> |
|
||||||
<div className="flex items-center space-x-2"> |
|
||||||
<Label htmlFor="publish-success-toasts">{t('Publish success toasts')}</Label> |
|
||||||
<Switch id="publish-success-toasts" checked={enabled} onCheckedChange={onChange} /> |
|
||||||
</div> |
|
||||||
<div className="text-muted-foreground text-xs max-w-xl"> |
|
||||||
{t( |
|
||||||
'Show green notifications when posts, replies, reactions, and other publishes succeed. When off, a small checkmark appears briefly at the bottom-right instead. Errors and failures still use a toast.' |
|
||||||
)} |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
) |
|
||||||
} |
|
||||||
@ -0,0 +1,64 @@ |
|||||||
|
import { Label } from '@/components/ui/label' |
||||||
|
import { Switch } from '@/components/ui/switch' |
||||||
|
import storage from '@/services/local-storage.service' |
||||||
|
import { useEffect, useState } from 'react' |
||||||
|
import { useTranslation } from 'react-i18next' |
||||||
|
|
||||||
|
export default function PublishingFeedbackSettings() { |
||||||
|
const { t } = useTranslation() |
||||||
|
const [successToasts, setSuccessToasts] = useState(false) |
||||||
|
const [detailedToasts, setDetailedToasts] = useState(true) |
||||||
|
|
||||||
|
useEffect(() => { |
||||||
|
setSuccessToasts(storage.getShowPublishSuccessToasts()) |
||||||
|
setDetailedToasts(storage.getShowDetailedPublishToasts()) |
||||||
|
}, []) |
||||||
|
|
||||||
|
const onSuccessChange = (checked: boolean) => { |
||||||
|
setSuccessToasts(checked) |
||||||
|
storage.setShowPublishSuccessToasts(checked) |
||||||
|
} |
||||||
|
|
||||||
|
const onDetailedChange = (checked: boolean) => { |
||||||
|
setDetailedToasts(checked) |
||||||
|
storage.setShowDetailedPublishToasts(checked) |
||||||
|
} |
||||||
|
|
||||||
|
return ( |
||||||
|
<div className="space-y-4"> |
||||||
|
<div className="space-y-2"> |
||||||
|
<div className="flex items-center space-x-2"> |
||||||
|
<Label htmlFor="publish-success-toasts" className="text-base font-normal"> |
||||||
|
{t('Publish success toasts')} |
||||||
|
</Label> |
||||||
|
<Switch id="publish-success-toasts" checked={successToasts} onCheckedChange={onSuccessChange} /> |
||||||
|
</div> |
||||||
|
<p className="text-muted-foreground text-xs max-w-xl"> |
||||||
|
{t('Publish success toasts hint')} |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
|
||||||
|
{successToasts ? ( |
||||||
|
<div className="space-y-2 pl-4 border-l-2 border-border"> |
||||||
|
<div className="flex items-center space-x-2"> |
||||||
|
<Label htmlFor="detailed-publish-toasts" className="text-base font-normal"> |
||||||
|
{t('Publish toast per-relay details')} |
||||||
|
</Label> |
||||||
|
<Switch |
||||||
|
id="detailed-publish-toasts" |
||||||
|
checked={detailedToasts} |
||||||
|
onCheckedChange={onDetailedChange} |
||||||
|
/> |
||||||
|
</div> |
||||||
|
<p className="text-muted-foreground text-xs max-w-xl"> |
||||||
|
{t('Publish toast per-relay details hint')} |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
) : null} |
||||||
|
|
||||||
|
<p className="text-muted-foreground text-xs max-w-xl border-t border-border pt-3"> |
||||||
|
{t('Publishing feedback errors note')} |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
) |
||||||
|
} |
||||||
Loading…
Reference in new issue