Skip to content

Commit 3bb2037

Browse files
committed
feat: delete lore entry confirm
1 parent 1634bf6 commit 3bb2037

File tree

6 files changed

+27
-19
lines changed

6 files changed

+27
-19
lines changed

src/components/tabs/BookEntryEditor.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ export const BookEntryEditor: FC<{
7171
<Card className={styles.bookEntryCard}>
7272
<div className={styles.bookEntryHeader}>
7373
<span>
74+
{/* 收起展开 */}
75+
<Tooltip
76+
relationship="label"
77+
content={expanded ? t("Collapse") : t("Expand")}
78+
>
79+
<Button
80+
icon={
81+
expanded ? <ChevronUp24Regular /> : <ChevronDown24Regular />
82+
}
83+
appearance="subtle"
84+
onClick={() => setExpanded(!expanded)}
85+
aria-label={expanded ? t("Collapse") : t("Expand")}
86+
/>
87+
</Tooltip>
7488
<Text weight="semibold">
7589
Entry {index + 1} {entry_title ? `(${entry_title})` : ""}
7690
</Text>
@@ -92,21 +106,6 @@ export const BookEntryEditor: FC<{
92106
)}
93107
</span>
94108
<div>
95-
{/* 收起展开 */}
96-
<Tooltip
97-
relationship="label"
98-
content={expanded ? t("Collapse") : t("Expand")}
99-
>
100-
<Button
101-
icon={
102-
expanded ? <ChevronUp24Regular /> : <ChevronDown24Regular />
103-
}
104-
appearance="subtle"
105-
onClick={() => setExpanded(!expanded)}
106-
aria-label={expanded ? t("Collapse") : t("Expand")}
107-
/>
108-
</Tooltip>
109-
110109
<Tooltip content={t("Delete this entry")} relationship="label">
111110
<Button
112111
icon={<Delete24Regular />}

src/components/tabs/CharacterBookTab.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export const CharacterBookTab: FC<{
5353
};
5454

5555
const handleDeleteEntry = (index: any) => {
56+
const isConfirm = window.confirm(
57+
t("Are you sure you want to delete this entry?")
58+
);
59+
if (!isConfirm) return;
60+
5661
const newEntries = (bookData.entries || []).filter(
5762
(_: any, i: any) => i !== index
5863
);

src/locals/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,6 @@
180180
],
181181
"Load image from url": "Load image from url",
182182
"Load": "Load",
183-
"Copy/Paste character card current page will auto detect": "Copy/Paste character card current page will auto detect"
183+
"Copy/Paste character card current page will auto detect": "Copy/Paste character card current page will auto detect",
184+
"Are you sure you want to delete this entry?": "Are you sure you want to delete this entry?"
184185
}

src/locals/ja.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,6 @@
192192
],
193193
"Load image from url": "Load image from url",
194194
"Load": "Load",
195-
"Copy/Paste character card current page will auto detect": "Copy/Paste character card current page will auto detect"
195+
"Copy/Paste character card current page will auto detect": "Copy/Paste character card current page will auto detect",
196+
"Are you sure you want to delete this entry?": "Are you sure you want to delete this entry?"
196197
}

src/locals/ko.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,6 @@
192192
],
193193
"Load image from url": "Load image from url",
194194
"Load": "Load",
195-
"Copy/Paste character card current page will auto detect": "Copy/Paste character card current page will auto detect"
195+
"Copy/Paste character card current page will auto detect": "Copy/Paste character card current page will auto detect",
196+
"Are you sure you want to delete this entry?": "Are you sure you want to delete this entry?"
196197
}

src/locals/zh.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,6 @@
192192
],
193193
"Load image from url": "从url加载图片",
194194
"Load": "加载",
195-
"Copy/Paste character card current page will auto detect": "复制/粘贴角色卡当前页面将自动检测"
195+
"Copy/Paste character card current page will auto detect": "复制/粘贴角色卡当前页面将自动检测",
196+
"Are you sure you want to delete this entry?": "您确定要删除此条目吗?"
196197
}

0 commit comments

Comments
 (0)