From 9a4c0d8ba7bb89ae40581a8cd78f71ecfdc0da53 Mon Sep 17 00:00:00 2001 From: Rihan Date: Sun, 13 Sep 2020 18:02:25 +0100 Subject: [PATCH] Make interface mobile responsive (#2273) --- .../scripts/components/NavigationBar.tsx | 2 +- .../dashboard/AccountApiContainer.tsx | 26 +++++++++++-- .../components/dashboard/ServerRow.tsx | 27 +++++++++---- .../scripts/components/elements/Modal.tsx | 10 ++++- .../components/elements/SubNavigation.tsx | 4 +- .../components/server/ServerConsole.tsx | 6 +-- .../scripts/components/server/StatGraphs.tsx | 6 +-- .../components/server/backups/BackupRow.tsx | 6 +-- .../server/backups/ChecksumModal.tsx | 2 +- .../server/databases/DatabaseRow.tsx | 24 +++++++++--- .../components/server/files/FileObjectRow.tsx | 4 +- .../server/network/NetworkContainer.tsx | 8 ++-- .../server/schedules/ScheduleContainer.tsx | 2 +- .../schedules/ScheduleEditContainer.tsx | 2 +- .../server/schedules/ScheduleRow.tsx | 38 ++++++++++++------- .../server/schedules/ScheduleTaskRow.tsx | 12 +++--- .../server/startup/StartupContainer.tsx | 2 +- .../components/server/startup/VariableBox.tsx | 4 +- .../components/server/users/UserRow.tsx | 10 ++--- resources/views/admin/packs/index.blade.php | 4 +- 20 files changed, 130 insertions(+), 69 deletions(-) diff --git a/resources/scripts/components/NavigationBar.tsx b/resources/scripts/components/NavigationBar.tsx index 4f122a82..384a32ed 100644 --- a/resources/scripts/components/NavigationBar.tsx +++ b/resources/scripts/components/NavigationBar.tsx @@ -11,7 +11,7 @@ import styled from 'styled-components/macro'; import * as config from '@/../../tailwind.config.js'; const Navigation = styled.div` - ${tw`w-full bg-neutral-900 shadow-md`}; + ${tw`w-full bg-neutral-900 shadow-md overflow-x-auto`}; & > div { ${tw`mx-auto w-full flex items-center`}; diff --git a/resources/scripts/components/dashboard/AccountApiContainer.tsx b/resources/scripts/components/dashboard/AccountApiContainer.tsx index 6b459502..33f0eb56 100644 --- a/resources/scripts/components/dashboard/AccountApiContainer.tsx +++ b/resources/scripts/components/dashboard/AccountApiContainer.tsx @@ -14,8 +14,26 @@ import { httpErrorToHuman } from '@/api/http'; import { format } from 'date-fns'; import PageContentBlock from '@/components/elements/PageContentBlock'; import tw from 'twin.macro'; +import { breakpoint } from '@/theme'; +import styled from 'styled-components/macro'; import GreyRowBox from '@/components/elements/GreyRowBox'; +const Container = styled.div` + ${tw`flex flex-wrap my-10`}; + + & > div { + ${tw`w-full`}; + + ${breakpoint('md')` + width: calc(50% - 1rem); + `} + + ${breakpoint('xl')` + ${tw`w-auto flex-1`}; + `} + } +`; + export default () => { const [ deleteIdentifier, setDeleteIdentifier ] = useState(''); const [ keys, setKeys ] = useState([]); @@ -50,11 +68,11 @@ export default () => { return ( -
- + + setKeys(s => ([ ...s!, key ]))}/> - + { )) } -
+
); }; diff --git a/resources/scripts/components/dashboard/ServerRow.tsx b/resources/scripts/components/dashboard/ServerRow.tsx index 819e6663..17d83f78 100644 --- a/resources/scripts/components/dashboard/ServerRow.tsx +++ b/resources/scripts/components/dashboard/ServerRow.tsx @@ -55,16 +55,16 @@ export default ({ server, className }: { server: Server; className?: string }) = return ( -
+
-
+

{server.name}

{!!server.description &&

{server.description}

}
-
+ -
+
{!stats ? !statsError ? @@ -95,7 +95,7 @@ export default ({ server, className }: { server: Server; className?: string }) =
: -
+ -
+

of {memorylimit}

-
+

of {disklimit}

+ +
+
+
+
+
}
diff --git a/resources/scripts/components/elements/Modal.tsx b/resources/scripts/components/elements/Modal.tsx index 896a3256..953a631a 100644 --- a/resources/scripts/components/elements/Modal.tsx +++ b/resources/scripts/components/elements/Modal.tsx @@ -4,6 +4,7 @@ import { faTimes } from '@fortawesome/free-solid-svg-icons'; import Spinner from '@/components/elements/Spinner'; import tw from 'twin.macro'; import styled from 'styled-components/macro'; +import { breakpoint } from '@/theme'; import Fade from '@/components/elements/Fade'; export interface RequiredModalProps { @@ -26,9 +27,16 @@ export const ModalMask = styled.div` `; const ModalContainer = styled.div<{ alignTop?: boolean }>` + ${breakpoint('xs')` + max-width: 95%; + `}; + + ${breakpoint('md')` + max-width: 50%; + `}; + ${tw`relative flex flex-col w-full m-auto`}; max-height: calc(100vh - 8rem); - max-width: 50%; // @todo max-w-screen-lg perhaps? ${props => props.alignTop && 'margin-top: 10%'}; diff --git a/resources/scripts/components/elements/SubNavigation.tsx b/resources/scripts/components/elements/SubNavigation.tsx index 83221e93..6b837969 100644 --- a/resources/scripts/components/elements/SubNavigation.tsx +++ b/resources/scripts/components/elements/SubNavigation.tsx @@ -4,14 +4,14 @@ import tw from 'twin.macro'; import config from '../../../../tailwind.config'; const SubNavigation = styled.div` - ${tw`w-full bg-neutral-700 shadow`}; + ${tw`w-full bg-neutral-700 shadow overflow-x-auto`}; & > div { ${tw`flex items-center text-sm mx-auto px-2`}; max-width: 1200px; & > a, & > div { - ${tw`inline-block py-3 px-4 text-neutral-300 no-underline transition-all duration-150`}; + ${tw`inline-block py-3 px-4 text-neutral-300 no-underline whitespace-no-wrap transition-all duration-150`}; &:not(:first-of-type) { ${tw`ml-2`}; diff --git a/resources/scripts/components/server/ServerConsole.tsx b/resources/scripts/components/server/ServerConsole.tsx index ad84505c..05c10041 100644 --- a/resources/scripts/components/server/ServerConsole.tsx +++ b/resources/scripts/components/server/ServerConsole.tsx @@ -63,8 +63,8 @@ export default () => { const memorylimit = limits.memory ? megabytesToHuman(limits.memory) : 'Unlimited'; return ( - -
+ +

{

}
-
+
diff --git a/resources/scripts/components/server/StatGraphs.tsx b/resources/scripts/components/server/StatGraphs.tsx index 44bd59f1..399b9672 100644 --- a/resources/scripts/components/server/StatGraphs.tsx +++ b/resources/scripts/components/server/StatGraphs.tsx @@ -141,8 +141,8 @@ export default () => { }, [ instance, connected, memory, cpu ]); return ( -
- +
+ {status !== 'offline' ? : @@ -151,7 +151,7 @@ export default () => {

}
- + {status !== 'offline' ? : diff --git a/resources/scripts/components/server/backups/BackupRow.tsx b/resources/scripts/components/server/backups/BackupRow.tsx index d4d68d58..0a45c7ca 100644 --- a/resources/scripts/components/server/backups/BackupRow.tsx +++ b/resources/scripts/components/server/backups/BackupRow.tsx @@ -43,7 +43,7 @@ export default ({ backup, className }: Props) => {
{backup.completedAt ? - +
diff --git a/resources/scripts/components/server/backups/ChecksumModal.tsx b/resources/scripts/components/server/backups/ChecksumModal.tsx index f37774f5..57e6ba8b 100644 --- a/resources/scripts/components/server/backups/ChecksumModal.tsx +++ b/resources/scripts/components/server/backups/ChecksumModal.tsx @@ -9,7 +9,7 @@ const ChecksumModal = ({ checksum, ...props }: RequiredModalProps & { checksum: The checksum of this file is:

-            {checksum}
+            {checksum}
         
); diff --git a/resources/scripts/components/server/databases/DatabaseRow.tsx b/resources/scripts/components/server/databases/DatabaseRow.tsx index e0e3b038..1175aef4 100644 --- a/resources/scripts/components/server/databases/DatabaseRow.tsx +++ b/resources/scripts/components/server/databases/DatabaseRow.tsx @@ -111,8 +111,20 @@ export default ({ database, className }: Props) => { setConnectionVisible(false)}>

Database connection details

+
+ + +
+
+ + +
+
+ + +
-
+
@@ -134,22 +146,22 @@ export default ({ database, className }: Props) => {
- -
+ +

{database.name}

-
+ -
+ -
+ diff --git a/resources/scripts/components/server/files/FileObjectRow.tsx b/resources/scripts/components/server/files/FileObjectRow.tsx index cf717569..0e05820b 100644 --- a/resources/scripts/components/server/files/FileObjectRow.tsx +++ b/resources/scripts/components/server/files/FileObjectRow.tsx @@ -73,12 +73,12 @@ const FileObjectRow = ({ file }: { file: FileObject }) => ( {file.name}
{file.isFile && -
+ }