add setting to disable mark as read confirmation (#1110)

This commit is contained in:
Athou
2023-08-03 08:46:43 +02:00
parent da6f2050f9
commit cb779ec494
37 changed files with 179 additions and 8 deletions

View File

@@ -91,6 +91,17 @@ export const changeAlwaysScrollToEntry = createAsyncThunk<
if (!settings) return
client.user.saveSettings({ ...settings, alwaysScrollToEntry })
})
export const changeMarkAllAsReadConfirmation = createAsyncThunk<
void,
boolean,
{
state: RootState
}
>("settings/markAllAsReadConfirmation", (markAllAsReadConfirmation, thunkApi) => {
const { settings } = thunkApi.getState().user
if (!settings) return
client.user.saveSettings({ ...settings, markAllAsReadConfirmation })
})
export const changeSharingSetting = createAsyncThunk<
void,
{ site: keyof SharingSettings; value: boolean },
@@ -151,6 +162,10 @@ export const userSlice = createSlice({
if (!state.settings) return
state.settings.alwaysScrollToEntry = action.meta.arg
})
builder.addCase(changeMarkAllAsReadConfirmation.pending, (state, action) => {
if (!state.settings) return
state.settings.markAllAsReadConfirmation = action.meta.arg
})
builder.addCase(changeSharingSetting.pending, (state, action) => {
if (!state.settings) return
state.settings.sharingSettings[action.meta.arg.site] = action.meta.arg.value
@@ -162,6 +177,7 @@ export const userSlice = createSlice({
changeShowRead.fulfilled,
changeScrollMarks.fulfilled,
changeAlwaysScrollToEntry.fulfilled,
changeMarkAllAsReadConfirmation.fulfilled,
changeSharingSetting.fulfilled
),
() => {

View File

@@ -202,6 +202,7 @@ export interface Settings {
customJs?: string
scrollSpeed: number
alwaysScrollToEntry: boolean
markAllAsReadConfirmation: boolean
sharingSettings: SharingSettings
}

View File

@@ -13,8 +13,27 @@ export function MarkAllAsReadButton(props: { iconSize: number }) {
const source = useAppSelector(state => state.entries.source)
const sourceLabel = useAppSelector(state => state.entries.sourceLabel)
const entriesTimestamp = useAppSelector(state => state.entries.timestamp) ?? Date.now()
const markAllAsReadConfirmation = useAppSelector(state => state.user.settings?.markAllAsReadConfirmation)
const dispatch = useAppDispatch()
const buttonClicked = () => {
if (markAllAsReadConfirmation) {
setThreshold(0)
setOpened(true)
} else {
dispatch(
markAllEntries({
sourceType: source.type,
req: {
id: source.id,
read: true,
olderThan: entriesTimestamp,
},
})
)
}
}
return (
<>
<Modal opened={opened} onClose={() => setOpened(false)} title={<Trans>Mark all entries as read</Trans>}>
@@ -70,14 +89,7 @@ export function MarkAllAsReadButton(props: { iconSize: number }) {
</Group>
</Stack>
</Modal>
<ActionButton
icon={<TbChecks size={props.iconSize} />}
label={<Trans>Mark all as read</Trans>}
onClick={() => {
setThreshold(0)
setOpened(true)
}}
/>
<ActionButton icon={<TbChecks size={props.iconSize} />} label={<Trans>Mark all as read</Trans>} onClick={buttonClicked} />
</>
)
}

View File

@@ -4,6 +4,7 @@ import { Constants } from "app/constants"
import {
changeAlwaysScrollToEntry,
changeLanguage,
changeMarkAllAsReadConfirmation,
changeScrollMarks,
changeScrollSpeed,
changeSharingSetting,
@@ -19,6 +20,7 @@ export function DisplaySettings() {
const showRead = useAppSelector(state => state.user.settings?.showRead)
const scrollMarks = useAppSelector(state => state.user.settings?.scrollMarks)
const alwaysScrollToEntry = useAppSelector(state => state.user.settings?.alwaysScrollToEntry)
const markAllAsReadConfirmation = useAppSelector(state => state.user.settings?.markAllAsReadConfirmation)
const sharingSettings = useAppSelector(state => state.user.settings?.sharingSettings)
const dispatch = useAppDispatch()
@@ -58,6 +60,12 @@ export function DisplaySettings() {
onChange={e => dispatch(changeScrollMarks(e.currentTarget.checked))}
/>
<Switch
label={<Trans>Show confirmation when marking all entries as read</Trans>}
checked={markAllAsReadConfirmation}
onChange={e => dispatch(changeMarkAllAsReadConfirmation(e.currentTarget.checked))}
/>
<Divider label={<Trans>Sharing sites</Trans>} labelPosition="center" />
<SimpleGrid cols={2}>

View File

@@ -727,6 +727,10 @@ msgstr "مشاركة المواقع"
msgid "Shift"
msgstr "الحلقة"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Compartir llocs"
msgid "Shift"
msgstr "canvi"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Stránky pro sdílení"
msgid "Shift"
msgstr "Směna"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Rhannu gwefannau"
msgid "Shift"
msgstr "shifft"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Delingssider"
msgid "Shift"
msgstr "Skift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Seiten teilen"
msgid "Shift"
msgstr "Verschiebung"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Sharing sites"
msgid "Shift"
msgstr "Shift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr "Show confirmation when marking all entries as read"
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr "Show entry menu (desktop)"

View File

@@ -727,6 +727,10 @@ msgstr "Compartir sitios"
msgid "Shift"
msgstr "Cambio"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "اشتراک گذاری سایت ها"
msgid "Shift"
msgstr "شیفت"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Sivustojen jakaminen"
msgid "Shift"
msgstr "Vaihto"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Sites de partage"
msgid "Shift"
msgstr "Maj"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr "Afficher les options de l'entrée (ordinateur)"

View File

@@ -727,6 +727,10 @@ msgstr "Compartir sitios"
msgid "Shift"
msgstr "quendas"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Webhelyek megosztása"
msgid "Shift"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Berbagi situs"
msgid "Shift"
msgstr "Pergeseran"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Condivisione di siti"
msgid "Shift"
msgstr "Cambio"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "共有サイト"
msgid "Shift"
msgstr "シフト"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "사이트 공유"
msgid "Shift"
msgstr "시프트"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Berkongsi tapak"
msgid "Shift"
msgstr "Anjakan"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Delingssider"
msgid "Shift"
msgstr "Skift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Sites delen"
msgid "Shift"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Delingssider"
msgid "Shift"
msgstr "Skift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Udostępnianie witryn"
msgid "Shift"
msgstr "zmiana"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Compartilhando sites"
msgid "Shift"
msgstr "Mudar"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Обмен сайтами"
msgid "Shift"
msgstr "Сдвиг"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Zdieľanie stránok"
msgid "Shift"
msgstr "Smena"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Delningssajter"
msgid "Shift"
msgstr "Skift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Siteleri paylaşma"
msgid "Shift"
msgstr "Vardiya"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "共享站点"
msgid "Shift"
msgstr "换档"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""
#: src/components/KeyboardShortcutsHelp.tsx
msgid "Show entry menu (desktop)"
msgstr ""