Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: init upload file from local #62

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"@monaco-editor/react": "^4.6.0",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
Expand Down
40 changes: 15 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/app/(main)/(router)/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

const TemplateCardData = [
{
title: 'Node',
Expand Down
117 changes: 62 additions & 55 deletions src/app/edit/(main)/(router)/file/page.tsx
Original file line number Diff line number Diff line change
@@ -1,68 +1,75 @@
'use client';

import React from 'react';
import dynamic from 'next/dynamic';

import FileTree from '@/components/file/fileTree';
import { useUploadFileDataStore } from '@/store/uploadFileDataStore';
import { TreeViewElement } from '@/components/extension/tree-view-api';

const data = [
{
id: '1',
filename: 'components',
children: [
{
id: '2',
filename: 'extension',
children: [
{
id: '3',
filename: 'tree-view.tsx',
value: '我42424是page8',
},
{
id: '4',
filename: 'tree-view-api.tsx',
value: '11111我是page8',
},
],
},
{
id: '5',
filename: 'dashboard-tree.tsx',
value: '我4242是page8',
},
],
},
{
id: '6',
filename: 'pages',
children: [
{
id: '7',
filename: 'page.tsx',
value: '我是page31318',
},
{
id: '8',
filename: 'page-guide.tsx',
value: '我是page8',
},
],
},
{
id: '18',
filename: 'env.ts',
value: '我是page118',
},
];
const FileTree = dynamic(() => import('@/components/file/fileTree'), { ssr: false });

// const data = [
// {
// id: '1',
// filename: 'components',
// children: [
// {
// id: '2',
// filename: 'extension',
// children: [
// {
// id: '3',
// filename: 'tree-view.tsx',
// value: '我42424是page8',
// },
// {
// id: '4',
// filename: 'tree-view-api.tsx',
// value: '11111我是page8',
// },
// ],
// },
// {
// id: '5',
// filename: 'dashboard-tree.tsx',
// value: '我4242是page8',
// },
// ],
// },
// {
// id: '6',
// filename: 'pages',
// children: [
// {
// id: '7',
// filename: 'page.tsx',
// value: '我是page31318',
// },
// {
// id: '8',
// filename: 'page-guide.tsx',
// value: '我是page8',
// },
// ],
// },
// {
// id: '18',
// filename: 'env.ts',
// value: '我是page118',
// },
// ];
const PortsPage: React.FC = () => {
const { fileData } = useUploadFileDataStore();
if (fileData === null) return null;

let data: TreeViewElement[] = fileData as unknown as TreeViewElement[];
if (!Array.isArray(fileData)) data = [fileData];

return (
<div className="h-full w-full flex flex-col bg-[#202327]">
<span className=" text-[11px] px-4 pt-2">资源管理器</span>
<div className=" px-0 flex flex-col w-full justify-start">
{/* {MockFileList.map((file, index) => (
<FileItem key={index} file={file}></FileItem>
))} */}
<FileTree data={data}></FileTree>
<FileTree data={data as unknown as TreeViewElement[]}></FileTree>
</div>
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Inter } from 'next/font/google';
import { NextDevtoolsProvider } from '@next-devtools/core';

import './globals.css';
import { ModalProvider } from '@/components/provider/modal-provider';

const inter = Inter({ subsets: ['latin'] });

Expand All @@ -19,7 +20,10 @@ export default function RootLayout({
return (
<html lang="en" suppressHydrationWarning>
<body className={inter.className}>
<NextDevtoolsProvider>{children}</NextDevtoolsProvider>
<NextDevtoolsProvider>
{children}
<ModalProvider />
</NextDevtoolsProvider>
</body>
</html>
);
Expand Down
Loading
Loading