diff --git a/pkg/arvo/mar/kiln/pause.hoon b/pkg/arvo/mar/kiln/pause.hoon new file mode 100644 index 0000000000..335cd95800 --- /dev/null +++ b/pkg/arvo/mar/kiln/pause.hoon @@ -0,0 +1,13 @@ +|_ =desk +++ grad %noun +++ grow + |% + ++ noun desk + ++ json s+desk + -- +++ grab + |% + ++ noun ^desk + ++ json so:dejs:format + -- +-- diff --git a/pkg/arvo/mar/kiln/resume.hoon b/pkg/arvo/mar/kiln/resume.hoon new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 99bc72d7ba..6de54e5716 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -243,6 +243,7 @@ %- pairs :~ ship+s+(scot %p ship.rail.a) desk+s+desk.rail.a + paused+b+paused.rail.a aeon+(numb aeon.rail.a) next+a+(turn next.a rung) rein+(rein rein.a) diff --git a/pkg/bitcoin/desk.docket b/pkg/bitcoin/desk.docket index 32cd059b55..2dd49e7340 100644 --- a/pkg/bitcoin/desk.docket +++ b/pkg/bitcoin/desk.docket @@ -2,7 +2,7 @@ title+'Bitcoin' info+'BTC wallet for Urbit. Testing' color+0xf9.8e40 - glob-http+'https://bootstrap.urbit.org/glob-0v2.sl9s6.ud2bs.l9ft0.mstja.5f8kt.glob' + glob-http+'https://bootstrap.urbit.org/glob-0v4.ghaim.of1as.9ucee.uj93f.a9nbs.glob' image+'https://urbit.ewr1.vultrobjects.com/hastuc-dibtux/2021.8.24..02.57.38-bitcoin.svg' base+'bitcoin' version+[0 0 1] diff --git a/pkg/btc-wallet/config/webpack.prod.js b/pkg/btc-wallet/config/webpack.prod.js index 7f184e5473..fbdbae0590 100644 --- a/pkg/btc-wallet/config/webpack.prod.js +++ b/pkg/btc-wallet/config/webpack.prod.js @@ -55,7 +55,7 @@ module.exports = { filename: (pathData) => { return pathData.chunk.name === 'app' ? 'index.[contenthash].js' : '[name].js'; }, - path: path.resolve(__dirname, 'dist'), + path: path.resolve(__dirname, '../dist'), publicPath: '/apps/bitcoin/', }, optimization: { diff --git a/pkg/grid/src/app.tsx b/pkg/grid/src/app.tsx index 56a60c8561..a80df3de79 100644 --- a/pkg/grid/src/app.tsx +++ b/pkg/grid/src/app.tsx @@ -5,23 +5,25 @@ import { Grid } from './pages/Grid'; import useDocketState from './state/docket'; import { PermalinkRoutes } from './pages/PermalinkRoutes'; import useKilnState from './state/kiln'; -import { usePreferencesStore } from './nav/preferences/usePreferencesStore'; import useContactState from './state/contact'; import api from './state/api'; import { useMedia } from './logic/useMedia'; +import { useHarkStore } from './state/hark'; +import { useTheme } from './state/settings'; +import { useLocalState } from './state/local'; const AppRoutes = () => { const { push } = useHistory(); - const theme = usePreferencesStore((s) => s.theme); + const theme = useTheme(); const isDarkMode = useMedia('(prefers-color-scheme: dark)'); useEffect(() => { - if ((isDarkMode && theme === 'automatic') || theme === 'dark') { + if ((isDarkMode && theme === 'auto') || theme === 'dark') { document.body.classList.add('dark'); - usePreferencesStore.setState({ currentTheme: 'dark' }); + useLocalState.setState({ currentTheme: 'dark' }); } else { document.body.classList.remove('dark'); - usePreferencesStore.setState({ currentTheme: 'light' }); + useLocalState.setState({ currentTheme: 'light' }); } }, [isDarkMode, theme]); @@ -35,6 +37,7 @@ const AppRoutes = () => { fetchVats(); fetchLag(); useContactState.getState().initialize(api); + useHarkStore.getState().initialize(api); Mousetrap.bind(['command+/', 'ctrl+/'], () => { push('/leap/search'); diff --git a/pkg/grid/src/components/Avatar.tsx b/pkg/grid/src/components/Avatar.tsx index 736ea581f5..f0d0462d46 100644 --- a/pkg/grid/src/components/Avatar.tsx +++ b/pkg/grid/src/components/Avatar.tsx @@ -3,7 +3,7 @@ import React, { useMemo } from 'react'; import { sigil, reactRenderer } from '@tlon/sigil-js'; import { deSig, Contact } from '@urbit/api'; import { darken, lighten, parseToHsla } from 'color2k'; -import { usePreferencesStore } from '../nav/preferences/usePreferencesStore'; +import { useCurrentTheme } from '../state/local'; export type AvatarSizes = 'xs' | 'small' | 'default'; @@ -63,7 +63,7 @@ function themeAdjustColor(color: string, theme: 'light' | 'dark'): string { } export const Avatar = ({ size, className, ...ship }: AvatarProps) => { - const currentTheme = usePreferencesStore((s) => s.currentTheme); + const currentTheme = useCurrentTheme(); const { shipName, color, avatar } = { ...emptyContact, ...ship }; const { classes, size: sigilSize } = sizeMap[size]; const adjustedColor = themeAdjustColor(color, currentTheme); diff --git a/pkg/grid/src/components/Setting.tsx b/pkg/grid/src/components/Setting.tsx index dff93480fc..c0412b3b5d 100644 --- a/pkg/grid/src/components/Setting.tsx +++ b/pkg/grid/src/components/Setting.tsx @@ -20,14 +20,14 @@ export const Setting: FC = ({ name, on, toggle, className, childr

{name} {status === 'loading' && }

-
+
-
{children}
+
{children}
); diff --git a/pkg/grid/src/components/Toggle.tsx b/pkg/grid/src/components/Toggle.tsx index e6d3be2ff7..f9c31beeed 100644 --- a/pkg/grid/src/components/Toggle.tsx +++ b/pkg/grid/src/components/Toggle.tsx @@ -6,12 +6,13 @@ import type * as Polymorphic from '@radix-ui/react-polymorphic'; type ToggleComponent = Polymorphic.ForwardRefComponent< Polymorphic.IntrinsicElement, Polymorphic.OwnProps & { + toggleClass?: string; knobClass?: string; } >; export const Toggle = React.forwardRef( - ({ defaultPressed, pressed, onPressedChange, disabled, className }, ref) => { + ({ defaultPressed, pressed, onPressedChange, disabled, className, toggleClass }, ref) => { const [on, setOn] = useState(defaultPressed); const isControlled = !!onPressedChange; const proxyPressed = isControlled ? pressed : on; @@ -20,14 +21,14 @@ export const Toggle = React.forwardRef( return ( { - submenu: string; +interface SystemPreferencesSectionProps { + url: string; active: boolean; - text: string; - icon?: string; } function SystemPreferencesSection({ - match, - submenu, + url, active, - icon, - text -}: SystemPreferencesSectionProps) { + children +}: PropsWithChildren) { return (
  • - {icon ? : null} - {text} + {children}
  • ); @@ -39,53 +37,72 @@ function SystemPreferencesSection({ export const SystemPreferences = (props: RouteComponentProps<{ submenu: string }>) => { const { match } = props; - const subMatch = useRouteMatch<{ submenu: string }>(`${match.url}/:submenu`); + const subMatch = useRouteMatch<{ submenu: string; desk?: string }>( + `${match.url}/:submenu/:desk?` + ); + const charges = useCharges(); const matchSub = useCallback( - (target: string) => { + (target: string, desk?: string) => { if (!subMatch && target === 'notifications') { return true; } + if (desk && subMatch?.params.desk !== desk) { + return false; + } + return subMatch?.params.submenu === target; }, [match, subMatch] ); + const subUrl = useCallback((submenu: string) => `${match.url}/${submenu}`, [match]); + return (
    -
    diff --git a/pkg/grid/src/nav/preferences/SystemUpdatePrefs.tsx b/pkg/grid/src/nav/preferences/SystemUpdatePrefs.tsx index 31339bdce1..07252172ff 100644 --- a/pkg/grid/src/nav/preferences/SystemUpdatePrefs.tsx +++ b/pkg/grid/src/nav/preferences/SystemUpdatePrefs.tsx @@ -1,19 +1,30 @@ +import _ from 'lodash'; import React, { ChangeEvent, FormEvent, useCallback, useEffect, useState } from 'react'; import { Button } from '../../components/Button'; import { Setting } from '../../components/Setting'; import { ShipName } from '../../components/ShipName'; import { Spinner } from '../../components/Spinner'; import { useAsyncCall } from '../../logic/useAsyncCall'; -import { usePreferencesStore } from './usePreferencesStore'; +import useKilnState, { useVat } from '../../state/kiln'; export const SystemUpdatePrefs = () => { - const { otasEnabled, otaSource, toggleOTAs, setOTASource } = usePreferencesStore(); - const [source, setSource] = useState(otaSource); + const { changeOTASource, toggleOTAs } = useKilnState((s) => + _.pick(s, ['toggleOTAs', 'changeOTASource']) + ); + const base = useVat('base'); + const otasEnabled = base && !base.arak.paused; + const otaSource = base?.arak.ship; + + const toggleBase = useCallback((on: boolean) => toggleOTAs('base', on), [toggleOTAs]); + + const [source, setSource] = useState(''); const sourceDirty = source !== otaSource; - const { status: sourceStatus, call: setOTA } = useAsyncCall(setOTASource); + const { status: sourceStatus, call: setOTA } = useAsyncCall(changeOTASource); useEffect(() => { - setSource(otaSource); + if (otaSource) { + setSource(otaSource); + } }, [otaSource]); const handleSourceChange = useCallback((e: ChangeEvent) => { @@ -34,11 +45,13 @@ export const SystemUpdatePrefs = () => { <>

    System Updates

    - +

    Automatically download and apply system updates to keep your Urbit up to date.

    -

    - OTA Source: -

    + {otaSource && ( +

    + OTA Source: +

    + )}