interface: rename to dm-inbox

This commit is contained in:
Liam Fitzgerald 2021-05-10 13:26:50 +10:00
parent 6223430ee3
commit 1af5630bcc
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
6 changed files with 12 additions and 12 deletions

View File

@ -207,7 +207,7 @@ export default class GraphApi extends BaseApi<StoreState> {
const post = createPost(contents, `/${patp2dec(ship)}`)
return this.action('dm-hook', 'graph-update-2', {
"add-nodes": {
resource: { ship: `~${window.ship}`, name: 'inbox' },
resource: { ship: `~${window.ship}`, name: 'dm-inbox' },
nodes: {
[post.index]: {
post,

View File

@ -152,7 +152,7 @@ export function useGraphForAssoc(association: Association) {
window.useGraphState = useGraphState;
export function useInbox() {
return useGraphState(s => s.graphs[`${window.ship}/inbox`] || new BigIntOrderedMap());
return useGraphState(s => s.graphs[`${window.ship}/dm-inbox`] || new BigIntOrderedMap());
}
export function useDM(ship: string) {

View File

@ -69,7 +69,7 @@ const useHarkState = createState<HarkState>('Hark', {
export function useHarkDm(ship: string) {
return useHarkState(useCallback(s => {
return s.unreads.graph[`/ship/~${window.ship}/inbox`]?.[`/${patp2dec(ship)}`];
return s.unreads.graph[`/ship/~${window.ship}/dm-inbox`]?.[`/${patp2dec(ship)}`];
}, [ship]));
}

View File

@ -98,7 +98,7 @@ class App extends React.Component {
componentDidMount() {
this.subscription.start();
this.api.graph.getShallowChildren(`~${window.ship}`, 'inbox');
this.api.graph.getShallowChildren(`~${window.ship}`, 'dm-inbox');
this.themeWatcher = window.matchMedia('(prefers-color-scheme: dark)');
this.themeWatcher.onchange = this.updateTheme;
setTimeout(() => {

View File

@ -18,7 +18,7 @@ interface DmResourceProps {
const getCurrDmSize = (ship: string) => {
const { graphs } = useGraphState.getState();
const graph = graphs[`${window.ship}/inbox`];
const graph = graphs[`${window.ship}/dm-inbox`];
if (!graph) {
return 0;
}
@ -37,7 +37,7 @@ export function DmResource(props: DmResourceProps) {
const nickname = showNickname ? contact!.nickname : cite(ship) ?? ship;
useEffect(() => {
api.graph.getNewest(`~${window.ship}`, 'inbox', 100, `/${patpToUd(ship)}`);
api.graph.getNewest(`~${window.ship}`, 'dm-inbox', 100, `/${patpToUd(ship)}`);
}, [ship]);
const fetchMessages = useCallback(
@ -51,9 +51,9 @@ export function DmResource(props: DmResourceProps) {
}
await api.graph.getYoungerSiblings(
`~${window.ship}`,
'inbox',
'dm-inbox',
pageSize,
`/${patp2dec(ship)}/${index.toString()}`
`/${patpToUd(ship)}/${index.toString()}`
);
return expectedSize !== getCurrDmSize(ship);
} else {
@ -63,9 +63,9 @@ export function DmResource(props: DmResourceProps) {
}
await api.graph.getOlderSiblings(
`~${window.ship}`,
'inbox',
'dm-inbox',
pageSize,
`/${patp2dec(ship)}/${index.toString()}`
`/${patpToUd(ship)}/${index.toString()}`
);
return expectedSize !== getCurrDmSize(ship);
}
@ -74,7 +74,7 @@ export function DmResource(props: DmResourceProps) {
);
const dismissUnread = useCallback(() => {
api.hark.dismissReadCount(`/ship/~${window.ship}/inbox`, `/${patp2dec(ship)}`);
api.hark.dismissReadCount(`/ship/~${window.ship}/dm-inbox`, `/${patpToUd(ship)}`);
}, [ship]);

View File

@ -86,7 +86,7 @@ export function SidebarList(props: {
const { selected, group, config, workspace } = props;
const associations = useMetadataState(state => state.associations);
const inbox = useInbox();
const unreads = useHarkState(s => s.unreads.graph?.[`/ship/~${window.ship}/inbox`]);
const unreads = useHarkState(s => s.unreads.graph?.[`/ship/~${window.ship}/dm-inbox`]);
const ordered = getItems(associations, workspace, inbox)