mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-01 11:32:22 +03:00
Merge remote-tracking branch 'origin/lf/fix-hardcoding' into philip/hotfix
This commit is contained in:
commit
84453c13d5
@ -1,5 +1,5 @@
|
||||
|%
|
||||
+$ bump [%kiln-bump except=(set desk) force=_|]
|
||||
+$ bump [except=(set desk) force=_|]
|
||||
--
|
||||
|_ b=bump
|
||||
++ grad %noun
|
||||
@ -9,7 +9,6 @@
|
||||
++ json
|
||||
^- $-(^json bump)
|
||||
=, dejs:format
|
||||
%+ pe %kiln-bump
|
||||
%- ot
|
||||
:~ except+(as so)
|
||||
force+bo
|
||||
|
@ -12,7 +12,7 @@ function renderNotification(notification: Notification, key: string, lid: HarkLi
|
||||
if (notification.bin.place.path === '/lag') {
|
||||
return <RuntimeLagNotification key={key} />;
|
||||
}
|
||||
if (notification.bin.place.path === '/blocked') {
|
||||
if (notification.bin.path === '/blocked' && notification.bin.place.path === '/desk/base') {
|
||||
return <BaseBlockedNotification key={key} />;
|
||||
}
|
||||
if (notification.bin.place.path === '/onboard') {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { pick } from 'lodash';
|
||||
import { pick, pickBy, partition } from 'lodash';
|
||||
import React, { useCallback } from 'react';
|
||||
import { kilnBump } from '@urbit/api/hood';
|
||||
import { AppList } from '../../components/AppList';
|
||||
@ -7,9 +7,11 @@ import { Dialog, DialogClose, DialogContent, DialogTrigger } from '../../compone
|
||||
import { Elbow } from '../../components/icons/Elbow';
|
||||
import api from '../../state/api';
|
||||
import { useCharges } from '../../state/docket';
|
||||
import useKilnState, { useVat } from '../../state/kiln';
|
||||
|
||||
import { NotificationButton } from './NotificationButton';
|
||||
import { disableDefault } from '../../state/util';
|
||||
import { Vat } from '../../../../npm/api/dist';
|
||||
|
||||
export const RuntimeLagNotification = () => (
|
||||
<section
|
||||
@ -35,10 +37,21 @@ export const RuntimeLagNotification = () => (
|
||||
</section>
|
||||
);
|
||||
|
||||
function vatIsBlocked(newKelvin: number, vat: Vat) {
|
||||
return !(vat.arak?.rail?.next || []).find(({ aeon, weft }) => weft.kelvin === newKelvin);
|
||||
}
|
||||
|
||||
export const BaseBlockedNotification = () => {
|
||||
const desks: string[] = [];
|
||||
const base = useVat('base');
|
||||
// TODO: assert weft.name === 'zuse'??
|
||||
const newKelvin = base?.arak?.rail?.next?.[0]?.weft?.kelvin || 420;
|
||||
const charges = useCharges();
|
||||
const blockedCharges = Object.values(pick(charges, desks));
|
||||
const [blocked, unblocked] = useKilnState((s) => {
|
||||
const [b, u] = partition(Object.entries(s.vats), ([desk, vat]) => vatIsBlocked(newKelvin, vat));
|
||||
return [b.map(([d]) => d), u.map(([d]) => d)] as const;
|
||||
});
|
||||
|
||||
const blockedCharges = Object.values(pick(charges, blocked));
|
||||
const count = blockedCharges.length;
|
||||
|
||||
const handlePauseOTAs = useCallback(() => {}, []);
|
||||
|
@ -241,7 +241,17 @@ function createMockSysNotification(path: string, body: HarkBody[] = []) {
|
||||
}
|
||||
|
||||
const lag = createMockSysNotification('/lag');
|
||||
const blocked = createMockSysNotification('/blocked');
|
||||
const blocked = {
|
||||
bin: {
|
||||
place: {
|
||||
desk: window.desk,
|
||||
path: '/desk/base'
|
||||
},
|
||||
path: '/blocked'
|
||||
},
|
||||
time: Date.now() - 3_600,
|
||||
body: []
|
||||
};
|
||||
const onboard = createMockSysNotification('/onboard');
|
||||
|
||||
const updateNotification = createMockSysNotification('/desk/bitcoin', [
|
||||
|
Loading…
Reference in New Issue
Block a user