mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
hark: cleanup edges
This commit is contained in:
parent
b532e629f3
commit
4267f69e3c
@ -50,7 +50,7 @@
|
||||
::
|
||||
%commit
|
||||
?. |(=(desk.diff %base) ~(has-docket de:cc desk.diff)) `this
|
||||
=/ =action:hark ~(updated de:cc desk.diff)
|
||||
=/ =action:hark ~(commit de:cc desk.diff)
|
||||
:_ this
|
||||
~[(poke:ha:cc action)]
|
||||
::
|
||||
@ -118,6 +118,8 @@
|
||||
++ docket .^(docket:^docket %cx scry-path)
|
||||
++ hash .^(@uv %cz (scry:io desk ~))
|
||||
++ place `place:hark`[q.byk.bowl /desk/[desk]]
|
||||
++ vat
|
||||
.^(vat:hood %gx (scry:io %hood /kiln/vat/[desk]/noun))
|
||||
++ body
|
||||
|= [=path title=cord content=(unit cord)]
|
||||
^- body:hark
|
||||
@ -137,6 +139,15 @@
|
||||
(rap 3 'version: ' (ver version:docket) ~)
|
||||
(rap 3 'hash: ' (scot %uv hash) ~)
|
||||
::
|
||||
++ commit
|
||||
^- action:hark
|
||||
?:(=(1 ud.cass:vat) created updated)
|
||||
::
|
||||
++ created
|
||||
^- action:hark
|
||||
:+ %add-note [/created place]
|
||||
(body /desk/[desk] (title-prefix ' has been installed') ~)
|
||||
::
|
||||
++ updated
|
||||
^- action:hark
|
||||
:+ %add-note [/update place]
|
||||
|
@ -23,6 +23,7 @@
|
||||
%unread-count (unread-count +.upd)
|
||||
%saw-place (saw-place +.upd)
|
||||
%all-stats (all-stats +.upd)
|
||||
%del-place (place +.upd)
|
||||
::%read-note (index +.upd)
|
||||
::%note-read (note-read +.upd)
|
||||
%archived (archived +.upd)
|
||||
|
@ -71,9 +71,11 @@ export const BasicNotification = ({ notification, lid }: BasicNotificationProps)
|
||||
<h2 id={`${id}-title`} className="note-grid-head font-semibold text-gray-600">
|
||||
<NotificationText contents={first.title} />
|
||||
</h2>
|
||||
<div className="note-grid-actions hidden justify-center self-center group-hover:flex">
|
||||
<Button onClick={archiveNoFollow}>Archive</Button>
|
||||
</div>
|
||||
{!('time' in lid) ? (
|
||||
<div className="note-grid-actions hidden justify-center self-center group-hover:flex">
|
||||
<Button onClick={archiveNoFollow}>Archive</Button>
|
||||
</div>
|
||||
) : null}
|
||||
</header>
|
||||
{contents.length > 0 ? (
|
||||
<div className="note-grid-body space-y-2">
|
||||
|
@ -81,6 +81,10 @@ export const useHarkStore = createState<HarkState>(
|
||||
set(newState);
|
||||
},
|
||||
archiveAll: async () => {
|
||||
get().set((draft) => {
|
||||
draft.unseen = {};
|
||||
draft.seen = {};
|
||||
});
|
||||
await api.poke(archiveAll);
|
||||
},
|
||||
archiveNote: async (bin, lid) => {
|
||||
@ -189,6 +193,23 @@ function reduceHark(u: any) {
|
||||
delete draft.unseen[bin];
|
||||
});
|
||||
});
|
||||
} else if ('del-place' in u) {
|
||||
const { path, desk } = u['del-place'];
|
||||
const pathId = `${desk}${path}`;
|
||||
const wipeBox = (t: Timebox) => {
|
||||
Object.keys(t).forEach((bin) => {
|
||||
if (bin.startsWith(pathId)) {
|
||||
delete t[bin];
|
||||
}
|
||||
});
|
||||
};
|
||||
set((draft) => {
|
||||
wipeBox(draft.unseen);
|
||||
wipeBox(draft.seen);
|
||||
draft.archive.keys().forEach((key) => {
|
||||
wipeBox(draft.archive.get(key)!);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user