From 0b72f3ed450563903fba9bb19e795aac134d7ede Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Mon, 16 Nov 2020 14:20:41 +1000 Subject: [PATCH] interface: do not mark unread on navigate --- .../src/views/apps/notifications/graph.tsx | 77 +++++++++++-------- .../src/views/apps/notifications/header.tsx | 4 +- 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/pkg/interface/src/views/apps/notifications/graph.tsx b/pkg/interface/src/views/apps/notifications/graph.tsx index c0ffa387fc..c3ded72159 100644 --- a/pkg/interface/src/views/apps/notifications/graph.tsx +++ b/pkg/interface/src/views/apps/notifications/graph.tsx @@ -1,7 +1,7 @@ import React, { ReactNode, useCallback } from "react"; import moment from "moment"; import { Row, Box, Col, Text, Anchor, Icon, Action } from "@tlon/indigo-react"; -import { Link } from "react-router-dom"; +import { Link, useHistory } from "react-router-dom"; import _ from "lodash"; import { Post, @@ -83,10 +83,10 @@ const GraphNodeContent = ({ contents, mod, description, index }) => { return ( - {header} + {header} - {snippet} + {snippet} { author = deSig(author); + const history = useHistory(); const img = ( { + if(!read) { + onRead(); + } + history.push(nodeUrl); + }, [read, onRead]); + return ( - - - {img} - - - - {cite(author)} - - - {moment(time).format("HH:mm")} - - - - - - - - + + {img} + + + + {cite(author)} + + + {moment(time).format("HH:mm")} + + + + + + + ); }; @@ -199,8 +207,9 @@ export function GraphNotification(props: { }, [api, timebox, index, read]); return ( - +
))} diff --git a/pkg/interface/src/views/apps/notifications/header.tsx b/pkg/interface/src/views/apps/notifications/header.tsx index 8499598fbd..b5d232eca8 100644 --- a/pkg/interface/src/views/apps/notifications/header.tsx +++ b/pkg/interface/src/views/apps/notifications/header.tsx @@ -37,7 +37,7 @@ export function Header(props: { read: boolean; associations: Associations; chat?: boolean; -}) { +} & PropFunc ) { const { description, channel, group, moduleIcon, read } = props; const contacts = props.contacts[group] || {}; @@ -71,7 +71,7 @@ export function Header(props: { channel; return ( - + {!props.archived && (