@@ -11,6 +11,7 @@ import { useState, useRef, useEffect, useLayoutEffect } from 'react'
1111import { IconPlus } from '@tabler/icons-react'
1212import type { Repo } from '../types'
1313import type { ApiRepo , RepoGroup } from '../hooks/useRepos'
14+ import { RepoList } from './RepoList'
1415
1516interface Props {
1617 groups : RepoGroup [ ]
@@ -125,45 +126,13 @@ export function NewSessionButton({ groups, token, onOpen }: Props) {
125126 className = "w-full rounded border border-neutral-10 bg-neutral-11 px-2.5 py-1.5 text-[15px] text-neutral-2 placeholder-neutral-8 outline-none focus:border-primary-8/50"
126127 />
127128 </ div >
128- < div className = "max-h-72 overflow-y-auto px-1 pb-1" >
129- { groups . map ( group => (
130- < div key = { group . owner } >
131- < div className = "px-2.5 pb-1 pt-2 text-[12px] font-medium uppercase tracking-wider text-neutral-7" >
132- { group . owner }
133- </ div >
134- { group . repos . map ( repo => {
135- const isCloning = cloning === repo . id
136- return (
137- < button
138- key = { `${ group . owner } /${ repo . id } ` }
139- onClick = { ( ) => handleSelect ( repo ) }
140- disabled = { ! ! cloning }
141- className = { `w-full rounded px-2.5 py-1.5 text-left transition ${
142- cloning ? 'cursor-wait' : 'hover:bg-neutral-10/50'
143- } `}
144- >
145- < div className = "flex items-center gap-1.5" >
146- < span className = { `text-[15px] font-medium ${ repo . cloned ? 'text-neutral-2' : 'text-neutral-5' } ` } >
147- { repo . name }
148- </ span >
149- { isCloning && (
150- < span className = "rounded bg-primary-9/30 px-1.5 py-0.5 text-[12px] text-primary-4 animate-pulse" > cloning...</ span >
151- ) }
152- { ! repo . cloned && ! isCloning && (
153- < span className = "rounded bg-neutral-10 px-1.5 py-0.5 text-[12px] text-neutral-7" > remote</ span >
154- ) }
155- </ div >
156- { repo . description && (
157- < div className = "mt-0.5 text-[13px] text-neutral-7 truncate" > { repo . description } </ div >
158- ) }
159- </ button >
160- )
161- } ) }
162- </ div >
163- ) ) }
164- { groups . length === 0 && (
165- < p className = "py-4 text-center text-[15px] text-neutral-5" > No repos found</ p >
166- ) }
129+ < div className = "px-2 pb-2" >
130+ < RepoList
131+ groups = { groups }
132+ onSelect = { handleSelect }
133+ cloningId = { cloning }
134+ maxHeight = "240px"
135+ />
167136 </ div >
168137 </ div >
169138 ) }
0 commit comments