From f212eea1b785ff24f2588f2bfb0610e572f1055c Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 5 May 2023 13:41:54 +0800 Subject: [PATCH] navigate card --- .gitignore | 3 +- LICENSE | 21 +++++++++++++ frontend/src/App.css | 59 ------------------------------------- frontend/src/Pages/Home.tsx | 13 ++++++-- 4 files changed, 33 insertions(+), 63 deletions(-) create mode 100644 LICENSE delete mode 100644 frontend/src/App.css diff --git a/.gitignore b/.gitignore index 1a8590f..980fa23 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ build/bin node_modules frontend/dist .idea -.vs \ No newline at end of file +.vs +package.json.md5 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..40b78df --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 josStorer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/frontend/src/App.css b/frontend/src/App.css deleted file mode 100644 index f949d9c..0000000 --- a/frontend/src/App.css +++ /dev/null @@ -1,59 +0,0 @@ -#app { - height: 100vh; - text-align: center; -} - -#logo { - display: block; - width: 50%; - height: 50%; - margin: auto; - padding: 10% 0 0; - background-position: center; - background-repeat: no-repeat; - background-size: 100% 100%; - background-origin: content-box; -} - -.result { - height: 20px; - line-height: 20px; - margin: 1.5rem auto; -} - -.input-box .btn { - width: 60px; - height: 30px; - line-height: 30px; - border-radius: 3px; - border: none; - margin: 0 0 0 20px; - padding: 0 8px; - cursor: pointer; -} - -.input-box .btn:hover { - background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%); - color: #333333; -} - -.input-box .input { - border: none; - border-radius: 3px; - outline: none; - height: 30px; - line-height: 30px; - padding: 0 10px; - background-color: rgba(240, 240, 240, 1); - -webkit-font-smoothing: antialiased; -} - -.input-box .input:hover { - border: none; - background-color: rgba(255, 255, 255, 1); -} - -.input-box .input:focus { - border: none; - background-color: rgba(255, 255, 255, 1); -} \ No newline at end of file diff --git a/frontend/src/Pages/Home.tsx b/frontend/src/Pages/Home.tsx index 0a584f9..91c2fcf 100644 --- a/frontend/src/Pages/Home.tsx +++ b/frontend/src/Pages/Home.tsx @@ -1,4 +1,4 @@ -import {Text, Combobox, CompoundButton, Link, Option} from '@fluentui/react-components'; +import {Combobox, CompoundButton, Link, Option, Text} from '@fluentui/react-components'; import React, {FC, ReactElement} from 'react'; import Banner from '../assets/images/banner.jpg'; import { @@ -7,6 +7,7 @@ import { DocumentSettings20Regular, Storage20Regular } from '@fluentui/react-icons'; +import {useNavigate} from 'react-router'; type NavCard = { label: string; @@ -15,7 +16,7 @@ type NavCard = { icon: ReactElement; }; -export const navCards:NavCard[] = [ +export const navCards: NavCard[] = [ { label: 'Chat', desc: 'Go to chat page', @@ -45,6 +46,12 @@ export const navCards:NavCard[] = [ export const Home: FC = () => { const [selectedConfig, setSelectedConfig] = React.useState('RWKV-3B-4G MEM'); + const navigate = useNavigate(); + + const onClickNavCard = (path: string) => { + navigate({pathname: path}); + }; + return (
@@ -63,7 +70,7 @@ export const Home: FC = () => {
{navCards.map(({label, path, icon, desc}, index) => ( + size="large" onClick={() => onClickNavCard(path)}> {label} ))}