1- import { GlassButton } from " ../components/ui/GlassButton" ;
2- import { Button } from " @/components/ui/button" ;
3- import { Label } from " @/components/ui/label" ;
1+ import { GlassButton } from ' ../components/ui/GlassButton' ;
2+ import { Button } from ' @/components/ui/button' ;
3+ import { Label } from ' @/components/ui/label' ;
44import {
55 Select ,
66 SelectTrigger ,
77 SelectValue ,
88 SelectContent ,
99 SelectItem ,
10- } from "@/components/ui/select" ;
11- import { useRepoStore } from "@/store/useRepoStore" ;
10+ } from '@/components/ui/select' ;
11+ import { useRepoStore } from '@/store/useRepoStore' ;
12+
13+ // Added by Lorenc
14+ import { startGitHubOAuth } from '@/lib/api' ;
1215
1316export default function ConnectPage ( ) {
1417 const {
@@ -24,7 +27,11 @@ export default function ConnectPage() {
2427
2528 const handleGithubConnect = ( ) => {
2629 // Vite proxy sends this to backend http://localhost:3001/auth/github
27- window . location . href = "http://localhost:3000/auth/github/start" ;
30+ // window.location.href = "http://localhost:3000/auth/github/start";
31+
32+ // After GitHub completes, the server redirects back here.
33+ const redirectTo = window . location . origin + '/connect' ;
34+ startGitHubOAuth ( redirectTo ) ;
2835 } ;
2936
3037 return (
@@ -49,7 +56,7 @@ export default function ConnectPage() {
4956 variant = "secondary"
5057 className = "bg-white/20 hover:bg-white/30 text-white"
5158 onClick = { ( ) => {
52- console . log ( " [Page] Re-sync clicked" ) ;
59+ console . log ( ' [Page] Re-sync clicked' ) ;
5360 loadRepos ( ) ;
5461 } }
5562 >
@@ -62,9 +69,9 @@ export default function ConnectPage() {
6269 < div className = "grid gap-2" >
6370 < Label className = "text-white/80" > Repository</ Label >
6471 < Select
65- value = { repo ?? "" }
72+ value = { repo ?? '' }
6673 onValueChange = { ( v ) => {
67- console . log ( " [Page] Repo selected:" , v ) ;
74+ console . log ( ' [Page] Repo selected:' , v ) ;
6875 setRepo ( v ) ;
6976 loadBranches ( v ) ;
7077 } }
@@ -85,13 +92,13 @@ export default function ConnectPage() {
8592 < div className = "grid gap-2" >
8693 < Label className = "text-white/80" > Branch</ Label >
8794 < Select
88- value = { branch ?? "" }
95+ value = { branch ?? '' }
8996 onValueChange = { setBranch }
9097 disabled = { ! repo }
9198 >
9299 < SelectTrigger className = "bg-white/10 border-white/20 text-white disabled:opacity-50" >
93100 < SelectValue
94- placeholder = { repo ? " Select a branch" : " Pick a repo first" }
101+ placeholder = { repo ? ' Select a branch' : ' Pick a repo first' }
95102 />
96103 </ SelectTrigger >
97104 < SelectContent className = "bg-slate-900 text-white border-white/20" >
@@ -109,7 +116,7 @@ export default function ConnectPage() {
109116 < GlassButton
110117 className = "bg-white/20 hover:bg-white/30 text-white"
111118 disabled = { ! repo || ! branch }
112- onClick = { ( ) => location . assign ( " /configure" ) }
119+ onClick = { ( ) => location . assign ( ' /configure' ) }
113120 >
114121 Continue → Configure
115122 </ GlassButton >
@@ -119,7 +126,6 @@ export default function ConnectPage() {
119126 ) ;
120127}
121128
122-
123129// import { GlassButton } from "../components/ui/GlassButton";
124130// import { Button } from "@/components/ui/button";
125131// import { Label } from "@/components/ui/label";
0 commit comments