Skip to content

Commit 3e67771

Browse files
committed
Improved layout.
1 parent e3b92ca commit 3e67771

File tree

4 files changed

+79
-57
lines changed

4 files changed

+79
-57
lines changed

browser-extension/tests/playground/PopupPlayground.tsx

Lines changed: 0 additions & 33 deletions
This file was deleted.

browser-extension/tests/playground/claude.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const timeAgo = (date: Date | number) => {
134134
return 'just now'
135135
}
136136

137-
const DraftsTable = () => {
137+
export const ClaudePrototype = () => {
138138
const [drafts] = useState(generateMockDrafts())
139139
const [selectedIds, setSelectedIds] = useState(new Set())
140140
const [platformFilter, setPlatformFilter] = useState('All')
@@ -593,5 +593,3 @@ const DraftsTable = () => {
593593
</div>
594594
)
595595
}
596-
597-
export default DraftsTable
Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,54 @@
11
import { createRoot } from 'react-dom/client'
2+
import { useState } from 'react'
23
import '@/entrypoints/popup/style.css'
34
import './style.css'
4-
import { PopupPlayground } from './PopupPlayground'
5+
import { Replica } from './replica'
6+
import { ClaudePrototype } from "./claude"
57

6-
const root = createRoot(document.getElementById('root')!)
7-
root.render(
8-
<div className='min-h-screen bg-slate-100'>
9-
<div className='container px-6 py-8'>
10-
<div className='bg-white p-6 rounded-lg shadow-sm border border-slate-200 mb-6'>
11-
<h1 className='text-2xl font-bold text-slate-900 mb-2'>Popup Simulator</h1>
12-
</div>
8+
type Mode = 'Replica' | 'ClaudePrototype'
139

14-
<div className='popup-frame'>
15-
<PopupPlayground />
16-
</div>
10+
const App = () => {
11+
const [activeComponent, setActiveComponent] = useState<Mode>('Replica')
1712

18-
<div className='bg-slate-50 p-4 rounded-lg border border-slate-200 mt-6 max-w-2xl mx-auto'>
19-
<h3 className='font-medium text-slate-900 mb-2'>Development Notes</h3>
20-
<ul className='text-sm text-slate-600 space-y-1'>
21-
<li>The popup frame above matches the exact browser extension popup.</li>
22-
<li>Hot reload is active for instant updates</li>
23-
</ul>
13+
return (
14+
<div className='min-h-screen bg-slate-100'>
15+
<div className='container px-6 py-8'>
16+
<div className='bg-white p-6 rounded-lg shadow-sm border border-slate-200 mb-6'>
17+
<h1 className='text-2xl font-bold text-slate-900 mb-2'>Popup Simulator</h1>
18+
<ul className='text-sm text-slate-600 space-y-1'>
19+
<li>The popup frame is meant to exactly match the browser extension popup.</li>
20+
<li>Hot reload is active for instant updates</li>
21+
</ul>
22+
<div className='flex gap-2 mt-4'>
23+
<button
24+
onClick={() => setActiveComponent('Replica')}
25+
className={`px-3 py-2 rounded text-sm font-medium transition-colors ${activeComponent === 'Replica'
26+
? 'bg-blue-600 text-white'
27+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
28+
}`}
29+
>
30+
Replica
31+
</button>
32+
<button
33+
onClick={() => setActiveComponent('ClaudePrototype')}
34+
className={`px-3 py-2 rounded text-sm font-medium transition-colors ${activeComponent === 'ClaudePrototype'
35+
? 'bg-blue-600 text-white'
36+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
37+
}`}
38+
>
39+
ClaudePrototype
40+
</button>
41+
</div>
42+
</div>
43+
44+
<div className='popup-frame'>
45+
{activeComponent === 'Replica' && <Replica />}
46+
{activeComponent === 'ClaudePrototype' && <ClaudePrototype />}
47+
</div>
2448
</div>
2549
</div>
26-
</div>,
27-
)
50+
)
51+
}
52+
53+
const root = createRoot(document.getElementById('root')!)
54+
root.render(<App />)

browser-extension/tests/playground/playgroundData.tsx renamed to browser-extension/tests/playground/replica.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { SpotTable } from '@/components/SpotTable'
12
import type { CommentState } from '@/entrypoints/background'
3+
import { EnhancerRegistry } from '@/lib/registries'
4+
25
import type { CommentSpot } from '@/lib/enhancer'
36
import type { GitHubIssueAddCommentSpot } from '@/lib/enhancers/github/githubIssueAddComment'
47
import type { GitHubPRAddCommentSpot } from '@/lib/enhancers/github/githubPRAddComment'
@@ -19,8 +22,7 @@ const gh_issue: GitHubIssueAddCommentSpot = {
1922
}
2023

2124
const spots: CommentSpot[] = [gh_pr, gh_issue]
22-
23-
export const sampleSpots: CommentState[] = spots.map((spot) => {
25+
const sampleSpots: CommentState[] = spots.map((spot) => {
2426
const state: CommentState = {
2527
drafts: [
2628
[
@@ -38,3 +40,31 @@ export const sampleSpots: CommentState[] = spots.map((spot) => {
3840
}
3941
return state
4042
})
43+
44+
45+
export function Replica() {
46+
const handleSpotClick = (spot: CommentState) => {
47+
alert(`Clicked: ${spot.spot.type}\nTab: ${spot.tab.tabId}`)
48+
}
49+
50+
const enhancers = new EnhancerRegistry()
51+
52+
return (
53+
<div className='w-full'>
54+
<h2 className='mb-4 text-lg font-semibold text-foreground'>Open Comment Spots</h2>
55+
56+
<div className='border rounded-md'>
57+
<SpotTable
58+
spots={sampleSpots}
59+
enhancerRegistry={enhancers}
60+
onSpotClick={handleSpotClick}
61+
headerClassName='p-3 font-medium text-muted-foreground'
62+
rowClassName='transition-colors hover:bg-muted/50 border-b border-border/40'
63+
cellClassName='p-3'
64+
emptyStateMessage='No open comment spots'
65+
showHeader={true}
66+
/>
67+
</div>
68+
</div>
69+
)
70+
}

0 commit comments

Comments
 (0)