A few adjustments for chunking the new file edit page

This commit is contained in:
Dane Everitt 2019-09-28 14:59:05 -07:00
parent 8599e2c64b
commit c66d2cd123
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 72 additions and 28 deletions

View file

@ -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>
);
};