hark-fe: add read all button

This commit is contained in:
ryjm 2021-02-04 18:54:17 -05:00
parent a7934c1878
commit f5e4dc2423
3 changed files with 52 additions and 31 deletions

View File

@ -76,6 +76,7 @@
set-dnd+bo
read-count+stats-index
read-each+read-graph-index
read-all+ul
==
--
::

View File

@ -109,6 +109,9 @@ export class HarkApi extends BaseApi<StoreState> {
seen() {
return this.harkAction({ seen: null });
}
readAll() {
return this.harkAction({ 'read-all': null });
}
mute(notif: IndexedNotification) {
if('graph' in notif.index && 'graph' in notif.notification.contents) {

View File

@ -40,6 +40,9 @@ export default function NotificationsScreen(props: any) {
const onSubmit = async (values: { groups: string }) => {
setFilter({ groups: values.groups ? [values.groups] : [] });
};
const onReadAll = useCallback(() => {
props.api.hark.readAll()
}, []);
const groupFilterDesc =
filter.groups.length === 0
? "All"
@ -81,6 +84,19 @@ export default function NotificationsScreen(props: any) {
</HeaderLink>
</Box>
</Row>
<Row
justifyContent="space-between">
<Box
mr="1"
overflow="hidden"
onClick={onReadAll}
cursor="pointer"
>
<Text mr="1" color="blue">
Mark All Read
</Text>
</Box>
<Dropdown
alignX="right"
alignY="top"
@ -115,6 +131,7 @@ export default function NotificationsScreen(props: any) {
</Box>
</Dropdown>
</Row>
</Row>
{view === "preferences" && (
<NotificationPreferences
graphConfig={props.notificationsGraphConfig}