refactor(frontend): extract reusable hooks and page helper modules

This commit is contained in:
Sagit
2026-02-19 05:14:11 +00:00
parent 6d57b49595
commit c5124a01e6
24 changed files with 2072 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
export const getConnectionStatusMeta = (
status: "online" | "offline",
): { color: "success" | "danger"; text: string } => {
if (status === "online") {
return { color: "success", text: "在线" };
}
return { color: "danger", text: "离线" };
};
export const getRemoteSyncErrorMessage = (syncError: string): string => {
if (syncError === "provider_share_deleted") {
return "提供方已删除该分享";
}
if (syncError === "provider_share_disabled") {
return "提供方已禁用该分享";
}
if (syncError === "provider_share_expired") {
return "提供方分享已过期";
}
return `远程同步失败: ${syncError}`;
};