React 18 and Vite (#4510)
This commit is contained in:
parent
1bb1b13f6d
commit
21613fa602
244 changed files with 4547 additions and 8933 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { Fragment, useEffect, useState } from 'react';
|
||||
import { ServerContext } from '@/state/server';
|
||||
import { NavLink, useLocation } from 'react-router-dom';
|
||||
import { encodePathSegments, hashToPath } from '@/helpers';
|
||||
|
@ -12,8 +12,8 @@ interface Props {
|
|||
|
||||
export default ({ renderLeft, withinFileEditor, isNewFile }: Props) => {
|
||||
const [file, setFile] = useState<string | null>(null);
|
||||
const id = ServerContext.useStoreState((state) => state.server.data!.id);
|
||||
const directory = ServerContext.useStoreState((state) => state.files.directory);
|
||||
const id = ServerContext.useStoreState(state => state.server.data!.id);
|
||||
const directory = ServerContext.useStoreState(state => state.files.directory);
|
||||
const { hash } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -28,7 +28,7 @@ export default ({ renderLeft, withinFileEditor, isNewFile }: Props) => {
|
|||
const breadcrumbs = (): { name: string; path?: string }[] =>
|
||||
directory
|
||||
.split('/')
|
||||
.filter((directory) => !!directory)
|
||||
.filter(directory => !!directory)
|
||||
.map((directory, index, dirs) => {
|
||||
if (!withinFileEditor && index === dirs.length - 1) {
|
||||
return { name: directory };
|
||||
|
@ -46,7 +46,7 @@ export default ({ renderLeft, withinFileEditor, isNewFile }: Props) => {
|
|||
/
|
||||
{breadcrumbs().map((crumb, index) =>
|
||||
crumb.path ? (
|
||||
<React.Fragment key={index}>
|
||||
<Fragment key={index}>
|
||||
<NavLink
|
||||
to={`/server/${id}/files#${encodePathSegments(crumb.path)}`}
|
||||
css={tw`px-1 text-neutral-200 no-underline hover:text-neutral-100`}
|
||||
|
@ -54,17 +54,17 @@ export default ({ renderLeft, withinFileEditor, isNewFile }: Props) => {
|
|||
{crumb.name}
|
||||
</NavLink>
|
||||
/
|
||||
</React.Fragment>
|
||||
</Fragment>
|
||||
) : (
|
||||
<span key={index} css={tw`px-1 text-neutral-300`}>
|
||||
{crumb.name}
|
||||
</span>
|
||||
)
|
||||
),
|
||||
)}
|
||||
{file && (
|
||||
<React.Fragment>
|
||||
<Fragment>
|
||||
<span css={tw`px-1 text-neutral-300`}>{file}</span>
|
||||
</React.Fragment>
|
||||
</Fragment>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue