@@ -2,40 +2,77 @@ import { GlassButton } from "../components/ui/GlassButton";
22import { Button } from "@/components/ui/button" ;
33import { Label } from "@/components/ui/label" ;
44import {
5- Select , SelectTrigger , SelectValue , SelectContent , SelectItem
5+ Select ,
6+ SelectTrigger ,
7+ SelectValue ,
8+ SelectContent ,
9+ SelectItem ,
610} from "@/components/ui/select" ;
711import { useRepoStore } from "@/store/useRepoStore" ;
812
913export default function ConnectPage ( ) {
10- const { repos, branches, repo, branch, setRepo, setBranch, loadRepos, loadBranches } = useRepoStore ( ) ;
14+ const {
15+ repos,
16+ branches,
17+ repo,
18+ branch,
19+ setRepo,
20+ setBranch,
21+ loadRepos,
22+ loadBranches,
23+ } = useRepoStore ( ) ;
24+
25+ const handleGithubConnect = ( ) => {
26+ // Vite proxy sends this to backend http://localhost:3001/auth/github
27+ window . location . href = "http://localhost:3000/auth/github/start" ;
28+ } ;
1129
1230 return (
1331 < div className = "max-w-3xl mx-auto p-6 mt-10" >
1432 < div className = "rounded-2xl border border-white/20 bg-white/10 backdrop-blur-md shadow-glass p-6" >
15- < div className = "flex items-center justify-between mb-6" >
16- < h1 className = "text-xl font-semibold text-white/90" > Connect your repository</ h1 >
17- < GlassButton
18- variant = "secondary"
19- className = "bg-white/20 hover:bg-white/30 text-white"
20- onClick = { loadRepos }
21- >
22- Re-sync Repos
23- </ GlassButton >
33+ < div className = "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-6" >
34+ < h1 className = "text-xl font-semibold text-white/90" >
35+ Connect your repository
36+ </ h1 >
37+
38+ < div className = "flex gap-2" >
39+ { /* 🔐 OAuth button */ }
40+ < GlassButton
41+ className = "bg-emerald-400/20 hover:bg-emerald-400/30 text-emerald-50"
42+ onClick = { handleGithubConnect }
43+ >
44+ Connect GitHub
45+ </ GlassButton >
46+
47+ { /* 🔁 Re-sync repos */ }
48+ < GlassButton
49+ variant = "secondary"
50+ className = "bg-white/20 hover:bg-white/30 text-white"
51+ onClick = { loadRepos }
52+ >
53+ Re-sync Repos
54+ </ GlassButton >
55+ </ div >
2456 </ div >
2557
2658 < div className = "grid gap-4 md:grid-cols-2" >
2759 < div className = "grid gap-2" >
2860 < Label className = "text-white/80" > Repository</ Label >
2961 < Select
3062 value = { repo ?? "" }
31- onValueChange = { ( v ) => { setRepo ( v ) ; loadBranches ( v ) ; } }
63+ onValueChange = { ( v ) => {
64+ setRepo ( v ) ;
65+ loadBranches ( v ) ;
66+ } }
3267 >
3368 < SelectTrigger className = "bg-white/10 border-white/20 text-white" >
3469 < SelectValue placeholder = "Select a repo" />
3570 </ SelectTrigger >
3671 < SelectContent className = "bg-slate-900 text-white border-white/20" >
3772 { repos ?. map ( ( r ) => (
38- < SelectItem key = { r } value = { r } > { r } </ SelectItem >
73+ < SelectItem key = { r } value = { r } >
74+ { r }
75+ </ SelectItem >
3976 ) ) }
4077 </ SelectContent >
4178 </ Select >
@@ -49,11 +86,15 @@ export default function ConnectPage() {
4986 disabled = { ! repo }
5087 >
5188 < SelectTrigger className = "bg-white/10 border-white/20 text-white disabled:opacity-50" >
52- < SelectValue placeholder = { repo ? "Select a branch" : "Pick a repo first" } />
89+ < SelectValue
90+ placeholder = { repo ? "Select a branch" : "Pick a repo first" }
91+ />
5392 </ SelectTrigger >
5493 < SelectContent className = "bg-slate-900 text-white border-white/20" >
5594 { branches ?. map ( ( b ) => (
56- < SelectItem key = { b } value = { b } > { b } </ SelectItem >
95+ < SelectItem key = { b } value = { b } >
96+ { b }
97+ </ SelectItem >
5798 ) ) }
5899 </ SelectContent >
59100 </ Select >
@@ -73,3 +114,80 @@ export default function ConnectPage() {
73114 </ div >
74115 ) ;
75116}
117+
118+
119+ // import { GlassButton } from "../components/ui/GlassButton";
120+ // import { Button } from "@/components/ui/button";
121+ // import { Label } from "@/components/ui/label";
122+ // import {
123+ // Select, SelectTrigger, SelectValue, SelectContent, SelectItem
124+ // } from "@/components/ui/select";
125+ // import { useRepoStore } from "@/store/useRepoStore";
126+
127+ // export default function ConnectPage() {
128+ // const { repos, branches, repo, branch, setRepo, setBranch, loadRepos, loadBranches } = useRepoStore();
129+
130+ // return (
131+ // <div className="max-w-3xl mx-auto p-6 mt-10">
132+ // <div className="rounded-2xl border border-white/20 bg-white/10 backdrop-blur-md shadow-glass p-6">
133+ // <div className="flex items-center justify-between mb-6">
134+ // <h1 className="text-xl font-semibold text-white/90">Connect your repository</h1>
135+ // <GlassButton
136+ // variant="secondary"
137+ // className="bg-white/20 hover:bg-white/30 text-white"
138+ // onClick={loadRepos}
139+ // >
140+ // Re-sync Repos
141+ // </GlassButton>
142+ // </div>
143+
144+ // <div className="grid gap-4 md:grid-cols-2">
145+ // <div className="grid gap-2">
146+ // <Label className="text-white/80">Repository</Label>
147+ // <Select
148+ // value={repo ?? ""}
149+ // onValueChange={(v) => { setRepo(v); loadBranches(v); }}
150+ // >
151+ // <SelectTrigger className="bg-white/10 border-white/20 text-white">
152+ // <SelectValue placeholder="Select a repo" />
153+ // </SelectTrigger>
154+ // <SelectContent className="bg-slate-900 text-white border-white/20">
155+ // {repos?.map((r) => (
156+ // <SelectItem key={r} value={r}>{r}</SelectItem>
157+ // ))}
158+ // </SelectContent>
159+ // </Select>
160+ // </div>
161+
162+ // <div className="grid gap-2">
163+ // <Label className="text-white/80">Branch</Label>
164+ // <Select
165+ // value={branch ?? ""}
166+ // onValueChange={setBranch}
167+ // disabled={!repo}
168+ // >
169+ // <SelectTrigger className="bg-white/10 border-white/20 text-white disabled:opacity-50">
170+ // <SelectValue placeholder={repo ? "Select a branch" : "Pick a repo first"} />
171+ // </SelectTrigger>
172+ // <SelectContent className="bg-slate-900 text-white border-white/20">
173+ // {branches?.map((b) => (
174+ // <SelectItem key={b} value={b}>{b}</SelectItem>
175+ // ))}
176+ // </SelectContent>
177+ // </Select>
178+ // </div>
179+ // </div>
180+
181+ // <div className="mt-8">
182+ // <GlassButton
183+ // className="bg-white/20 hover:bg-white/30 text-white"
184+ // disabled={!repo || !branch}
185+ // onClick={() => location.assign("/configure")}
186+ // >
187+ // Continue → Configure
188+ // </GlassButton>
189+ // </div>
190+ // </div>
191+ // </div>
192+ // );
193+ // }
0 commit comments