[Update] Config Page: Add Others Tab. Add section Auto Clear Message Box.

This commit is contained in:
Sakamoto Shiina
2024-09-08 17:43:54 +09:00
parent 33cd7b442d
commit 28a602e01e
7 changed files with 83 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ import { useSelectedConfigTabId } from "@store";
import { Device } from "./device/Device";
import { Appearance } from "./appearance/Appearance";
import { Others } from "./others/Others";
import { AboutVrct } from "./about_vrct/AboutVrct";
export const SettingBox = () => {
@@ -9,6 +10,8 @@ export const SettingBox = () => {
switch (currentSelectedConfigTabId) {
case "device":
return <Device />;
case "others":
return <Others />;
// case "appearance":
// return <Appearance />;
// case "about_vrct":

View File

@@ -1,22 +1,18 @@
import React, { useState } from 'react';
import styles from "./Checkbox.module.scss";
export const Checkbox = (props) => {
const [isChecked, setIsChecked] = useState(false);
const handleCheckboxChange = () => {
setIsChecked(!isChecked);
};
return (
<div className={styles.checkbox_container}>
<label className={styles.checkbox_wrapper} htmlFor={props.checkbox_id}>
<input
type="checkbox"
id={props.checkbox_id}
checked={isChecked}
onChange={handleCheckboxChange}
/>
{(props.state === "loading")
? <span className={styles.loader}></span>
: <input
type="checkbox"
id={props.checkbox_id}
checked={props.variable.data}
onChange={props.toggleFunction}
/>
}
<span className={styles.cbx}>
<svg viewBox="0 0 12 12">
<polyline points="1 6.29411765 4.5 10 11 1"></polyline>

View File

@@ -1,5 +1,7 @@
@import "@scss_mixins";
.checkbox_container {
width: 100%;
// width: 100%;
height: 100%;
display: flex;
justify-content: end;
@@ -10,6 +12,7 @@
display: inline-block;
cursor: pointer;
padding: 2rem;
position: relative;
&:hover {
& .cbx {
border: var(--primary_600_color) solid 0.2rem;
@@ -51,3 +54,7 @@
stroke-dashoffset: 0;
transition: all 0.15s ease;
}
.loader {
@include loader(2rem, 0.2rem, right, -2rem);
}

View File

@@ -0,0 +1,30 @@
import { useTranslation } from "react-i18next";
import { useSettingBox } from "../components/useSettingBox";
// import {
// useEnableAutoClearMessageBox,
// } from "@store";
import { useConfig } from "@logics/useConfig";
export const Others = () => {
const { t } = useTranslation();
const {
CheckboxContainer,
RadioButtonContainer,
} = useSettingBox();
const { currentEnableAutoClearMessageBox, toggleEnableAutoClearMessageBox } = useConfig();
return (
<>
<CheckboxContainer
label={t("config_page.auto_clear_the_message_box.label")}
variable={currentEnableAutoClearMessageBox}
toggleFunction={toggleEnableAutoClearMessageBox}
/>
{/* <RadioButtonContainer label={t("config_page.send_message_button_type.label")} checkbox_id="checkbox_id_1"/> */}
</>
);
};