diff --git a/resources/scripts/components/elements/AceEditor.tsx b/resources/scripts/components/elements/AceEditor.tsx index 4fc71cb3f..9f9866388 100644 --- a/resources/scripts/components/elements/AceEditor.tsx +++ b/resources/scripts/components/elements/AceEditor.tsx @@ -1,9 +1,8 @@ -import React, { useCallback, useEffect, useState, lazy } from 'react'; -import useRouter from 'use-react-router'; -import { ServerContext } from '@/state/server'; +import React, { useCallback, useEffect, useState } from 'react'; import ace, { Editor } from 'brace'; -import getFileContents from '@/api/server/files/getFileContents'; import styled from 'styled-components/macro'; +import tw from 'twin.macro'; +import Select from '@/components/elements/Select'; // @ts-ignore require('brace/ext/modelist'); @@ -11,7 +10,7 @@ require('ayu-ace/mirage'); const EditorContainer = styled.div` min-height: 16rem; - height: calc(100vh - 16rem); + height: calc(100vh - 20rem); ${tw`relative`}; #editor { @@ -20,9 +19,7 @@ const EditorContainer = styled.div` `; const modes: { [k: string]: string } = { - // eslint-disable-next-line @typescript-eslint/camelcase assembly_x86: 'Assembly (x86)', - // eslint-disable-next-line @typescript-eslint/camelcase c_cpp: 'C++', coffee: 'Coffeescript', css: 'CSS', @@ -40,7 +37,6 @@ const modes: { [k: string]: string } = { properties: 'Properties', python: 'Python', ruby: 'Ruby', - // eslint-disable-next-line @typescript-eslint/camelcase plain_text: 'Plaintext', toml: 'TOML', typescript: 'Typescript', @@ -70,7 +66,7 @@ export default ({ style, initialContent, initialModePath, fetchContent, onConten useEffect(() => { editor && editor.session.setMode(mode); - }, [editor, mode]); + }, [ editor, mode ]); useEffect(() => { editor && editor.session.setValue(initialContent || ''); @@ -113,10 +109,9 @@ export default ({ style, initialContent, initialModePath, fetchContent, onConten return (
-
-
- setMode(`ace/mode/${e.currentTarget.value}`)} > @@ -125,7 +120,7 @@ export default ({ style, initialContent, initialModePath, fetchContent, onConten )) } - +
diff --git a/resources/scripts/components/elements/DropdownMenu.tsx b/resources/scripts/components/elements/DropdownMenu.tsx index 11e70889f..74492f0c3 100644 --- a/resources/scripts/components/elements/DropdownMenu.tsx +++ b/resources/scripts/components/elements/DropdownMenu.tsx @@ -69,8 +69,7 @@ const DropdownMenu = ({ renderToggle, children }: Props) => { e.stopPropagation(); setVisible(false); }} - css={tw`absolute bg-white p-2 rounded border border-neutral-700 shadow-lg text-neutral-500`} - style={{ minWidth: '12rem' }} + css={tw`absolute bg-white p-2 rounded border border-neutral-700 shadow-lg text-neutral-500 min-w-48`} > {children}
diff --git a/resources/scripts/components/server/files/FileDropdownMenu.tsx b/resources/scripts/components/server/files/FileDropdownMenu.tsx index 5c1b19d06..b16fd1b20 100644 --- a/resources/scripts/components/server/files/FileDropdownMenu.tsx +++ b/resources/scripts/components/server/files/FileDropdownMenu.tsx @@ -18,6 +18,8 @@ import Can from '@/components/elements/Can'; import getFileDownloadUrl from '@/api/server/files/getFileDownloadUrl'; import useServer from '@/plugins/useServer'; import useFlash from '@/plugins/useFlash'; +import tw from 'twin.macro'; +import Fade from '@/components/elements/Fade'; type ModalType = 'rename' | 'move'; @@ -113,7 +115,7 @@ export default ({ uuid }: { uuid: string }) => {
{ e.preventDefault(); if (!menuVisible) { @@ -133,60 +135,60 @@ export default ({ uuid }: { uuid: string }) => { setMenuVisible(false); }} /> - +
- +
{ e.stopPropagation(); setMenuVisible(false); }} - className={'absolute bg-white p-2 rounded border border-neutral-700 shadow-lg text-neutral-500 min-w-48'} + css={tw`absolute bg-white p-2 rounded border border-neutral-700 shadow-lg text-neutral-500 min-w-48`} >
setModal('rename')} - className={'hover:text-neutral-700 p-2 flex items-center hover:bg-neutral-100 rounded'} + css={tw`hover:text-neutral-700 p-2 flex items-center hover:bg-neutral-100 rounded`} > - - Rename + + Rename
setModal('move')} - className={'hover:text-neutral-700 p-2 flex items-center hover:bg-neutral-100 rounded'} + css={tw`hover:text-neutral-700 p-2 flex items-center hover:bg-neutral-100 rounded`} > - - Move + + Move
doCopy()} - className={'hover:text-neutral-700 p-2 flex items-center hover:bg-neutral-100 rounded'} + css={tw`hover:text-neutral-700 p-2 flex items-center hover:bg-neutral-100 rounded`} > - - Copy + + Copy
doDownload()} > - - Download + + Download
doDeletion()} - className={'hover:text-red-700 p-2 flex items-center hover:bg-red-100 rounded'} + css={tw`hover:text-red-700 p-2 flex items-center hover:bg-red-100 rounded`} > - - Delete + + Delete
-
+
); }; diff --git a/resources/scripts/components/server/files/FileEditContainer.tsx b/resources/scripts/components/server/files/FileEditContainer.tsx index f24e7bc60..b85f7bc7d 100644 --- a/resources/scripts/components/server/files/FileEditContainer.tsx +++ b/resources/scripts/components/server/files/FileEditContainer.tsx @@ -14,6 +14,8 @@ import Can from '@/components/elements/Can'; import FlashMessageRender from '@/components/FlashMessageRender'; import PageContentBlock from '@/components/elements/PageContentBlock'; import ServerError from '@/components/screens/ServerError'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; const LazyAceEditor = lazy(() => import(/* webpackChunkName: "editor" */'@/components/elements/AceEditor')); @@ -81,16 +83,17 @@ export default () => { return ( - - - {(name || hash.replace(/^#/, '')).endsWith('.pteroignore') && -
-

- You're editing a .pteroignore file. + + + {hash.replace(/^#/, '').endsWith('.pteroignore') && +

+

+ You're editing + a .pteroignore file. Any files or directories listed in here will be excluded from backups. Wildcards are supported by - using an asterisk (*). You can + using an asterisk (*). You can negate a prior rule by prepending an exclamation point - (!). + (!).

} @@ -102,7 +105,7 @@ export default () => { save(name); }} /> -
+
{ onContentSaved={() => save()} />
-
+
{action === 'edit' ? - + : - + }
diff --git a/resources/scripts/components/server/files/FileManagerBreadcrumbs.tsx b/resources/scripts/components/server/files/FileManagerBreadcrumbs.tsx index c125dd2c2..fba1938ea 100644 --- a/resources/scripts/components/server/files/FileManagerBreadcrumbs.tsx +++ b/resources/scripts/components/server/files/FileManagerBreadcrumbs.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import { ServerContext } from '@/state/server'; import { NavLink } from 'react-router-dom'; import { cleanDirectoryPath } from '@/helpers'; +import tw from 'twin.macro'; interface Props { withinFileEditor?: boolean; @@ -32,11 +33,11 @@ export default ({ withinFileEditor, isNewFile }: Props) => { }); return ( -
- /home/ +
+ /home/ container / @@ -46,18 +47,18 @@ export default ({ withinFileEditor, isNewFile }: Props) => { {crumb.name} / : - {crumb.name} + {crumb.name} )) } {file && - {decodeURIComponent(file)} + {decodeURIComponent(file)} }
diff --git a/resources/scripts/components/server/files/FileManagerContainer.tsx b/resources/scripts/components/server/files/FileManagerContainer.tsx index 2e0298dce..2d220926a 100644 --- a/resources/scripts/components/server/files/FileManagerContainer.tsx +++ b/resources/scripts/components/server/files/FileManagerContainer.tsx @@ -14,7 +14,8 @@ import { Link } from 'react-router-dom'; import Can from '@/components/elements/Can'; import PageContentBlock from '@/components/elements/PageContentBlock'; import ServerError from '@/components/screens/ServerError'; -import useRouter from 'use-react-router'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; const sortFiles = (files: FileObject[]): FileObject[] => { return files.sort((a, b) => a.name.localeCompare(b.name)) @@ -24,7 +25,7 @@ const sortFiles = (files: FileObject[]): FileObject[] => { export default () => { const [ error, setError ] = useState(''); const [ loading, setLoading ] = useState(true); - const { addError, clearFlashes } = useStoreActions((actions: Actions) => actions.flashes); + const { clearFlashes } = useStoreActions((actions: Actions) => actions.flashes); const { id } = ServerContext.useStoreState(state => state.server.data!); const { contents: files } = ServerContext.useStoreState(state => state.files); const { getDirectoryContents } = ServerContext.useStoreActions(actions => actions.files); @@ -56,16 +57,16 @@ export default () => { return ( - + { loading ? - + : {!files.length ? -

+

This directory seems to be empty.

: @@ -74,8 +75,8 @@ export default () => {
{files.length > 250 ? -
-

+

+

This directory is too large to display in the browser, limiting the output to the first 250 files.

@@ -96,14 +97,15 @@ export default () => { } -
+
- New File - +
diff --git a/resources/scripts/components/server/files/FileNameModal.tsx b/resources/scripts/components/server/files/FileNameModal.tsx index 9ce60086e..b607e3b76 100644 --- a/resources/scripts/components/server/files/FileNameModal.tsx +++ b/resources/scripts/components/server/files/FileNameModal.tsx @@ -5,6 +5,8 @@ import { object, string } from 'yup'; import Field from '@/components/elements/Field'; import { ServerContext } from '@/state/server'; import { join } from 'path'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; type Props = RequiredModalProps & { onFileNamed: (name: string) => void; @@ -44,12 +46,10 @@ export default ({ onFileNamed, onDismissed, ...props }: Props) => { name={'fileName'} label={'File Name'} description={'Enter the name that this file should be saved as.'} - autoFocus={true} + autoFocus /> -
- +
+
diff --git a/resources/scripts/components/server/files/FileObjectRow.tsx b/resources/scripts/components/server/files/FileObjectRow.tsx index dc583a196..45abd046c 100644 --- a/resources/scripts/components/server/files/FileObjectRow.tsx +++ b/resources/scripts/components/server/files/FileObjectRow.tsx @@ -10,6 +10,7 @@ import FileDropdownMenu from '@/components/server/files/FileDropdownMenu'; import { ServerContext } from '@/state/server'; import { NavLink } from 'react-router-dom'; import useRouter from 'use-react-router'; +import tw from 'twin.macro'; export default ({ file }: { file: FileObject }) => { const directory = ServerContext.useStoreState(state => state.files.directory); @@ -19,14 +20,11 @@ export default ({ file }: { file: FileObject }) => { return (
{ // Don't rely on the onClick to work with the generated URL. Because of the way this // component re-renders you'll get redirected into a nested directory structure since @@ -41,27 +39,27 @@ export default ({ file }: { file: FileObject }) => { } }} > -
+
{file.isFile ? : }
-
+
{file.name}
{file.isFile && -
+
{bytesToHuman(file.size)}
}
{Math.abs(differenceInHours(file.modifiedAt, new Date())) > 48 ? - format(file.modifiedAt, 'MMM Do, YYYY h:mma') + format(file.modifiedAt, 'MMM do, yyyy h:mma') : formatDistanceToNow(file.modifiedAt, { addSuffix: true }) } diff --git a/resources/scripts/components/server/files/NewDirectoryButton.tsx b/resources/scripts/components/server/files/NewDirectoryButton.tsx index 842cddf8a..79e55f881 100644 --- a/resources/scripts/components/server/files/NewDirectoryButton.tsx +++ b/resources/scripts/components/server/files/NewDirectoryButton.tsx @@ -7,6 +7,8 @@ import { join } from 'path'; import { object, string } from 'yup'; import createDirectory from '@/api/server/files/createDirectory'; import v4 from 'uuid/v4'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; interface Values { directoryName: string; @@ -62,33 +64,33 @@ export default () => { resetForm(); }} > -
+ -

- This directory will be created as +

+ This directory will be created as  /home/container/ - + {decodeURIComponent( join(directory, values.directoryName).replace(/^(\.\.\/|\/)+/, ''), )}

-
- +
)} - + ); }; diff --git a/resources/scripts/components/server/files/RenameFileModal.tsx b/resources/scripts/components/server/files/RenameFileModal.tsx index 41a0a0fdc..9b001cba0 100644 --- a/resources/scripts/components/server/files/RenameFileModal.tsx +++ b/resources/scripts/components/server/files/RenameFileModal.tsx @@ -6,7 +6,8 @@ import { join } from 'path'; import renameFile from '@/api/server/files/renameFile'; import { ServerContext } from '@/state/server'; import { FileObject } from '@/api/server/files/loadDirectory'; -import classNames from 'classnames'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; interface FormikValues { name: string; @@ -48,14 +49,14 @@ export default ({ file, useMoveTerminology, ...props }: Props) => { > {({ isSubmitting, values }) => ( -
+
-
+
{ ? 'Enter the new name and directory of this file or folder, relative to the current directory.' : undefined } - autoFocus={true} + autoFocus />
- +
{useMoveTerminology && -

- New location: +

+ New location:  /home/container/{join(directory, values.name).replace(/^(\.\.\/|\/)+/, '')}

} diff --git a/tailwind.config.js b/tailwind.config.js index 6ed79cdd9..8df6c807b 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -119,6 +119,9 @@ module.exports = { transitionDuration: { 250: '250ms', }, + minWidth: { + '48': '12rem', + }, borderColor: theme => ({ default: theme('colors.neutral.400', 'cuurrentColor'), }),