Skip to content

Commit f665464

Browse files
nerderlyneclaude
andcommitted
Make ragequit more visible
- Single collapsible section instead of nested disclosures - Clearer "Rage Quit" label visible in the panel - Simplified to one confirmation step - Normal-sized text and buttons Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d675142 commit f665464

1 file changed

Lines changed: 88 additions & 113 deletions

File tree

src/components/dao/RageQuit.tsx

Lines changed: 88 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const RageQuit = () => {
2626
const [amount, setAmount] = useState("");
2727
const [zammReceived, setZammReceived] = useState<bigint | null>(null);
2828
const [isExpanded, setIsExpanded] = useState(false);
29-
const [confirmStep, setConfirmStep] = useState(0);
29+
const [showConfirm, setShowConfirm] = useState(false);
3030

3131
const { data: zorgSharesBalance, isLoading: isBalanceLoading, refetch: refetchBalance } = useReadContract({
3232
address: ZORG_SHARES,
@@ -86,7 +86,7 @@ export const RageQuit = () => {
8686
}
8787

8888
setAmount("");
89-
setConfirmStep(0);
89+
setShowConfirm(false);
9090
refetchBalance();
9191
}
9292
}, [isSuccess, receipt, owner, refetchBalance]);
@@ -116,7 +116,7 @@ export const RageQuit = () => {
116116

117117
const handleReset = () => {
118118
setZammReceived(null);
119-
setConfirmStep(0);
119+
setShowConfirm(false);
120120
reset();
121121
};
122122

@@ -137,144 +137,119 @@ export const RageQuit = () => {
137137
return (
138138
<ConnectButton.Custom>
139139
{({ openConnectModal }) => (
140-
<div className="border-t border-border/40 pt-4 mt-4">
140+
<div className="border-t border-border/50 pt-4 mt-4">
141141
<button
142142
onClick={() => setIsExpanded(!isExpanded)}
143-
className="flex items-center gap-1.5 text-xs text-muted-foreground/60 hover:text-muted-foreground transition-colors w-full"
143+
className="flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors w-full"
144144
>
145145
<ChevronDown
146-
className={`h-3 w-3 transition-transform duration-200 ${isExpanded ? "rotate-180" : ""}`}
146+
className={`h-4 w-4 transition-transform duration-200 ${isExpanded ? "rotate-180" : ""}`}
147147
/>
148-
<span>Other options</span>
148+
<span>Rage Quit</span>
149149
</button>
150150

151151
{isExpanded && (
152-
<div className="mt-4 pt-4 border-t border-dashed border-border/30">
153-
<details className="group">
154-
<summary className="cursor-pointer text-xs text-muted-foreground/50 hover:text-muted-foreground/70 list-none flex items-center gap-1">
155-
<ChevronDown className="h-3 w-3 transition-transform group-open:rotate-180" />
156-
Exit DAO membership
157-
</summary>
152+
<div className="mt-4 p-4 rounded-lg border border-border/50 bg-muted/10">
153+
<p className="text-xs text-muted-foreground mb-4">
154+
Burn your ZORG shares to reclaim your proportional ZAMM from the treasury.
155+
</p>
158156

159-
<div className="mt-4 p-3 rounded border border-border/30 bg-muted/20">
160-
<p className="text-[11px] text-muted-foreground/70 mb-3">
161-
Burn ZORG shares to reclaim proportional ZAMM. This action is irreversible.
162-
</p>
157+
{owner && hasBalance && (
158+
<div className="mb-3 text-xs text-muted-foreground">
159+
Available: <span className="font-mono text-foreground">{formatEther(balance)} ZORG</span>
160+
</div>
161+
)}
163162

164-
{owner && hasBalance && (
165-
<div className="mb-2 text-[11px] text-muted-foreground/60">
166-
Balance: <span className="font-mono">{formatEther(balance)} ZORG</span>
167-
</div>
168-
)}
163+
<div className="flex gap-2 mb-4">
164+
<input
165+
type="text"
166+
inputMode="decimal"
167+
placeholder="Amount to burn"
168+
value={amount}
169+
onChange={(e) => {
170+
const val = e.target.value;
171+
if (/^[0-9]*\.?[0-9]*$/.test(val)) {
172+
setAmount(val);
173+
setShowConfirm(false);
174+
}
175+
}}
176+
className="flex-1 px-3 py-2 rounded-lg border bg-background text-sm font-mono focus:outline-none focus:ring-1 focus:ring-border"
177+
disabled={!owner || isLoading}
178+
/>
179+
<Button
180+
variant="outline"
181+
size="sm"
182+
onClick={() => {
183+
setAmount(formatEther(balance));
184+
setShowConfirm(false);
185+
}}
186+
disabled={!owner || !hasBalance || isLoading}
187+
className="text-xs"
188+
>
189+
MAX
190+
</Button>
191+
</div>
169192

170-
<div className="flex gap-2 mb-3">
171-
<input
172-
type="text"
173-
inputMode="decimal"
174-
placeholder="Amount"
175-
value={amount}
176-
onChange={(e) => {
177-
const val = e.target.value;
178-
if (/^[0-9]*\.?[0-9]*$/.test(val)) {
179-
setAmount(val);
180-
setConfirmStep(0);
181-
}
182-
}}
183-
className="flex-1 px-2 py-1.5 rounded border border-border/50 bg-background text-xs font-mono focus:outline-none focus:border-border"
184-
disabled={!owner || isLoading}
185-
/>
193+
{!showConfirm ? (
194+
<Button
195+
onClick={!owner ? openConnectModal : () => setShowConfirm(true)}
196+
disabled={owner && !isValidAmount}
197+
variant="outline"
198+
className="w-full"
199+
>
200+
{!owner ? "Connect Wallet" : "Continue"}
201+
</Button>
202+
) : (
203+
<div className="space-y-3">
204+
<p className="text-xs text-amber-600 dark:text-amber-500">
205+
Are you sure? This will permanently burn your ZORG shares.
206+
</p>
207+
<div className="flex gap-2">
186208
<Button
187-
variant="ghost"
188-
size="sm"
189-
onClick={() => {
190-
setAmount(formatEther(balance));
191-
setConfirmStep(0);
192-
}}
193-
disabled={!owner || !hasBalance || isLoading}
194-
className="text-[10px] h-7 px-2 text-muted-foreground/60"
209+
onClick={() => setShowConfirm(false)}
210+
variant="outline"
211+
className="flex-1"
195212
>
196-
MAX
213+
Cancel
197214
</Button>
198-
</div>
199-
200-
{confirmStep === 0 && (
201-
<Button
202-
onClick={!owner ? openConnectModal : () => setConfirmStep(1)}
203-
disabled={owner && !isValidAmount}
204-
variant="ghost"
205-
size="sm"
206-
className="w-full text-xs h-8 text-muted-foreground/70 hover:text-muted-foreground"
207-
>
208-
{!owner ? "Connect Wallet" : "Continue"}
209-
</Button>
210-
)}
211-
212-
{confirmStep === 1 && (
213-
<div className="space-y-2">
214-
<p className="text-[10px] text-amber-600/80 dark:text-amber-500/80">
215-
Are you sure? You will permanently lose your ZORG shares and DAO voting power.
216-
</p>
217-
<div className="flex gap-2">
218-
<Button
219-
onClick={() => setConfirmStep(0)}
220-
variant="ghost"
221-
size="sm"
222-
className="flex-1 text-xs h-8"
223-
>
224-
Cancel
225-
</Button>
226-
<Button
227-
onClick={() => setConfirmStep(2)}
228-
variant="ghost"
229-
size="sm"
230-
className="flex-1 text-xs h-8 text-amber-600/80 hover:text-amber-600"
231-
>
232-
I understand
233-
</Button>
234-
</div>
235-
</div>
236-
)}
237-
238-
{confirmStep === 2 && (
239215
<Button
240216
onClick={handleRageQuit}
241217
disabled={isLoading}
242-
variant="ghost"
243-
size="sm"
244-
className="w-full text-xs h-8 text-red-500/70 hover:text-red-500 hover:bg-red-500/10"
218+
variant="destructive"
219+
className="flex-1"
245220
>
246221
{isLoading ? (
247222
<>
248-
<Loader2 className="h-3 w-3 animate-spin mr-1.5" />
223+
<Loader2 className="h-4 w-4 animate-spin mr-2" />
249224
Processing...
250225
</>
251226
) : (
252-
"Confirm Ragequit"
227+
"Confirm"
253228
)}
254229
</Button>
255-
)}
230+
</div>
231+
</div>
232+
)}
256233

257-
{isSuccess && txHash && (
258-
<div className="mt-3 p-2 rounded bg-green-500/10 border border-green-500/20">
259-
<div className="flex items-center justify-between">
260-
<div>
261-
<span className="text-[10px] text-green-600/80 dark:text-green-400/80 block">
262-
Complete
263-
</span>
264-
{zammReceived !== null && (
265-
<span className="text-xs font-mono text-green-600 dark:text-green-400">
266-
+{formatEther(zammReceived)} ZAMM
267-
</span>
268-
)}
269-
</div>
270-
<Button variant="ghost" size="sm" onClick={handleReset} className="text-[10px] h-6 px-2">
271-
OK
272-
</Button>
273-
</div>
234+
{isSuccess && txHash && (
235+
<div className="mt-4 p-3 rounded-lg bg-green-500/10 border border-green-500/30">
236+
<div className="flex items-center justify-between">
237+
<div>
238+
<span className="text-xs text-green-600 dark:text-green-400 block">
239+
Ragequit successful!
240+
</span>
241+
{zammReceived !== null && (
242+
<span className="text-sm font-mono font-semibold text-green-600 dark:text-green-400">
243+
+{formatEther(zammReceived)} ZAMM
244+
</span>
245+
)}
274246
</div>
275-
)}
247+
<Button variant="ghost" size="sm" onClick={handleReset} className="text-xs">
248+
Done
249+
</Button>
250+
</div>
276251
</div>
277-
</details>
252+
)}
278253
</div>
279254
)}
280255
</div>

0 commit comments

Comments
 (0)