A few adjustments for chunking the new file edit page
This commit is contained in:
parent
8599e2c64b
commit
c66d2cd123
9 changed files with 72 additions and 28 deletions
|
@ -1,16 +1,25 @@
|
|||
import React from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import useRouter from 'use-react-router';
|
||||
import queryString from 'query-string';
|
||||
import { ServerContext } from '@/state/server';
|
||||
import getFileContents from '@/api/server/files/getFileContents';
|
||||
|
||||
export default () => {
|
||||
const { location: { search } } = useRouter();
|
||||
const values = queryString.parse(search);
|
||||
const { location: { hash } } = useRouter();
|
||||
const [content, setContent] = useState('');
|
||||
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
||||
|
||||
useEffect(() => {
|
||||
getFileContents(uuid, hash.replace(/^#/, ''))
|
||||
.then(setContent)
|
||||
.catch(error => console.error(error));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={'my-10'}>
|
||||
<textarea className={'rounded bg-black h-32 w-full text-neutral-100'}>
|
||||
|
||||
</textarea>
|
||||
<textarea
|
||||
value={content}
|
||||
className={'rounded bg-black h-32 w-full text-neutral-100 text-sm font-mono'}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
Reference in a new issue