grid: dismiss Base Blocked notice on Archive

This commit is contained in:
tomholford 2022-11-29 07:51:57 -08:00
parent d3474705a9
commit ae0febc832
2 changed files with 6 additions and 3 deletions

View File

@ -13,7 +13,7 @@ function renderNotification(notification: Notification, key: string, lid: HarkLi
return <RuntimeLagNotification key={key} />; return <RuntimeLagNotification key={key} />;
} }
if (notification.bin.path === '/blocked' && notification.bin.place.path === '/desk/base') { if (notification.bin.path === '/blocked' && notification.bin.place.path === '/desk/base') {
return <BaseBlockedNotification key={key} />; return <BaseBlockedNotification key={key} bin={notification.bin} lid={lid} />;
} }
if (notification.bin.place.path === '/onboard') { if (notification.bin.place.path === '/onboard') {
return <OnboardingNotification key={key} lid={lid} />; return <OnboardingNotification key={key} lid={lid} />;

View File

@ -1,6 +1,6 @@
import { pick, partition } from 'lodash'; import { pick, partition } from 'lodash';
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import { kilnBump, Pike } from '@urbit/api'; import { HarkBin, HarkLid, kilnBump, Pike } from '@urbit/api';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { AppList } from '../../components/AppList'; import { AppList } from '../../components/AppList';
import { Button } from '../../components/Button'; import { Button } from '../../components/Button';
@ -12,6 +12,7 @@ import useKilnState, { usePike } from '../../state/kiln';
import { NotificationButton } from './NotificationButton'; import { NotificationButton } from './NotificationButton';
import { disableDefault } from '../../state/util'; import { disableDefault } from '../../state/util';
import { useHarkStore } from '../../state/hark';
export const RuntimeLagNotification = () => ( export const RuntimeLagNotification = () => (
<section <section
@ -41,7 +42,7 @@ function pikeIsBlocked(newKelvin: number, pike: Pike) {
return !pike.wefts?.find(({ kelvin }) => kelvin === newKelvin); return !pike.wefts?.find(({ kelvin }) => kelvin === newKelvin);
} }
export const BaseBlockedNotification = () => { export const BaseBlockedNotification = ({ bin, lid }: { bin: HarkBin, lid: HarkLid }) => {
const basePike = usePike('base'); const basePike = usePike('base');
const { push } = useHistory(); const { push } = useHistory();
// TODO: assert weft.name === 'zuse'?? // TODO: assert weft.name === 'zuse'??
@ -68,6 +69,8 @@ export const BaseBlockedNotification = () => {
const handleArchiveApps = useCallback(async () => { const handleArchiveApps = useCallback(async () => {
await api.poke(kilnBump()); await api.poke(kilnBump());
await useHarkStore.getState().archiveNote(bin, lid);
push('/leap/upgrading'); push('/leap/upgrading');
}, []); }, []);