Create useFormState hook for modals
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 重构
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- frontend
调研方向
Start by comparing the repeated form state logic in BuyInModal.tsx, WithdrawalModal.tsx, DepositCore.tsx, TopUpModal.tsx, and QRDeposit.tsx. Create hooks/useFormState.ts from the specified generic interface, then refactor those modals while checking that their existing behavior remains unchanged. Done means all listed acceptance criteria are met without regressions.
由索引模型根据 Issue 内容生成。
描述
Priority: MEDIUM
Problem
Multiple modal components repeat identical form state logic:
BuyInModal.tsxWithdrawalModal.tsxDepositCore.tsxTopUpModal.tsxQRDeposit.tsx
Pattern repeated:
const [amount, setAmount] = useState("");
const [isProcessing, setIsProcessing] = useState(false);
const [error, setError] = useState<string | null>(null);
const [success, setSuccess] = useState(false);
Solution
Create a reusable form state hook:
// hooks/useFormState.ts
interface FormState<T> {
values: T;
setValues: (values: T) => void;
isProcessing: boolean;
setIsProcessing: (v: boolean) => void;
error: string | null;
setError: (e: string | null) => void;
success: boolean;
setSuccess: (s: boolean) => void;
reset: () => void;
}
const useFormState = <T>(initialValues: T): FormState<T> => { ... }
Acceptance Criteria
- Create
useFormStatehook with generic typing - Include processing, error, and success states
- Add reset functionality
- Refactor modals to use the hook
- Maintain existing behavior
Related
Parent issue: block52/ui#45
- 主要语言
- TypeScript
- 星标
- 2
- 派生
- 5
- 平均合并
- 23 小时 37 分钟
- 30 天内合并 PR
- 96
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
block52/ui 的其他 Issue
-
enhancement tech debt
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug: next-to-act flash stuck on the last folder when their fold closes a called all-in (fold + runout + hand_ended in one snapshot)可能已有人在做 @bitcoinbrisbane 于 2 天前认领。 未关闭animation bug game-flow sit-and-go UI Week 2
block52/ui#968 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
feat(ui): player language setting and translated player screens可能已有人在做 @Dzeezbtc 于 4 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
feat(ui): player notes and tags — click a seat to note a player; tag icons (fish, shark, tight, loose…) show by their pill可能已有人在做 @Dzeezbtc 于 7 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
-
architecture refactor tech debt
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
danielw-sudo/agentuto#63 ·
维护者通常 1 天内回复
-
idea-scout idea:341
难度 2/5 1-3 小时 新手友好度 76/100
jeanibarz/agent-notebook#341 ·
维护者通常 1 天内回复
-
documentation good first issue roadmap
难度 1/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
type:bug
难度 2/5 1-3 小时 新手友好度 72/100
nightgauge/nightgauge#3077 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
LibreChat-AI/LibreChat#17915 ·
维护者通常 1 天内回复