mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-04 13:19:48 +03:00
grid: update entrypoints for new api
This commit is contained in:
parent
220e6fca10
commit
952d5c0c38
7432
pkg/grid/package-lock.json
generated
7432
pkg/grid/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,8 @@
|
|||||||
"serve": "vite preview",
|
"serve": "vite preview",
|
||||||
"lint": "eslint --cache \"**/*.{js,jsx,ts,tsx}\"",
|
"lint": "eslint --cache \"**/*.{js,jsx,ts,tsx}\"",
|
||||||
"lint:fix": "npm run lint -- --fix",
|
"lint:fix": "npm run lint -- --fix",
|
||||||
"test": "echo \"No test yet\""
|
"test": "echo \"No test yet\"",
|
||||||
|
"tsc": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-dialog": "^0.0.20",
|
"@radix-ui/react-dialog": "^0.0.20",
|
||||||
@ -18,6 +19,7 @@
|
|||||||
"@radix-ui/react-polymorphic": "^0.0.13",
|
"@radix-ui/react-polymorphic": "^0.0.13",
|
||||||
"@radix-ui/react-portal": "^0.0.15",
|
"@radix-ui/react-portal": "^0.0.15",
|
||||||
"@urbit/http-api": "^1.3.1",
|
"@urbit/http-api": "^1.3.1",
|
||||||
|
"@urbit/api": "^1.4.0",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"clipboard-copy": "^4.0.1",
|
"clipboard-copy": "^4.0.1",
|
||||||
"color2k": "^1.2.4",
|
"color2k": "^1.2.4",
|
||||||
|
@ -2,6 +2,7 @@ import React, { useEffect } from 'react';
|
|||||||
import Mousetrap from 'mousetrap';
|
import Mousetrap from 'mousetrap';
|
||||||
import { BrowserRouter, Switch, Route, useHistory } from 'react-router-dom';
|
import { BrowserRouter, Switch, Route, useHistory } from 'react-router-dom';
|
||||||
import { Grid } from './pages/Grid';
|
import { Grid } from './pages/Grid';
|
||||||
|
import useDocketState from './state/docket';
|
||||||
|
|
||||||
const AppRoutes = () => {
|
const AppRoutes = () => {
|
||||||
const { push } = useHistory();
|
const { push } = useHistory();
|
||||||
@ -9,6 +10,10 @@ const AppRoutes = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.name = 'grid';
|
window.name = 'grid';
|
||||||
|
|
||||||
|
const { fetchAllies, fetchCharges } = useDocketState.getState();
|
||||||
|
fetchCharges();
|
||||||
|
fetchAllies();
|
||||||
|
|
||||||
Mousetrap.bind(['command+/', 'ctrl+/'], () => {
|
Mousetrap.bind(['command+/', 'ctrl+/'], () => {
|
||||||
push('/leap/search');
|
push('/leap/search');
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { map, pick } from 'lodash-es';
|
import { map, omit } from 'lodash-es';
|
||||||
import React, { FunctionComponent, useEffect } from 'react';
|
import React, { FunctionComponent, useEffect } from 'react';
|
||||||
import { Route, RouteComponentProps } from 'react-router-dom';
|
import { Route, RouteComponentProps } from 'react-router-dom';
|
||||||
import { MenuState, Nav } from '../nav/Nav';
|
import { MenuState, Nav } from '../nav/Nav';
|
||||||
import useDocketState from '../state/docket';
|
import useDocketState, { useCharges } from '../state/docket';
|
||||||
|
import { useKilnState } from '../state/kiln';
|
||||||
import { RemoveApp } from '../tiles/RemoveApp';
|
import { RemoveApp } from '../tiles/RemoveApp';
|
||||||
import { SuspendApp } from '../tiles/SuspendApp';
|
import { SuspendApp } from '../tiles/SuspendApp';
|
||||||
import { Tile } from '../tiles/Tile';
|
import { Tile } from '../tiles/Tile';
|
||||||
@ -12,11 +13,15 @@ type GridProps = RouteComponentProps<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
export const Grid: FunctionComponent<GridProps> = ({ match }) => {
|
export const Grid: FunctionComponent<GridProps> = ({ match }) => {
|
||||||
const { charges, fetchCharges } = useDocketState((s) => pick(s, ['charges', 'fetchCharges']));
|
const charges = useCharges();
|
||||||
const chargesLoaded = Object.keys(charges).length > 0;
|
const chargesLoaded = Object.keys(charges).length > 0;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const { fetchCharges, fetchAllies } = useDocketState.getState();
|
||||||
|
const { fetchVats } = useKilnState.getState();
|
||||||
fetchCharges();
|
fetchCharges();
|
||||||
|
fetchAllies();
|
||||||
|
fetchVats();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -30,7 +35,9 @@ export const Grid: FunctionComponent<GridProps> = ({ match }) => {
|
|||||||
{chargesLoaded && (
|
{chargesLoaded && (
|
||||||
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-6 px-4 md:px-8 w-full max-w-6xl">
|
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-6 px-4 md:px-8 w-full max-w-6xl">
|
||||||
{charges &&
|
{charges &&
|
||||||
map(charges, (charge, desk) => <Tile key={desk} docket={charge} desk={desk} />)}
|
map(omit(charges, 'grid'), (charge, desk) => (
|
||||||
|
<Tile key={desk} charge={charge} desk={desk} />
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Route exact path="/app/:desk/suspend">
|
<Route exact path="/app/:desk/suspend">
|
||||||
|
Loading…
Reference in New Issue
Block a user