mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 10:21:31 +03:00
interface: surface and dismiss unread counts
This commit is contained in:
parent
1c939b4861
commit
887a12ba0c
@ -54,6 +54,7 @@ function GroupFeed(props) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
api.graph.getNewest(graphResource.ship, graphResource.name, 100);
|
api.graph.getNewest(graphResource.ship, graphResource.name, 100);
|
||||||
|
api.hark.markCountAsRead(association, '/', 'post');
|
||||||
}, [graphPath]);
|
}, [graphPath]);
|
||||||
|
|
||||||
if (!graphPath) {
|
if (!graphPath) {
|
||||||
|
@ -24,6 +24,7 @@ import { Workspace } from '~/types/workspace';
|
|||||||
import useGroupState from '~/logic/state/group';
|
import useGroupState from '~/logic/state/group';
|
||||||
import useMetadataState from '~/logic/state/metadata';
|
import useMetadataState from '~/logic/state/metadata';
|
||||||
import {IS_SAFARI} from '~/logic/lib/platform';
|
import {IS_SAFARI} from '~/logic/lib/platform';
|
||||||
|
import useHarkState from '~/logic/state/hark';
|
||||||
|
|
||||||
export function SidebarListHeader(props: {
|
export function SidebarListHeader(props: {
|
||||||
api: GlobalApi;
|
api: GlobalApi;
|
||||||
@ -54,15 +55,15 @@ export function SidebarListHeader(props: {
|
|||||||
|
|
||||||
const noun = (props.workspace?.type === 'messages') ? 'Messages' : 'Channels';
|
const noun = (props.workspace?.type === 'messages') ? 'Messages' : 'Channels';
|
||||||
|
|
||||||
const isFeedEnabled =
|
const feedPath = metadata?.config?.group?.resource;
|
||||||
metadata &&
|
|
||||||
metadata.config &&
|
const unreadCount = useHarkState(
|
||||||
metadata.config.group &&
|
s => s.unreads?.graph?.[feedPath ?? ""]?.["/"]?.unreads as number ?? 0
|
||||||
'resource' in metadata.config.group;
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
{( isFeedEnabled ) ? (
|
{( !!feedPath) ? (
|
||||||
<Row
|
<Row
|
||||||
flexShrink="0"
|
flexShrink="0"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
@ -87,7 +88,7 @@ export function SidebarListHeader(props: {
|
|||||||
props.history.push(`/~landscape${groupPath}/feed`);
|
props.history.push(`/~landscape${groupPath}/feed`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text>
|
<Text color={unreadCount > 0 ? 'blue' : 'black'}>
|
||||||
Group Feed
|
Group Feed
|
||||||
</Text>
|
</Text>
|
||||||
</Row>
|
</Row>
|
||||||
|
Loading…
Reference in New Issue
Block a user