From 7e60e2ecbb8b20b3687bb14b9b7dd694de266016 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Tue, 3 Mar 2026 15:38:48 +0800 Subject: [PATCH] add download options page --- src/manage/qd/BookIndex.module.css | 5 +++++ src/manage/qd/BookIndex.tsx | 33 +++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/manage/qd/BookIndex.module.css b/src/manage/qd/BookIndex.module.css index 8613e9a..65d71c9 100644 --- a/src/manage/qd/BookIndex.module.css +++ b/src/manage/qd/BookIndex.module.css @@ -35,6 +35,11 @@ white-space: pre-wrap; } +.actions { + max-width: min(calc(100% - 20px), 940px); + margin: 4px auto; +} + .affix { background-color: white; } diff --git a/src/manage/qd/BookIndex.tsx b/src/manage/qd/BookIndex.tsx index 86de5da..17038b0 100644 --- a/src/manage/qd/BookIndex.tsx +++ b/src/manage/qd/BookIndex.tsx @@ -1,4 +1,4 @@ -import { Affix, Flex, Space, Tag, Typography, Skeleton, Result, Button } from "antd"; +import { Affix, Flex, Space, Tag, Typography, Skeleton, Result, Button, Modal } from "antd"; import { useBookInfo } from "./BookInfoProvider"; import styles from './BookIndex.module.css'; import { loadChapterListsIfNeeded, useBookContext, useBookStatus } from "./BookStatusProvider"; @@ -9,6 +9,8 @@ import type { Volume } from "../../qdtypes"; import { ChapterShowMode, get_new_volumes } from "../../utils/qd"; import ShowMode from "./ShowMode"; import { sendMessageToTab, waitTabLoaded } from "../../utils"; +import { QdBookDownloadOptions } from "../../types"; +import SwitchLabel from "../../components/SwitchLabel"; const { Paragraph, Link } = Typography; @@ -20,6 +22,8 @@ export default function BookIndex() { const [bookStatus, setBookStatus] = useBookStatus(); const setItems = useBookContext(); const [err, setErr] = useState(null); + const [saveChapterOpenAsEpub, setSaveChapterOpenAsEpub] = useState(false); + const [downloadOptions, setDownloadOptions] = useState({}); function setChapterShowMode(chapterShowMode: ChapterShowMode) { setBookStatus({ ...bookStatus, chapterShowMode }); } @@ -41,6 +45,7 @@ export default function BookIndex() { await sendMessageToTab(tab.id!, { type: 'DownloadQdBookAsEpub', info: bookInfo, + options: downloadOptions, }); } useEffect(() => { @@ -75,8 +80,30 @@ export default function BookIndex() { ))} - - + + + setSaveChapterOpenAsEpub(false)} + onOk={() => { + setSaveChapterOpenAsEpub(false); + handleSaveAsEpub(); + }} + title="保存为EPUB" + okText="保存" + cancelText="取消" + > + setDownloadOptions({ ...downloadOptions, skipNotBoughtChapters: checked })} + label="跳过未购买章节" + /> + setDownloadOptions({ ...downloadOptions, skipUnsavedChapters: checked })} + label="跳过未保存章节" + /> +