grid: copy update

This commit is contained in:
Liam Fitzgerald 2021-11-12 18:23:03 -05:00
parent 41bb5ec2b3
commit 8bc89caf7a
2 changed files with 10 additions and 8 deletions

View File

@ -249,7 +249,7 @@ export const Leap = React.forwardRef(
)}
>
{menu === 'upgrading'
? 'Your Urbit is being updated, this page will refresh when ready'
? 'Your Urbit is being updated, this page will update when ready'
: selection || 'Search'}
</label>
{menu !== 'upgrading' ? (

View File

@ -1,7 +1,7 @@
import { map, omit } from 'lodash';
import React, { FunctionComponent } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { Route, RouteComponentProps } from 'react-router-dom';
import { Route, RouteComponentProps, useHistory, useParams } from 'react-router-dom';
import { ErrorAlert } from '../components/ErrorAlert';
import { MenuState, Nav } from '../nav/Nav';
import { useCharges } from '../state/docket';
@ -10,18 +10,20 @@ import { SuspendApp } from '../tiles/SuspendApp';
import { Tile } from '../tiles/Tile';
import { TileInfo } from '../tiles/TileInfo';
type GridProps = RouteComponentProps<{
interface RouteProps {
menu?: MenuState;
}>;
}
export const Grid: FunctionComponent<GridProps> = ({ match, history }) => {
export const Grid: FunctionComponent<{}> = () => {
const charges = useCharges();
const { push } = useHistory();
const { menu } = useParams<RouteProps>();
const chargesLoaded = Object.keys(charges).length > 0;
return (
<div className="flex flex-col">
<header className="fixed sm:sticky bottom-0 sm:bottom-auto sm:top-0 left-0 z-30 flex justify-center w-full px-4">
<Nav menu={match.params.menu} />
<Nav menu={menu} />
</header>
<main className="h-full w-full flex justify-center pt-4 md:pt-16 pb-32 relative z-0">
@ -30,11 +32,11 @@ export const Grid: FunctionComponent<GridProps> = ({ match, history }) => {
<div className="grid justify-center grid-cols-2 sm:grid-cols-[repeat(auto-fit,minmax(auto,250px))] gap-4 px-4 md:px-8 w-full max-w-6xl">
{charges &&
map(omit(charges, window.desk), (charge, desk) => (
<Tile key={desk} charge={charge} desk={desk} />
<Tile key={desk} charge={charge} desk={desk} disabled={menu === 'upgrading'} />
))}
</div>
)}
<ErrorBoundary FallbackComponent={ErrorAlert} onReset={() => history.push('/')}>
<ErrorBoundary FallbackComponent={ErrorAlert} onReset={() => push('/')}>
<Route exact path="/app/:desk">
<TileInfo />
</Route>