mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 21:12:56 +03:00
hash: removing in favor of grid
This commit is contained in:
parent
e0a029dbdf
commit
ff024adfc7
@ -4,7 +4,6 @@ import {
|
||||
createSubscription,
|
||||
reduceStateN
|
||||
} from './base';
|
||||
import airlock from '~/logic/api';
|
||||
import { reduce } from '../reducers/launch-update';
|
||||
import _ from 'lodash';
|
||||
|
||||
@ -16,10 +15,6 @@ export interface LaunchState {
|
||||
};
|
||||
weather: WeatherState | null | Record<string, never> | boolean;
|
||||
userLocation: string | null;
|
||||
baseHash: string | null;
|
||||
runtimeLag: boolean;
|
||||
getRuntimeLag: () => Promise<void>;
|
||||
getBaseHash: () => Promise<void>;
|
||||
}
|
||||
|
||||
// @ts-ignore investigate zustand types
|
||||
@ -30,23 +25,7 @@ const useLaunchState = createState<LaunchState>(
|
||||
tileOrdering: [],
|
||||
tiles: {},
|
||||
weather: null,
|
||||
userLocation: null,
|
||||
baseHash: null,
|
||||
runtimeLag: false,
|
||||
getBaseHash: async () => {
|
||||
const baseHash = await airlock.scry({
|
||||
app: 'file-server',
|
||||
path: '/clay/base/hash'
|
||||
});
|
||||
set({ baseHash });
|
||||
},
|
||||
getRuntimeLag: async () => {
|
||||
const runtimeLag = await airlock.scry({
|
||||
app: 'launch',
|
||||
path: '/runtime-lag'
|
||||
});
|
||||
set({ runtimeLag });
|
||||
}
|
||||
userLocation: null
|
||||
}),
|
||||
['weather'],
|
||||
[
|
||||
|
@ -28,7 +28,6 @@ import './css/indigo-static.css';
|
||||
import { Content } from './landscape/components/Content';
|
||||
import './landscape/css/custom.css';
|
||||
import { bootstrapApi } from '~/logic/api/bootstrap';
|
||||
import useLaunchState from '../logic/state/launch';
|
||||
|
||||
const Root = withState(styled.div`
|
||||
font-family: ${p => p.theme.fonts.sans};
|
||||
@ -104,8 +103,6 @@ class App extends React.Component {
|
||||
this.updateMedium(this.mediumWatcher);
|
||||
this.updateLarge(this.largeWatcher);
|
||||
}, 500);
|
||||
this.props.getBaseHash();
|
||||
this.props.getRuntimeLag(); // TODO consider polling periodically
|
||||
this.props.getAll();
|
||||
gcpManager.start();
|
||||
Mousetrap.bindGlobal(['command+/', 'ctrl+/'], (e) => {
|
||||
@ -211,14 +208,12 @@ const selContacts = s => s.contacts[`~${window.ship}`];
|
||||
const selLocal = s => [s.set, s.omniboxShown, s.toggleOmnibox, s.dark];
|
||||
const selSettings = s => [s.display, s.getAll];
|
||||
const selGraph = s => s.getShallowChildren;
|
||||
const selLaunch = s => [s.getRuntimeLag, s.getBaseHash];
|
||||
|
||||
const WithApp = React.forwardRef((props, ref) => {
|
||||
const ourContact = useContactState(selContacts);
|
||||
const [display, getAll] = useSettingsState(selSettings, shallow);
|
||||
const [setLocal, omniboxShown, toggleOmnibox, dark] = useLocalState(selLocal);
|
||||
const getShallowChildren = useGraphState(selGraph);
|
||||
const [getRuntimeLag, getBaseHash] = useLaunchState(selLaunch, shallow);
|
||||
|
||||
return (
|
||||
<WarmApp
|
||||
@ -229,8 +224,6 @@ const WithApp = React.forwardRef((props, ref) => {
|
||||
set={setLocal}
|
||||
dark={dark}
|
||||
getShallowChildren={getShallowChildren}
|
||||
getRuntimeLag={getRuntimeLag}
|
||||
getBaseHash={getBaseHash}
|
||||
toggleOmnibox={toggleOmnibox}
|
||||
omniboxShown={omniboxShown}
|
||||
/>
|
||||
|
@ -3,23 +3,20 @@ import { Box, Button, Col, Icon, Row, Text } from '@tlon/indigo-react';
|
||||
import f from 'lodash/fp';
|
||||
import React, { ReactElement, useEffect, useMemo, useState } from 'react';
|
||||
import { Helmet } from 'react-helmet';
|
||||
import { Route, useHistory } from 'react-router-dom';
|
||||
import { Route } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
import {
|
||||
hasTutorialGroup,
|
||||
|
||||
TUTORIAL_BOOK,
|
||||
TUTORIAL_CHAT, TUTORIAL_GROUP,
|
||||
TUTORIAL_CHAT,
|
||||
TUTORIAL_GROUP,
|
||||
TUTORIAL_HOST,
|
||||
|
||||
TUTORIAL_LINKS
|
||||
} from '~/logic/lib/tutorialModal';
|
||||
import { useModal } from '~/logic/lib/useModal';
|
||||
import { useQuery } from '~/logic/lib/useQuery';
|
||||
import { useWaitForProps } from '~/logic/lib/useWaitForProps';
|
||||
import { writeText } from '~/logic/lib/util';
|
||||
import useHarkState from '~/logic/state/hark';
|
||||
import useLaunchState from '~/logic/state/launch';
|
||||
import useLocalState from '~/logic/state/local';
|
||||
import useMetadataState from '~/logic/state/metadata';
|
||||
import useSettingsState, { selectCalmState } from '~/logic/state/settings';
|
||||
@ -53,8 +50,6 @@ interface LaunchAppProps {
|
||||
|
||||
export const LaunchApp = (props: LaunchAppProps): ReactElement | null => {
|
||||
const { connection } = props;
|
||||
const { baseHash, runtimeLag } = useLaunchState(state => state);
|
||||
const [hashText, setHashText] = useState(baseHash);
|
||||
const [exitingTut, setExitingTut] = useState(false);
|
||||
const seen = useSettingsState(s => s?.tutorial?.seen) ?? true;
|
||||
const associations = useMetadataState(s => s.associations);
|
||||
@ -67,35 +62,6 @@ export const LaunchApp = (props: LaunchAppProps): ReactElement | null => {
|
||||
!hideGroups ? { hideGroups } = calmState : null;
|
||||
|
||||
const waiter = useWaitForProps({ ...props, associations });
|
||||
const hashBox = (
|
||||
<Box
|
||||
position="sticky"
|
||||
left={3}
|
||||
bottom={3}
|
||||
mt={3}
|
||||
backgroundColor="white"
|
||||
borderRadius={2}
|
||||
width="fit-content"
|
||||
fontSize={0}
|
||||
cursor="pointer"
|
||||
onClick={() => {
|
||||
writeText(baseHash);
|
||||
setHashText('copied');
|
||||
setTimeout(() => {
|
||||
setHashText(baseHash);
|
||||
}, 2000);
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
height="100%"
|
||||
backgroundColor={runtimeLag ? 'yellow' : 'washedGray'}
|
||||
p={2}
|
||||
width="fit-content"
|
||||
>
|
||||
<Text mono bold>{hashText || baseHash}</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
const { query } = useQuery();
|
||||
|
||||
@ -247,7 +213,6 @@ export const LaunchApp = (props: LaunchAppProps): ReactElement | null => {
|
||||
(<Groups />)
|
||||
}
|
||||
</Box>
|
||||
{hashBox}
|
||||
</ScrollbarLessBox>
|
||||
</>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user