clean up sidesheet

This commit is contained in:
1ilit
2025-04-05 02:02:51 +04:00
parent 1eb4e298e9
commit 24c77a95e9
10 changed files with 30 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -1657,6 +1657,14 @@ export default function ControlPanel({
<IconSaveStroked size="extra-large" /> <IconSaveStroked size="extra-large" />
</button> </button>
</Tooltip> </Tooltip>
<Tooltip content={t("revisions")} position="bottom">
<button
className="py-1 px-2 hover-2 rounded-sm text-xl -mt-0.5"
onClick={() => setSidesheet(SIDESHEET.REVISIONS)}
>
<i className="fa-solid fa-code-branch" />{" "}
</button>
</Tooltip>
<Tooltip content={t("to_do")} position="bottom"> <Tooltip content={t("to_do")} position="bottom">
<button <button
className="py-1 px-2 hover-2 rounded-sm text-xl -mt-0.5" className="py-1 px-2 hover-2 rounded-sm text-xl -mt-0.5"

View File

@@ -0,0 +1,5 @@
export default function Revisions() {
return (
<div className="sidesheet-theme">Revisions</div>
)
}

View File

@@ -1,37 +1,21 @@
import { SideSheet as SemiUISideSheet } from "@douyinfe/semi-ui"; import { SideSheet as SemiUISideSheet } from "@douyinfe/semi-ui";
import { SIDESHEET } from "../../../data/constants"; import { SIDESHEET } from "../../../data/constants";
import { useSettings } from "../../../hooks";
import timeLine from "../../../assets/process.png";
import timeLineDark from "../../../assets/process_dark.png";
import todo from "../../../assets/calendar.png";
import Timeline from "./Timeline"; import Timeline from "./Timeline";
import Todo from "./Todo"; import Todo from "./Todo";
import Revisions from "./Revisions";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export default function Sidesheet({ type, onClose }) { export default function Sidesheet({ type, onClose }) {
const { t } = useTranslation(); const { t } = useTranslation();
const { settings } = useSettings();
function getTitle(type) { function getTitle(type) {
switch (type) { switch (type) {
case SIDESHEET.TIMELINE: case SIDESHEET.TIMELINE:
return ( return t("timeline");
<div className="flex items-center">
<img
src={settings.mode === "light" ? timeLine : timeLineDark}
className="w-7"
alt="chat icon"
/>
<div className="ms-3 text-lg">{t("timeline")}</div>
</div>
);
case SIDESHEET.TODO: case SIDESHEET.TODO:
return ( return t("to_do");
<div className="flex items-center"> case SIDESHEET.REVISIONS:
<img src={todo} className="w-7" alt="todo icon" /> return t("revisions");
<div className="ms-3 text-lg">{t("to_do")}</div>
</div>
);
default: default:
break; break;
} }
@@ -43,6 +27,8 @@ export default function Sidesheet({ type, onClose }) {
return <Timeline />; return <Timeline />;
case SIDESHEET.TODO: case SIDESHEET.TODO:
return <Todo />; return <Todo />;
case SIDESHEET.REVISIONS:
return <Revisions />;
default: default:
break; break;
} }
@@ -52,12 +38,12 @@ export default function Sidesheet({ type, onClose }) {
<SemiUISideSheet <SemiUISideSheet
visible={type !== SIDESHEET.NONE} visible={type !== SIDESHEET.NONE}
onCancel={onClose} onCancel={onClose}
width={340} width={420}
title={getTitle(type)} title={<div className="text-lg">{getTitle(type)}</div>}
style={{ paddingBottom: "16px" }} style={{ paddingBottom: "16px" }}
bodyStyle={{ padding: "0px" }} bodyStyle={{ padding: "0px" }}
> >
{getContent(type)} <div className="sidesheet-theme">{getContent(type)}</div>
</SemiUISideSheet> </SemiUISideSheet>
); );
} }

View File

@@ -8,7 +8,7 @@ export default function Timeline() {
if (undoStack.length > 0) { if (undoStack.length > 0) {
return ( return (
<List className="sidesheet-theme"> <List>
{[...undoStack].reverse().map((e, i) => ( {[...undoStack].reverse().map((e, i) => (
<List.Item <List.Item
key={i} key={i}
@@ -24,6 +24,6 @@ export default function Timeline() {
</List> </List>
); );
} else { } else {
return <div className="m-5 sidesheet-theme">{t("no_activity")}</div>; return <div className="m-5">{t("no_activity")}</div>;
} }
} }

View File

@@ -106,7 +106,7 @@ export default function Todo() {
return ( return (
<> <>
<div className="flex justify-between items-center mx-5 mb-2 sidesheet-theme"> <div className="flex justify-between items-center mx-5 mb-2">
<Dropdown <Dropdown
render={ render={
<Dropdown.Menu> <Dropdown.Menu>
@@ -153,7 +153,7 @@ export default function Todo() {
</Button> </Button>
</div> </div>
{tasks.length > 0 ? ( {tasks.length > 0 ? (
<List className="sidesheet-theme"> <List>
{tasks.map((task, i) => ( {tasks.map((task, i) => (
<List.Item <List.Item
key={i} key={i}
@@ -267,7 +267,7 @@ export default function Todo() {
))} ))}
</List> </List>
) : ( ) : (
<div className="m-5 sidesheet-theme">{t("no_tasks")}</div> <div className="m-5">{t("no_tasks")}</div>
)} )}
</> </>
); );

View File

@@ -99,6 +99,7 @@ export const SIDESHEET = {
NONE: 0, NONE: 0,
TODO: 1, TODO: 1,
TIMELINE: 2, TIMELINE: 2,
REVISIONS: 3,
}; };
export const DB = { export const DB = {

View File

@@ -258,6 +258,7 @@ const en = {
tab_view: "Tab view", tab_view: "Tab view",
label: "Label", label: "Label",
many_side_label: "Many(n) side label", many_side_label: "Many(n) side label",
revisions: "Revisions",
}, },
}; };