Merge branch 'ui' into for_webui

This commit is contained in:
Sakamoto Shiina
2024-09-02 12:12:02 +09:00
14 changed files with 163 additions and 38 deletions

View File

@@ -1,24 +1,26 @@
import { useIsOpenedConfigPage } from "@store";
import { getCurrent } from "@tauri-apps/api/window";
import { useEffect, useRef } from "react";
import { useStartPython } from "@logics/useStartPython";
import { useConfig } from "@logics/useConfig";
import { MainPage } from "./main_page/MainPage";
import { ConfigPage } from "./config_page/ConfigPage";
import styles from "./App.module.scss";
import clsx from "clsx";
export const App = () => {
const { asyncStartPython } = useStartPython();
const hasRunRef = useRef(false);
const main_page = getCurrent();
const { getSoftwareVersion } = useConfig();
const { currentIsOpenedConfigPage } = useIsOpenedConfigPage();
const { get_software_version } = useConfig();
useEffect(() => {
main_page.setDecorations(true);
if (!hasRunRef.current) {
asyncStartPython().then((result) => {
getSoftwareVersion();
get_software_version();
}).catch((err) => {
});
@@ -27,9 +29,16 @@ export const App = () => {
}, []);
return (
<>
<MainPage/>
<ConfigPage/>
</>
<div className={styles.container}>
<div className={clsx(styles.page, styles.config_page)}>
<ConfigPage />
</div>
<div className={clsx(styles.page, styles.main_page, {
[styles.show_config]: currentIsOpenedConfigPage,
[styles.show_main]: !currentIsOpenedConfigPage
})}>
<MainPage />
</div>
</div>
);
};

View File

@@ -0,0 +1,33 @@
.container {
position: relative;
width: 100%;
height: 100vh;
overflow: hidden;
}
.page {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow: hidden;
}
.main_page {
// z-index: 1;
transition: transform 0.5s ease;
}
.config_page {
// z-index: 0;
}
.show_config.main_page {
transform: translateY(-100%);
}
.show_main.main_page {
transform: translateY(0);
}

View File

@@ -9,7 +9,7 @@ import { useTranslation } from "react-i18next";
// import { useConfig } from "@logics/useConfig";
export const ConfigPage = () => {
const { currentSoftwareVersion, updateSoftwareVersion } = useSoftwareVersion();
const { currentSoftwareVersion } = useSoftwareVersion();
const { t } = useTranslation();
return (

View File

@@ -4,7 +4,7 @@
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: var(--dark_950_color);
background-color: var(--dark_900_color);
overflow: hidden;
position: relative;
}

View File

@@ -5,5 +5,5 @@
}
.container {
margin: 6rem 4rem 16rem 3.2rem;
margin: 0rem 4rem 16rem 0.6rem;
}

View File

@@ -6,16 +6,16 @@
.dropdown_toggle_button {
position: relative;
background-color: var(--dark_925_color);
background-color: var(--dark_950_color);
min-width: 20rem;
padding: 0.6rem 1rem;
cursor: pointer;
border-radius: 0.4rem;
&:hover {
background-color: var(--dark_850_color);
background-color: var(--dark_925_color);
}
&:active {
background-color: var(--dark_950_color);
background-color: var(--dark_975_color);
}
&.is_loading {
pointer-events: none;

View File

@@ -3,7 +3,6 @@
width: 100%;
justify-content: space-between;
align-items: center;
background-color: var(--dark_888_color);
padding: 2rem;
display: flex;
justify-content: space-between;
@@ -12,6 +11,7 @@
&.flex_column {
flex-direction: column;
}
border-bottom: solid 0.1rem var(--dark_800_color);
}
.label_only_section {
@@ -25,7 +25,6 @@
justify-content: space-between;
align-items: center;
gap: 2rem;
background-color: var(--dark_888_color);
padding: 2rem;
}
@@ -61,7 +60,6 @@
justify-content: space-between;
align-items: center;
gap: 2rem;
background-color: var(--dark_888_color);
padding: 2rem;
}

View File

@@ -4,7 +4,7 @@
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 5.8rem 0rem 5.8rem 2.8rem;
padding: 0rem 0rem 5.8rem 1.6rem;
max-height: 60rem;
}
@@ -23,7 +23,7 @@
justify-content: left;
align-items: center;
color: var(--dark_basic_text_color);
padding: 0.8rem 0 0.8rem 1.8rem;
padding: 0.8rem 0 0.8rem 1.2rem;
cursor: pointer;
&:hover {
background-color: var(--dark_800_color);
@@ -55,7 +55,7 @@
}
.tab_text {
font-size: 1.8rem;
font-size: 1.6rem;
}
.separated_tabs_wrapper {

View File

@@ -1,16 +1,37 @@
import clsx from "clsx";
import styles from "./Topbar.module.scss";
import { useIsOpenedConfigPage } from "@store";
import ArrowLeftSvg from "@images/arrow_left.svg?react";
import { TitleBox } from "./title_box/TitleBox";
import { SectionTitleBox } from "./section_title_box/SectionTitleBox";
import { CompactSwitchBox } from "./compact_switch_box/CompactSwitchBox";
export const Topbar = () => {
const { currentIsOpenedConfigPage, updateIsOpenedConfigPage } = useIsOpenedConfigPage();
const closeConfigPage = () => {
updateIsOpenedConfigPage(false);
};
return (
<div className={styles.container}>
<div className={styles.wrapper}>
<TitleBox />
<div className={clsx(styles.container, {
[styles.show_config]: currentIsOpenedConfigPage,
[styles.show_main]: !currentIsOpenedConfigPage
})}>
<div className={styles.wrapper} onClick={() => closeConfigPage()}>
<div className={styles.go_back_button}>
<ArrowLeftSvg className={styles.arrow_left_svg} />
</div>
<div className={styles.go_back_text_wrapper}>
<p className={styles.go_back_text}>Go Back</p>
</div>
{/* <TitleBox />
<SectionTitleBox />
<CompactSwitchBox />
<CompactSwitchBox /> */}
</div>
</div>
);

View File

@@ -1,12 +1,79 @@
.container {
width: 100%;
height: 0%;
transition: transform 0.5s ease;
}
.show_config.container {
transform: translateY(0vh);
}
.show_main.container {
transform: translateY(100vh);
}
.wrapper {
height: var(--config_page_topbar_height);
background-color: var(--dark_850_color);
display: flex;
justify-content: space-between;
flex-shrink: 0;
cursor: pointer;
height: 1rem;
width: 100%;
position: relative;
transition: all 0.3s ease;
&:hover {
height: 2rem;
.go_back_button {
top: -12rem;
transform: rotate(35deg);
}
.arrow_left_svg {
color: var(--dark_400_color);
}
.go_back_text {
color: var(--dark_400_color);
}
.go_back_text_wrapper {
padding-top: 8.2rem;
}
}
}
.go_back_button {
height: 16rem;
width: 16rem;
border-radius: 1.2rem;
background-color: var(--dark_850_color);
position: absolute;
top: -13.2rem;
right: 10rem;
transform: rotate(30deg);
transition: all 0.3s ease;
}
.arrow_left_svg {
height: 2.8rem;
position: absolute;
right: 1rem;
bottom: 0.4rem;
color: var(--dark_600_color);
transform: rotate(-100deg);
}
.go_back_text_wrapper {
position: absolute;
top: -4.6rem;
right: 0rem;
padding-top: 7.2rem;
padding-bottom: 1rem;
width: 15.2rem;
transition: all 0.3s ease;
}
.go_back_text {
color: var(--dark_650_color);
font-size: 1.6rem;
padding-left: 4rem;
transition: all 0.3s ease;
}

View File

@@ -3,6 +3,7 @@
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
}
.logo {

View File

@@ -9,7 +9,7 @@
.switch_container {
position: relative;
display: flex;
justify-content: center;
justify-content: space-between;
align-items: center;
padding: 1.6rem 1.4rem;
background-color: var(--dark_825_color);
@@ -29,7 +29,6 @@
}
.label_wrapper {
width: 100%;
display: flex;
justify-content: left;
align-items: center;
@@ -85,7 +84,6 @@ $loading_label_color: var(--dark_500_color);
display: flex;
justify-content: end;
align-items: center;
width: 100%;
&.is_compact_mode {
display: none;
}

View File

@@ -1,14 +1,12 @@
import styles from "./OpenSettings.module.scss";
import { useIsOpenedConfigPage } from "@store";
import ConfigurationSvg from "@images/configuration.svg?react";
// import { useWindow } from "@logics/useWindow";
export const OpenSettings = () => {
// const { createConfigPage } = useWindow();
const { updateIsOpenedConfigPage } = useIsOpenedConfigPage();
const openConfigPage = () => {
// createConfigPage();
updateIsOpenedConfigPage(true);
};
return (

View File

@@ -46,6 +46,6 @@
--main_page_topbar_height: 4.8rem;
--config_page_sidebar_width: 22rem;
--config_page_topbar_height: 5.2rem;
--config_page_sidebar_width: 18rem;
--config_page_topbar_height: 8rem;
}