From 1bded00d538b30fa516a80ae859e4d1e05c335fa Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 10 Apr 2026 00:40:23 +0800 Subject: [PATCH] core&ui: add group bulk import/export --- packages/hydrooj/locales/zh.yaml | 7 ++ packages/hydrooj/locales/zh_TW.yaml | 7 ++ .../ui-default/components/dialog/index.tsx | 17 ++++- .../ui-default/pages/domain_group.page.ts | 71 ++++++++++++++++++- .../ui-default/templates/domain_group.html | 2 + 5 files changed, 101 insertions(+), 3 deletions(-) diff --git a/packages/hydrooj/locales/zh.yaml b/packages/hydrooj/locales/zh.yaml index 418be668a..006019b5f 100644 --- a/packages/hydrooj/locales/zh.yaml +++ b/packages/hydrooj/locales/zh.yaml @@ -30,6 +30,7 @@ __langname: 简体中文 'Discussion: Terms Of Service': 讨论区服务条款 'First Blood Notice\n{0} solved problem {1} ({2})': '题目一血提示\n{0} 解决了题目 {1} ({2})' 'Format: category 1, sub category 1.1, sub category 1.2, ..., sub category 1.x, ..., category n, sub category n.1, sub category n.2, ..., sub category n.m, ...': 格式:分类1, 子分类1.1, 子分类1.2, ..., 子分类1.x, ..., 分类n, 子分类n.1, 子分类n.2, ..., 子分类n.m, ... +'Format: one group per line, CSV: groupName,uid1,uid2,...': '格式:每行一个小组,CSV:组名,UID1,UID2,...' 'Join {0}': '加入 {0}' 'No': 否 'Note: Problem title may not be hidden.': 注意:题目标题可能不会被隐藏。 @@ -181,6 +182,7 @@ Continue: 继续 Contributed Problems: 贡献的题目 Contributions: 贡献 Copy Email: 复制电子邮件 +Copy the content below: 复制下方的内容 Copy from: 复制自 Copy QQ Number: 复制QQ号 Copy WeChat Account: 复制微信号 @@ -340,6 +342,7 @@ expand: 展开 Expire: 过期 Export All Code: 导出所有代码 Export as {0}: 导出为 {0} +Export Groups: 批量导出小组 Extension (days): 最长延期 (日) Extension Score Penalty: 延期递交扣分规则 Failed to join the domain. You are already a member.: 加入域失败,您已是该域的成员。 @@ -400,9 +403,11 @@ If left blank, the built-in template of the corresponding language will be used. Images: 图片 Import From Hydro: 从 Hydro 导入 Import from: 导入自 +Import Groups: 批量导入小组 Import Problem: 导入题目 Import User: 导入用户 Import: 导入 +Imported successfully.: 导入成功。 In 1 day: 一天后 In 1 month: 一个月后 In 1 week: 一周后 @@ -549,6 +554,7 @@ Open Source: 开源 Open: 开放 Operating System: 操作系统 Ops: 运维 +Or paste CSV content: 或粘贴 CSV 内容 Or, with automatically filled invitation code: 或者,这是可以自动填写邀请码的 Ordered List: 有序列表 Original Score: 原始分数 @@ -850,6 +856,7 @@ Unstar: 取消收藏 Update Permission: 更新权限 Update Settings: 更新设置 Update: 更新 +Upload CSV File: 上传 CSV 文件 Upload File: 上传文件 Upload Problem: 上传题目 Upload: 上传 diff --git a/packages/hydrooj/locales/zh_TW.yaml b/packages/hydrooj/locales/zh_TW.yaml index 10a630467..5b740d8f4 100644 --- a/packages/hydrooj/locales/zh_TW.yaml +++ b/packages/hydrooj/locales/zh_TW.yaml @@ -30,6 +30,7 @@ __langname: 正體中文 'Discussion: Terms Of Service': '討論區服務條款' 'First Blood Notice\n{0} solved problem {1} ({2})': '題目首殺提示\n{0} 解決了題目 {1} ({2})' 'Format: category 1, sub category 1.1, sub category 1.2, ..., sub category 1.x, ..., category n, sub category n.1, sub category n.2, ..., sub category n.m, ...': '格式:分類1, 子分類1.1, 子分類1.2, ..., 子分類1.x, ..., 分類n, 子分類n.1, 子分類n.2, ..., 子分類n.m, ...' +'Format: one group per line, CSV: groupName,uid1,uid2,...': '格式:每行一個小組,CSV:組名,UID1,UID2,...' 'No': '否' 'Note: Problem title may not be hidden.': '注意:題目標題可能不會被隱藏。' 'Or upload a file:': '或者上傳一個檔案:' @@ -177,6 +178,7 @@ Continue: 繼續 Contributed Problems: 貢獻的題目 Contributions: 貢獻 Copy Email: 複製電子郵件 +Copy the content below: 複製下方的內容 Copy from: 複製自 Copy QQ Number: 複製QQ號 Copy WeChat Account: 複製微訊號 @@ -337,6 +339,7 @@ expand: 展開 Expire: 過期 Export All Code: 匯出所有原始碼 Export as {0}: 匯出為 {0} +Export Groups: 批量匯出小組 Extension (days): 最長延期(日) Extension Score Penalty: 延期遞交扣分規則 Failed to join the domain. You are already a member.: 加入域失敗,您已是該域的成員。 @@ -397,9 +400,11 @@ If left blank, the built-in template of the corresponding language will be used. Images: 圖片 Import From Hydro: 從 Hydro 匯入 Import from: 匯入自 +Import Groups: 批量匯入小組 Import Problem: 匯入題目 Import User: 匯入使用者 Import: 匯入 +Imported successfully.: 匯入成功。 In 1 day: 一天後 In 1 month: 一個月後 In 1 week: 一週後 @@ -547,6 +552,7 @@ Open Source: 開源 Open: 開放 Operating System: 作業系統 Ops: 運維 +Or paste CSV content: 或貼上 CSV 內容 Or, with automatically filled invitation code: 或者,可以使用自動填寫邀請碼 Ordered List: 有序列表 Original Score: 原始得分 @@ -849,6 +855,7 @@ Unstar: 取消收藏 Update Permission: 更新許可權 Update Settings: 更新設定 Update: 更新 +Upload CSV File: 上傳 CSV 檔案 Upload File: 上傳檔案 Upload Problem: 上傳題目 Upload: 上傳 diff --git a/packages/ui-default/components/dialog/index.tsx b/packages/ui-default/components/dialog/index.tsx index cc639332d..527b6efbc 100644 --- a/packages/ui-default/components/dialog/index.tsx +++ b/packages/ui-default/components/dialog/index.tsx @@ -114,7 +114,7 @@ export class ConfirmDialog extends Dialog { } export interface Field { - type: 'text' | 'checkbox' | 'user' | 'userId' | 'username' | 'domain'; + type: 'text' | 'textarea' | 'checkbox' | 'user' | 'userId' | 'username' | 'domain'; options?: string[] | Record; placeholder?: string; label?: string; @@ -122,10 +122,11 @@ export interface Field { required?: boolean; default?: string; columns?: number; + rows?: number; } type Result> = { - [K in keyof R]: R[K]['type'] extends ('text' | 'password' | 'username' | 'domain') ? string + [K in keyof R]: R[K]['type'] extends ('text' | 'password' | 'username' | 'domain' | 'textarea') ? string : R[K]['type'] extends 'checkbox' ? boolean : R[K]['type'] extends 'userId' ? number : R[K]['type'] extends 'user' ? any @@ -175,6 +176,18 @@ export async function prompt>(title {layout.map((i) =>
{i.map(([name, field]: [string, Field]) =>
+ {field.type === 'textarea' &&