Updates stories toggle in settings

This commit is contained in:
Josh Perez 2022-10-03 19:56:10 -04:00 committed by GitHub
parent 458eb2ea81
commit 3e57cb8549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 17 deletions

View File

@ -5183,6 +5183,22 @@
"message": "Devices", "message": "Devices",
"description": "Label for Device list in call settings pane" "description": "Label for Device list in call settings pane"
}, },
"Preferences__turn-stories-on": {
"message": "Turn on stories",
"description": "Label to enable stories"
},
"Preferences__turn-stories-off": {
"message": "Turn off stories",
"description": "Label to disable stories"
},
"Preferences__turn-stories-off--action": {
"message": "Turn off",
"description": "Label in confirmation modal to disable stories"
},
"Preferences__turn-stories-off--body": {
"message": "You will no longer be able to share or view stories.",
"description": "Confirmation modal body for disabling stories"
},
"DialogUpdate--version-available": { "DialogUpdate--version-available": {
"message": "Update to version $version$ available", "message": "Update to version $version$ available",
"description": "Tooltip for new update available" "description": "Tooltip for new update available"

View File

@ -251,4 +251,8 @@
); );
} }
} }
&__stories-off {
min-width: 140px;
}
} }

View File

@ -290,6 +290,7 @@ export const Preferences = ({
const zoomSelectId = useUniqueId(); const zoomSelectId = useUniqueId();
const [confirmDelete, setConfirmDelete] = useState(false); const [confirmDelete, setConfirmDelete] = useState(false);
const [confirmStoriesOff, setConfirmStoriesOff] = useState(false);
const [page, setPage] = useState<Page>(Page.General); const [page, setPage] = useState<Page>(Page.General);
const [showSyncFailed, setShowSyncFailed] = useState(false); const [showSyncFailed, setShowSyncFailed] = useState(false);
const [nowSyncing, setNowSyncing] = useState(false); const [nowSyncing, setNowSyncing] = useState(false);
@ -976,23 +977,22 @@ export const Preferences = ({
</label> </label>
} }
right={ right={
<Select hasStoriesEnabled ? (
id={storiesId} <Button
onChange={value => { className="Preferences__stories-off"
onHasStoriesEnabledChanged(value === 'true'); onClick={() => setConfirmStoriesOff(true)}
}} variant={ButtonVariant.SecondaryDestructive}
options={[ >
{ {i18n('Preferences__turn-stories-off')}
text: i18n('on'), </Button>
value: 'true', ) : (
}, <Button
{ onClick={() => onHasStoriesEnabledChanged(true)}
text: i18n('off'), variant={ButtonVariant.Secondary}
value: 'false', >
}, {i18n('Preferences__turn-stories-on')}
]} </Button>
value={String(hasStoriesEnabled)} )
/>
} }
/> />
</SettingsRow> </SettingsRow>
@ -1038,6 +1038,24 @@ export const Preferences = ({
{i18n('deleteAllDataBody')} {i18n('deleteAllDataBody')}
</ConfirmationDialog> </ConfirmationDialog>
) : null} ) : null}
{confirmStoriesOff ? (
<ConfirmationDialog
dialogName="Preference.turnStoriesOff"
actions={[
{
action: () => onHasStoriesEnabledChanged(false),
style: 'negative',
text: i18n('Preferences__turn-stories-off--action'),
},
]}
i18n={i18n}
onClose={() => {
setConfirmStoriesOff(false);
}}
>
{i18n('Preferences__turn-stories-off--body')}
</ConfirmationDialog>
) : null}
</> </>
); );
} else if (page === Page.ChatColor) { } else if (page === Page.ChatColor) {