feat: replace export with copy-to-clipboard and add dynamic label filter#2088
Open
MiaoZang wants to merge 1 commit intolbjlaq:mainfrom
Open
feat: replace export with copy-to-clipboard and add dynamic label filter#2088MiaoZang wants to merge 1 commit intolbjlaq:mainfrom
MiaoZang wants to merge 1 commit intolbjlaq:mainfrom
Conversation
- Replace export button with copy button (Download -> Copy icon) - Copy single account JSON to clipboard instead of downloading file - Add dynamic label filter tabs after PRO/ULTRA/FREE filters - Labels are auto-collected from account custom_label field - Label filter buttons shown with purple theme for visual distinction
Author
筛选优化 - 新增标签筛选功能修改时间: 2026-02-23 02:05 需求原始筛选条件为固定 4 项:全部 PRO ULTRA FREE 用户给账号添加自定义标签后,标签应自动出现在筛选条件栏末尾: 修改文件Accounts.tsx1. 扩展 FilterType 类型(第 34 行)-type FilterType = "all" | "pro" | "ultra" | "free";
+type FilterType = "all" | "pro" | "ultra" | "free" | string;2. 新增:收集唯一标签 + 计算标签计数(约第 258 行后)// 收集所有唯一的自定义标签
const uniqueLabels = useMemo(() => {
const labels = new Set<string>();
searchedAccounts.forEach((a) => {
if (a.custom_label?.trim()) labels.add(a.custom_label.trim());
});
return Array.from(labels).sort();
}, [searchedAccounts]);
// 计算各标签的数量
const labelCounts = useMemo(() => {
const counts: Record<string, number> = {};
uniqueLabels.forEach((label) => {
counts[label] = searchedAccounts.filter(
(a) => a.custom_label?.trim() === label
).length;
});
return counts;
}, [searchedAccounts, uniqueLabels]);3. 扩展 filteredAccounts 过滤逻辑(约第 280 行) } else if (filter === "free") {
// ... existing free filter
+} else if (filter !== "all") {
+ // 自定义标签筛选
+ result = result.filter((a) => a.custom_label?.trim() === filter);
}4. 在 UI 按钮组中动态渲染标签按钮(FREE 按钮后,约第 920 行)
关联数据
|
Author
复制按钮修改修改时间: 2026-02-11 需求将账号卡片/列表中每个账号的「导出」按钮改为「复制」按钮:
修改文件1. Accounts.tsx将原来的 const handleCopyOne = async (accountId: string) => {
try {
const response = await exportAccounts([accountId]);
if (!response.accounts || response.accounts.length === 0) {
showToast(t("dashboard.toast.export_no_accounts"), "warning");
return;
}
// 单行 JSON,不格式化
const content = JSON.stringify(response.accounts[0]);
await navigator.clipboard.writeText(content);
showToast(t("common.copy") + " " + t("common.success"), "success");
} catch (error: any) {
console.error("Copy failed:", error);
showToast(`${t("common.error")}: ${error}`, "error");
}
};调用处: 2. AccountCard.tsx
3. AccountGrid.tsx
4. AccountTable.tsx同上模式,所有 5. AccountRow.tsx同上模式,所有 关键差异
注意事项
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
1. Copy Button (replaces Export)
2. Dynamic Label Filter