diff --git a/resources/scripts/components/auth/LoginFormContainer.tsx b/resources/scripts/components/auth/LoginFormContainer.tsx index c62e0a2ac..afc8093fc 100644 --- a/resources/scripts/components/auth/LoginFormContainer.tsx +++ b/resources/scripts/components/auth/LoginFormContainer.tsx @@ -43,5 +43,16 @@ export default forwardRef(({ title, ...props }, ref) => +

+ © 2015 - 2020  + + Pterodactyl Software + +

)); diff --git a/resources/scripts/components/elements/PageContentBlock.tsx b/resources/scripts/components/elements/PageContentBlock.tsx index 6034f467a..87d9d3d34 100644 --- a/resources/scripts/components/elements/PageContentBlock.tsx +++ b/resources/scripts/components/elements/PageContentBlock.tsx @@ -14,7 +14,7 @@ export default ({ className, children }: Props) => ( {children} -

+

© 2015 - 2020  void; } -export default ({ title, message }: Props) => ( - -

-
- -

404

-

- The requested resource was not found. -

-
-
- +export default ({ title, message, onBack }: Props) => ( + ); diff --git a/resources/scripts/components/screens/ScreenBlock.tsx b/resources/scripts/components/screens/ScreenBlock.tsx new file mode 100644 index 000000000..cff1c5501 --- /dev/null +++ b/resources/scripts/components/screens/ScreenBlock.tsx @@ -0,0 +1,65 @@ +import React from 'react'; +import PageContentBlock from '@/components/elements/PageContentBlock'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faArrowLeft } from '@fortawesome/free-solid-svg-icons/faArrowLeft'; +import { faSyncAlt } from '@fortawesome/free-solid-svg-icons/faSyncAlt'; +import classNames from 'classnames'; +import styled from 'styled-components'; + +interface BaseProps { + title: string; + image: string; + message: string; + onRetry?: () => void; + onBack?: () => void; +} + +interface PropsWithRetry extends BaseProps { + onRetry?: () => void; + onBack?: never | undefined; +} + +interface PropsWithBack extends BaseProps { + onBack?: () => void; + onRetry?: never | undefined; +} + +type Props = PropsWithBack | PropsWithRetry; + +const ActionButton = styled.button` + ${tw`rounded-full w-8 h-8 flex items-center justify-center`}; + + &.hover\\:spin:hover { + animation: spin 2s linear infinite; + } + + @keyframes spin { + to { + transform: rotate(360deg); + } + } +`; + +export default ({ title, image, message, onBack, onRetry }: Props) => ( + +
+
+ {(typeof onBack === 'function' || typeof onRetry === 'function') && +
+ onRetry ? onRetry() : (onBack ? onBack() : null)} + className={classNames('btn btn-primary', { 'hover:spin': !!onRetry })} + > + + +
+ } + +

{title}

+

+ {message} +

+
+
+
+); diff --git a/resources/scripts/components/screens/ServerError.tsx b/resources/scripts/components/screens/ServerError.tsx index a5a9f8d53..42e82e5a5 100644 --- a/resources/scripts/components/screens/ServerError.tsx +++ b/resources/scripts/components/screens/ServerError.tsx @@ -1,64 +1,21 @@ import React from 'react'; -import PageContentBlock from '@/components/elements/PageContentBlock'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faArrowLeft } from '@fortawesome/free-solid-svg-icons/faArrowLeft'; -import { faSyncAlt } from '@fortawesome/free-solid-svg-icons/faSyncAlt'; -import classNames from 'classnames'; import styled from 'styled-components'; +import ScreenBlock from '@/components/screens/ScreenBlock'; -interface BaseProps { +interface Props { title?: string; message: string; onRetry?: () => void; onBack?: () => void; } -interface PropsWithRetry extends BaseProps { - onRetry?: () => void; - onBack?: never | undefined; -} - -interface PropsWithBack extends BaseProps { - onBack?: () => void; - onRetry?: never | undefined; -} - -type Props = PropsWithBack | PropsWithRetry; - -const ActionButton = styled.button` - ${tw`rounded-full w-8 h-8 flex items-center justify-center`}; - - &.hover\\:spin:hover { - animation: spin 2s linear infinite; - } - - @keyframes spin { - to { - transform: rotate(360deg); - } - } -`; - export default ({ title, message, onBack, onRetry }: Props) => ( - -
-
- {(typeof onBack === 'function' || typeof onRetry === 'function') && -
- onRetry ? onRetry() : (onBack ? onBack() : null)} - className={classNames('btn btn-primary', { 'hover:spin': !!onRetry })} - > - - -
- } - -

{title || 'Something went wrong!'}

-

- {message} -

-
-
-
+ // @ts-ignore + ); diff --git a/resources/scripts/components/screens/ServerInstalling.tsx b/resources/scripts/components/screens/ServerInstalling.tsx deleted file mode 100644 index be79bfcb4..000000000 --- a/resources/scripts/components/screens/ServerInstalling.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import PageContentBlock from '@/components/elements/PageContentBlock'; - -export default () => ( - -
-
- -

Your server is installing.

-

- Please check back in a few minutes. -

-
-
-
-); diff --git a/resources/scripts/routers/AuthenticationRouter.tsx b/resources/scripts/routers/AuthenticationRouter.tsx index 9c25db250..60919d2be 100644 --- a/resources/scripts/routers/AuthenticationRouter.tsx +++ b/resources/scripts/routers/AuthenticationRouter.tsx @@ -1,18 +1,22 @@ import React from 'react'; -import { Route, RouteComponentProps } from 'react-router-dom'; +import { Route, RouteComponentProps, Switch } from 'react-router-dom'; import LoginContainer from '@/components/auth/LoginContainer'; import ForgotPasswordContainer from '@/components/auth/ForgotPasswordContainer'; import ResetPasswordContainer from '@/components/auth/ResetPasswordContainer'; import LoginCheckpointContainer from '@/components/auth/LoginCheckpointContainer'; import NotFound from '@/components/screens/NotFound'; -export default ({ match }: RouteComponentProps) => ( +export default ({ location, history, match }: RouteComponentProps) => (
- - - - - - + + + + + + + + history.push('/auth/login')}/> + +
); diff --git a/resources/scripts/routers/ServerRouter.tsx b/resources/scripts/routers/ServerRouter.tsx index 68b9ac7dd..7fde7c805 100644 --- a/resources/scripts/routers/ServerRouter.tsx +++ b/resources/scripts/routers/ServerRouter.tsx @@ -17,10 +17,10 @@ import UsersContainer from '@/components/server/users/UsersContainer'; import Can from '@/components/elements/Can'; import BackupContainer from '@/components/server/backups/BackupContainer'; import Spinner from '@/components/elements/Spinner'; -import ServerInstalling from '@/components/screens/ServerInstalling'; import ServerError from '@/components/screens/ServerError'; import { httpErrorToHuman } from '@/api/http'; import NotFound from '@/components/screens/NotFound'; +import ScreenBlock from '@/components/screens/ScreenBlock'; const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) => { const [ error, setError ] = useState(''); @@ -63,7 +63,11 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>) : - + : <>