import { Trans } from "@lingui/macro" import { Button, Code, Group, Modal, Slider, Stack, Text } from "@mantine/core" import { markAllEntries } from "app/slices/entries" import { useAppDispatch, useAppSelector } from "app/store" import { ActionButton } from "components/ActionButtton" import { useState } from "react" import { TbChecks } from "react-icons/tb" export function MarkAllAsReadButton(props: { iconSize: number }) { const [opened, setOpened] = useState(false) const [threshold, setThreshold] = useState(0) const source = useAppSelector(state => state.entries.source) const sourceLabel = useAppSelector(state => state.entries.sourceLabel) const entriesTimestamp = useAppSelector(state => state.entries.timestamp) ?? Date.now() const dispatch = useAppDispatch() return ( <> setOpened(false)} title={Mark all entries as read}> {threshold === 0 && ( Are you sure you want to mark all entries of {sourceLabel} as read? )} {threshold > 0 && ( Are you sure you want to mark entries older than {threshold} days of {sourceLabel} as read? )} } label={Mark all as read} onClick={() => { setThreshold(0) setOpened(true) }} /> ) }