Cleanup and update some dependencies

This commit is contained in:
Dane Everitt 2020-12-27 11:18:33 -08:00
parent 7f8ae7a8f9
commit 2463c3f492
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 80 additions and 171 deletions

View file

@ -7,7 +7,6 @@ import { store } from '@/state';
import DashboardRouter from '@/routers/DashboardRouter';
import ServerRouter from '@/routers/ServerRouter';
import AuthenticationRouter from '@/routers/AuthenticationRouter';
import { Provider } from 'react-redux';
import { SiteSettings } from '@/state/settings';
import ProgressBar from '@/components/elements/ProgressBar';
import NotFound from '@/components/screens/NotFound';
@ -76,20 +75,18 @@ const App = () => {
<GlobalStylesheet/>
<TailwindGlobalStyles/>
<StoreProvider store={store}>
<Provider store={store}>
<ProgressBar/>
<div css={tw`mx-auto w-auto`}>
<Router history={history}>
{SiteConfiguration?.analytics && <Pageview/>}
<Switch>
<Route path="/server/:id" component={ServerRouter}/>
<Route path="/auth" component={AuthenticationRouter}/>
<Route path="/" component={DashboardRouter}/>
<Route path={'*'} component={NotFound}/>
</Switch>
</Router>
</div>
</Provider>
<ProgressBar/>
<div css={tw`mx-auto w-auto`}>
<Router history={history}>
{SiteConfiguration?.analytics && <Pageview/>}
<Switch>
<Route path="/server/:id" component={ServerRouter}/>
<Route path="/auth" component={AuthenticationRouter}/>
<Route path="/" component={DashboardRouter}/>
<Route path={'*'} component={NotFound}/>
</Switch>
</Router>
</div>
</StoreProvider>
</>
);

View file

@ -1,9 +1,8 @@
import React from 'react';
import React, { useEffect } from 'react';
import ContentContainer from '@/components/elements/ContentContainer';
import { CSSTransition } from 'react-transition-group';
import tw from 'twin.macro';
import FlashMessageRender from '@/components/FlashMessageRender';
import { Helmet } from 'react-helmet';
export interface PageContentBlockProps {
title?: string;
@ -12,14 +11,15 @@ export interface PageContentBlockProps {
}
const PageContentBlock: React.FC<PageContentBlockProps> = ({ title, showFlashKey, className, children }) => {
useEffect(() => {
if (title) {
document.title = title;
}
}, [ title ]);
return (
<CSSTransition timeout={150} classNames={'fade'} appear in>
<>
{title &&
<Helmet>
<title>{title}</title>
</Helmet>
}
<ContentContainer css={tw`my-4 sm:my-10`} className={className}>
{showFlashKey &&
<FlashMessageRender byKey={showFlashKey} css={tw`mb-4`}/>

View file

@ -18,8 +18,7 @@ const ChunkedStatGraphs = lazy(() => import(/* webpackChunkName: "graphs" */'@/c
const ServerConsole = () => {
const isInstalling = ServerContext.useStoreState(state => state.server.data!.isInstalling);
const isTransferring = ServerContext.useStoreState(state => state.server.data!.isTransferring);
// @ts-ignore
const eggFeatures: string[] = ServerContext.useStoreState(state => state.server.data!.eggFeatures, isEqual);
const eggFeatures = ServerContext.useStoreState(state => state.server.data!.eggFeatures, isEqual);
return (
<ServerContentBlock title={'Console'} css={tw`flex flex-wrap`}>

View file

@ -17,8 +17,7 @@ const NetworkContainer = () => {
const [ loading, setLoading ] = useState(false);
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
const allocationLimit = ServerContext.useStoreState(state => state.server.data!.featureLimits.allocations);
// @ts-ignore
const allocations: Allocation[] = ServerContext.useStoreState(state => state.server.data!.allocations, isEqual);
const allocations = ServerContext.useStoreState(state => state.server.data!.allocations, isEqual);
const setServerFromState = ServerContext.useStoreActions(actions => actions.server.setServerFromState);
const { clearFlashes, clearAndAddHttpError } = useFlash();

View file

@ -53,8 +53,7 @@ export default ({ match, history, location: { state } }: RouteComponentProps<Par
const [ isLoading, setIsLoading ] = useState(true);
const [ showEditModal, setShowEditModal ] = useState(false);
// @ts-ignore
const schedule: Schedule | undefined = ServerContext.useStoreState(st => st.schedules.data.find(s => s.id === state.schedule?.id), isEqual);
const schedule = ServerContext.useStoreState(st => st.schedules.data.find(s => s.id === state.schedule?.id), isEqual);
const appendSchedule = ServerContext.useStoreActions(actions => actions.schedules.appendSchedule);
useEffect(() => {

View file

@ -19,11 +19,7 @@ export default () => {
const id = ServerContext.useStoreState(state => state.server.data!.id);
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
const node = ServerContext.useStoreState(state => state.server.data!.node);
const sftp = ServerContext.useStoreState(
state => state.server.data!.sftpDetails,
// @ts-ignore
isEqual,
);
const sftp = ServerContext.useStoreState(state => state.server.data!.sftpDetails, isEqual);
return (
<ServerContentBlock title={'Settings'}>

View file

@ -25,7 +25,6 @@ const StartupContainer = () => {
variables: server.data!.variables,
invocation: server.data!.invocation,
dockerImage: server.data!.dockerImage,
// @ts-ignore
}), isEqual);
const { data, error, isValidating, mutate } = getServerStartup(uuid, {