Skip to content

Commit 3ea4650

Browse files
feat: make all subsections clickable
1 parent 0c9a9c1 commit 3ea4650

2 files changed

Lines changed: 24 additions & 12 deletions

File tree

src/components/Openings/EcoTreeView.tsx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ const EcoTreeView: React.FC<EcoTreeViewProps> = ({
307307
}
308308

309309
return (
310-
<div className="flex h-full flex-col">
310+
<div className="flex h-full flex-col overflow-hidden">
311311
{/* Search Bar */}
312312
<div className="border-b border-white/10 p-4">
313313
<div className="relative">
@@ -331,11 +331,10 @@ const EcoTreeView: React.FC<EcoTreeViewProps> = ({
331331
)}
332332
</div>
333333
</div>
334-
335-
<div className="red-scrollbar flex-1 overflow-y-auto">
334+
<div className="red-scrollbar flex-1 overflow-y-auto py-4">
336335
{/* Popular Openings Section */}
337336
{!searchTerm && (
338-
<div className="py-1">
337+
<div>
339338
<TreeNode
340339
level={0}
341340
hasChildren={filteredPopularOpenings.length > 0}
@@ -344,12 +343,17 @@ const EcoTreeView: React.FC<EcoTreeViewProps> = ({
344343
parentLines={[]}
345344
onToggle={() => setShowPopular(!showPopular)}
346345
>
347-
<div className="flex flex-1 cursor-pointer items-center justify-between rounded px-1 py-0.5 hover:bg-human-2/10">
346+
<div
347+
className="flex flex-1 cursor-pointer items-center justify-between rounded px-1 py-0.5 hover:bg-human-2/10"
348+
onClick={() => setShowPopular(!showPopular)}
349+
>
348350
<div className="flex items-center gap-1.5">
349-
<span className="material-symbols-outlined text-sm text-human-4">
350-
star
351+
<span className="inline-flex w-5 justify-center">
352+
<span className="material-symbols-outlined text-sm text-human-4">
353+
star
354+
</span>
351355
</span>
352-
<span className="font-medium text-human-4">
356+
<span className="text-sm font-medium text-primary">
353357
Popular Openings
354358
</span>
355359
</div>
@@ -440,7 +444,7 @@ const EcoTreeView: React.FC<EcoTreeViewProps> = ({
440444
)}
441445

442446
{/* ECO Sections Tree */}
443-
<div className="py-1">
447+
<div className="">
444448
{filteredSections.map((section, sectionIndex) => {
445449
const isLastSection = sectionIndex === filteredSections.length - 1
446450
const sectionExpanded = autoExpandedSections.has(section.code)
@@ -456,7 +460,10 @@ const EcoTreeView: React.FC<EcoTreeViewProps> = ({
456460
parentLines={[]}
457461
onToggle={() => toggleSection(section.code)}
458462
>
459-
<div className="flex flex-1 cursor-pointer items-center justify-between rounded px-1 py-0.5 hover:bg-human-2/10">
463+
<div
464+
className="flex flex-1 cursor-pointer items-center justify-between rounded px-1 py-0.5 hover:bg-human-2/10"
465+
onClick={() => toggleSection(section.code)}
466+
>
460467
<div className="flex items-center gap-1.5">
461468
<span className="font-mono text-sm font-bold text-human-4">
462469
{section.code}
@@ -510,7 +517,12 @@ const EcoTreeView: React.FC<EcoTreeViewProps> = ({
510517
toggleDecade(section.code, groupCode)
511518
}
512519
>
513-
<div className="flex flex-1 items-center gap-1.5 px-1 py-0.5">
520+
<div
521+
className="flex flex-1 cursor-pointer items-center gap-1.5 rounded px-1 py-0.5 hover:bg-human-2/10"
522+
onClick={() =>
523+
toggleDecade(section.code, groupCode)
524+
}
525+
>
514526
<span className="font-mono text-sm font-medium text-human-4">
515527
{groupCode}
516528
</span>

src/components/Openings/OpeningSelectionModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ export const OpeningSelectionModal: React.FC<Props> = ({
989989
{/* Main Content - Responsive Layout */}
990990
<div className="grid w-full flex-1 grid-cols-1 overflow-hidden md:grid-cols-3">
991991
<div
992-
className={`flex w-full flex-col overflow-y-scroll ${activeTab !== 'browse' ? 'hidden md:flex' : 'flex'} md:border-r md:border-white/10`}
992+
className={`flex w-full flex-col overflow-hidden ${activeTab !== 'browse' ? 'hidden md:flex' : 'flex'} md:border-r md:border-white/10`}
993993
>
994994
<div className="hidden h-20 flex-col justify-center gap-1 border-b border-white/10 p-4 md:flex">
995995
<h2 className="text-xl font-bold">ECO Opening Tree</h2>

0 commit comments

Comments
 (0)