From 90bec306d83d8c1fefbea0b689a3db5cd1a654ee Mon Sep 17 00:00:00 2001 From: ruotongyu Date: Sun, 16 Jun 2024 12:19:56 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20=E6=9B=B4=E6=96=B0(ui/autoMate):?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B0=E7=AA=97=E5=8F=A3=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=8A=A0=E8=BD=BDURL=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=94=99=E8=AF=AF=20=F0=9F=93=9D=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?(ui/autoMate):=20=E6=9B=B4=E6=96=B0=E7=B1=BB=E5=88=AB=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=A0=B7=E5=BC=8F=E5=8F=8A=E8=B7=AF=E7=94=B1=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=20=F0=9F=94=A7=20=E4=BF=AE=E5=A4=8D(ui/autoMate):=20?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8Dcontent=E9=A1=B5=E9=9D=A2=E4=B8=BAco?= =?UTF-8?q?ntentList=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/autoMate/src/main/config/window.ts | 4 ++-- ui/autoMate/src/renderer/src/pages/Category/category.scss | 2 +- ui/autoMate/src/renderer/src/pages/Category/index.tsx | 4 ++-- .../src/pages/{Content => ContentList}/content.scss | 0 .../renderer/src/pages/{Content => ContentList}/index.tsx | 2 +- ui/autoMate/src/renderer/src/router/index.tsx | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-) rename ui/autoMate/src/renderer/src/pages/{Content => ContentList}/content.scss (100%) rename ui/autoMate/src/renderer/src/pages/{Content => ContentList}/index.tsx (83%) diff --git a/ui/autoMate/src/main/config/window.ts b/ui/autoMate/src/main/config/window.ts index 7a6869b..190a85c 100644 --- a/ui/autoMate/src/main/config/window.ts +++ b/ui/autoMate/src/main/config/window.ts @@ -35,14 +35,14 @@ export function createWindow(): BrowserWindow { // Create the browser window. // HMR for renderer base on electron-vite cli. // Load the remote URL for development or the local html file for production. if (is.dev && process.env['ELECTRON_RENDERER_URL']) { - win.loadURL(process.env['ELECTRON_RENDERER_URL'] + "/#config") + win.loadURL(process.env['ELECTRON_RENDERER_URL'] + "/#config/category") } else { win.loadURL( url.format({ pathname: join(__dirname, '../renderer/index.html'), protocol: 'file', slashes: true, - hash: 'config' + hash: 'config/category' }) ) } diff --git a/ui/autoMate/src/renderer/src/pages/Category/category.scss b/ui/autoMate/src/renderer/src/pages/Category/category.scss index 5ef1be2..85f368e 100644 --- a/ui/autoMate/src/renderer/src/pages/Category/category.scss +++ b/ui/autoMate/src/renderer/src/pages/Category/category.scss @@ -10,7 +10,7 @@ @apply border-r bg-slate-100 text-xs text-slate-700 overflow-y-auto; grid-area: categories; .item{ - @apply p-1 py-1 truncate cursor-pointer; + @apply p-1 py-1 truncate cursor-pointer block; } } diff --git a/ui/autoMate/src/renderer/src/pages/Category/index.tsx b/ui/autoMate/src/renderer/src/pages/Category/index.tsx index 42265ce..a035de9 100644 --- a/ui/autoMate/src/renderer/src/pages/Category/index.tsx +++ b/ui/autoMate/src/renderer/src/pages/Category/index.tsx @@ -1,4 +1,4 @@ -import { Outlet, useLoaderData } from "react-router-dom" +import { Link, Outlet, useLoaderData } from "react-router-dom" import "./category.scss" import { Add, DatabaseConfig } from "@icon-park/react" @@ -8,7 +8,7 @@ export const Category = () => {
{categories.map((category) => ( -
{category.name}
+ {category.name} ))}
diff --git a/ui/autoMate/src/renderer/src/pages/Content/content.scss b/ui/autoMate/src/renderer/src/pages/ContentList/content.scss similarity index 100% rename from ui/autoMate/src/renderer/src/pages/Content/content.scss rename to ui/autoMate/src/renderer/src/pages/ContentList/content.scss diff --git a/ui/autoMate/src/renderer/src/pages/Content/index.tsx b/ui/autoMate/src/renderer/src/pages/ContentList/index.tsx similarity index 83% rename from ui/autoMate/src/renderer/src/pages/Content/index.tsx rename to ui/autoMate/src/renderer/src/pages/ContentList/index.tsx index c2cab8b..78d7bdd 100644 --- a/ui/autoMate/src/renderer/src/pages/Content/index.tsx +++ b/ui/autoMate/src/renderer/src/pages/ContentList/index.tsx @@ -1,6 +1,6 @@ import "./content.scss" -export const Content = () => { +export const ContentList = () => { return (
list
content
diff --git a/ui/autoMate/src/renderer/src/router/index.tsx b/ui/autoMate/src/renderer/src/router/index.tsx index 32e7ee5..5c0bed0 100644 --- a/ui/autoMate/src/renderer/src/router/index.tsx +++ b/ui/autoMate/src/renderer/src/router/index.tsx @@ -2,7 +2,7 @@ import Config from "@renderer/pages/Config"; import Home from "@renderer/pages/Home"; import { createHashRouter } from "react-router-dom"; import {Category} from "@renderer/pages/Category"; -import { Content } from "@renderer/pages/Content"; +import { ContentList } from "@renderer/pages/ContentList"; import CategoryLoader from "@renderer/pages/Category/CategoryLoader"; const router = createHashRouter([ @@ -15,14 +15,14 @@ const router = createHashRouter([ element: , children: [ { - path: "", + path: "category", // 界面第一次打开时,默认显示的页面 element: , loader: CategoryLoader, children: [ { - index: true, - element: + path: "contentList/:cid", + element: } ] }