Skip to content

Commit 91e1919

Browse files
author
Ryan Roland Dabao
committed
fix: address CodeRabbit review feedback for UpgradeModal and CI
- CI: pin Bun to 1.3.4 and use --frozen-lockfile for reproducible builds - UpgradeModal: refactor to Radix Dialog for proper a11y (role, aria-modal, focus trap, Escape) - Use feature/currentTier props in rendered content - Add optional onUpgrade callback prop
1 parent 71666ad commit 91e1919

2 files changed

Lines changed: 43 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ jobs:
4444

4545
- uses: oven-sh/setup-bun@v1
4646
with:
47-
bun-version: latest
47+
bun-version: "1.3.4"
4848

4949
- name: Install dependencies
50-
run: bun install
50+
run: bun install --frozen-lockfile
5151

5252
- name: TypeScript check
5353
run: bunx tsc --noEmit

src/components/interview-lab/UpgradeModal.tsx

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,58 @@
11
'use client';
22

33
import React from 'react';
4+
import {
5+
Dialog,
6+
DialogContent,
7+
DialogHeader,
8+
DialogTitle,
9+
DialogDescription,
10+
DialogFooter,
11+
} from '@/components/ui/dialog';
12+
import { Button } from '@/components/ui/button';
413

514
export interface UpgradeModalProps {
615
open: boolean;
716
onClose: () => void;
17+
onUpgrade?: () => void;
818
feature: string;
919
reason: string;
1020
currentTier: string;
1121
recommendedTier: string;
1222
}
1323

14-
export function UpgradeModal({ open, onClose, feature, reason, currentTier, recommendedTier }: UpgradeModalProps) {
15-
if (!open) return null;
24+
export function UpgradeModal({
25+
open,
26+
onClose,
27+
onUpgrade,
28+
feature,
29+
reason,
30+
currentTier,
31+
recommendedTier,
32+
}: UpgradeModalProps) {
1633
return (
17-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/30">
18-
<div className="bg-white rounded-lg border border-[#E5E5E0] shadow-lg w-full max-w-sm mx-4 p-4 space-y-3">
19-
<h3 className="text-base font-semibold text-[#171717]">Upgrade Required</h3>
20-
<p className="text-sm text-[#404040] break-words">{reason}</p>
21-
<div className="flex gap-2">
22-
<button onClick={onClose} className="flex-1 px-3 py-2 rounded-md border border-[#E5E5E0] text-sm font-medium text-[#171717]">Close</button>
23-
<button onClick={onClose} className="flex-1 px-3 py-2 rounded-md bg-[#FF6B35] text-white text-sm font-medium">Upgrade to {recommendedTier}</button>
24-
</div>
25-
</div>
26-
</div>
34+
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
35+
<DialogContent className="sm:max-w-sm">
36+
<DialogHeader>
37+
<DialogTitle>Upgrade Required</DialogTitle>
38+
<DialogDescription>
39+
The <span className="font-medium text-ink-900">{feature}</span> feature
40+
requires a {recommendedTier} plan. You are currently on the {currentTier} plan.
41+
</DialogDescription>
42+
</DialogHeader>
43+
44+
<p className="text-sm text-ink-500">{reason}</p>
45+
46+
<DialogFooter>
47+
<Button variant="ghost" onClick={onClose}>
48+
Close
49+
</Button>
50+
<Button variant="primary" onClick={onUpgrade ?? onClose}>
51+
Upgrade to {recommendedTier}
52+
</Button>
53+
</DialogFooter>
54+
</DialogContent>
55+
</Dialog>
2756
);
2857
}
2958

0 commit comments

Comments
 (0)