Skip to content

Commit 82157da

Browse files
authored
Merge pull request #14 from Multiplier-Labs/fix/remove-local-scripts
Use shared RepoList in sidebar new-session dropdown
2 parents dff0434 + 29fd359 commit 82157da

File tree

2 files changed

+10
-41
lines changed

2 files changed

+10
-41
lines changed

dist/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
77
<title>Codekin</title>
8-
<script type="module" crossorigin src="/assets/index-DFdIqWQS.js"></script>
9-
<link rel="stylesheet" crossorigin href="/assets/index-a8q-qxCN.css">
8+
<script type="module" crossorigin src="/assets/index-Bgui9UD3.js"></script>
9+
<link rel="stylesheet" crossorigin href="/assets/index-Chp8p3B_.css">
1010
</head>
1111
<body class="bg-neutral-12 text-neutral-2">
1212
<div id="root"></div>

src/components/NewSessionButton.tsx

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useState, useRef, useEffect, useLayoutEffect } from 'react'
1111
import { IconPlus } from '@tabler/icons-react'
1212
import type { Repo } from '../types'
1313
import type { ApiRepo, RepoGroup } from '../hooks/useRepos'
14+
import { RepoList } from './RepoList'
1415

1516
interface 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

Comments
 (0)