Skip to content

Commit 82ba5eb

Browse files
authored
Merge pull request #62 from MuslimeKaya/main
The sidebar has been set as fixed.
2 parents eadd2ac + d9b6750 commit 82ba5eb

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

src/components/layout/Sidebar.tsx

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
'use client'
22

33
import Link from 'next/link'
4-
import { usePathname, useSearchParams } from 'next/navigation'
4+
import { usePathname, useSearchParams } from 'next/navigation'
55
import { Button } from '@/components/ui/button'
66
import { useSidebarState, useAuthStore, useStoreHydration, useActionItemsStore } from '@/stores'
7-
import { ChevronRight, Clock, LogOut, MessageSquare, Sparkles, Star, Target, Zap, } from 'lucide-react'
7+
import { ChevronRight, Clock, LogOut, MessageSquare, Sparkles, Star, Target, Zap } from 'lucide-react'
88
import { Badge } from '../ui/badge'
99
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible'
1010

11-
12-
1311
export function Sidebar() {
1412
const pathname = usePathname()
1513
const searchParams = useSearchParams()
@@ -23,8 +21,8 @@ export function Sidebar() {
2321
const { getCountByType, getTotalCount, loading } = useActionItemsStore()
2422

2523
// Get current tab from URL params
26-
const currentTab = searchParams.get('tab') || 'assigned'
27-
const isDashboardPage = pathname.startsWith('/dashboard')
24+
const currentTab = searchParams?.get('tab') || 'assigned'
25+
const isDashboardPage = pathname ? pathname.startsWith('/dashboard') : false
2826

2927
// Badge count helpers
3028
const getBadgeCount = (type: 'assigned' | 'mentions' | 'stale' | 'goodFirstIssues' | 'easyFixes') => getCountByType(type)
@@ -36,15 +34,19 @@ export function Sidebar() {
3634
return getBadgeCount(type)
3735
}
3836

37+
// Debug logs
38+
console.log('Sidebar Debug:', { currentTab, pathname, isDashboardPage })
3939

40+
// Fixed logic - works for all tabs
41+
const isQuickWinsTab = currentTab === 'good-first-issues' || currentTab === 'easy-fixes'
42+
const isActionRequiredTab = ['assigned', 'mentions', 'stale'].includes(currentTab)
4043

41-
const isQuickWinsTab = currentTab === 'quick-wins' || currentTab === 'good-first-issues' || currentTab === 'easy-fixes'
42-
const isActionRequiredTab = !isQuickWinsTab && isDashboardPage
43-
44+
console.log('Tab States:', { isQuickWinsTab, isActionRequiredTab })
4445

4546
const handleLogout = () => {
46-
logout()
47+
logout()
4748
}
49+
4850
return (
4951
<>
5052
{/* Overlay for mobile */}
@@ -56,10 +58,11 @@ export function Sidebar() {
5658
)}
5759

5860
<aside className={`
59-
fixed top-0 left-0 h-screen w-80 bg-sidebar border-r border-sidebar-border z-50 transform transition-transform duration-300 ease-in-out
61+
fixed top-0 left-0 h-screen bg-sidebar border-r border-sidebar-border z-50 transform transition-transform duration-300 ease-in-out
6062
${isOpen ? 'translate-x-0' : '-translate-x-full'}
6163
lg:translate-x-0 lg:static lg:z-auto lg:h-screen
6264
flex flex-col
65+
w-80 min-w-[20rem] max-w-[20rem]
6366
`}>
6467

6568
{/* Header */}
@@ -76,15 +79,13 @@ export function Sidebar() {
7679
</button>
7780
</div>
7881

79-
8082
{/* Scrollable Content */}
8183
<div className="flex-1 overflow-y-auto">
82-
{/* Navigation */}
8384
{/* Navigation Menu with Collapsible */}
8485
<div className="flex-1 overflow-y-auto p-4">
8586
<nav className="space-y-2">
8687
{/* Action Required - Active with Collapsible */}
87-
<Collapsible defaultOpen={isActionRequiredTab}>
88+
<Collapsible open={true} onOpenChange={() => { }}>
8889
<CollapsibleTrigger asChild>
8990
<Link href="/dashboard" className={`
9091
flex items-center justify-between w-full px-3 py-2 rounded-lg transition-colors
@@ -102,12 +103,13 @@ export function Sidebar() {
102103
</Badge>
103104
)}
104105
</div>
105-
<ChevronRight />
106+
<ChevronRight className={`w-4 h-4 transition-transform ${isActionRequiredTab ? 'rotate-90' : ''}`} />
106107
</Link>
107108
</CollapsibleTrigger>
108109

109-
{isDashboardPage && (
110-
<CollapsibleContent className="pl-8 space-y-1 mt-1">
110+
{/* Action Required sub-items - Always show space */}
111+
<CollapsibleContent className="pl-8 space-y-1 mt-1">
112+
<div className={`transition-opacity duration-200 ${!isDashboardPage ? 'opacity-50 pointer-events-none' : 'opacity-100'}`}>
111113
<Link
112114
href="/dashboard?tab=assigned"
113115
className={`flex items-center gap-2 px-3 py-1.5 text-sm rounded transition-colors
@@ -116,6 +118,7 @@ export function Sidebar() {
116118
: 'text-gray-600 hover:text-blue-600 hover:bg-gray-50 dark:hover:bg-gray-800'
117119
}`}
118120
>
121+
119122
<Target className="w-4 h-4" />
120123
Assigned
121124
<Badge
@@ -159,11 +162,12 @@ export function Sidebar() {
159162
{getBadgeContent('stale')}
160163
</Badge>
161164
</Link>
162-
</CollapsibleContent>
163-
)}
165+
</div>
166+
</CollapsibleContent>
164167
</Collapsible>
165168

166-
<Collapsible defaultOpen={isQuickWinsTab}>
169+
{/* Quick Wins - Always available */}
170+
<Collapsible open={true} onOpenChange={() => { }}>
167171
<CollapsibleTrigger asChild>
168172
<Link href="/dashboard?tab=good-first-issues" className={`
169173
flex items-center justify-between w-full px-3 py-2 rounded-lg transition-colors
@@ -181,10 +185,11 @@ export function Sidebar() {
181185
</Badge>
182186
)}
183187
</div>
184-
<ChevronRight className={`w-4 h-4 transition-transform ${currentTab === 'quick-wins' ? 'rotate-90' : ''}`} />
188+
<ChevronRight className={`w-4 h-4 transition-transform ${isQuickWinsTab ? 'rotate-90' : ''}`} />
185189
</Link>
186190
</CollapsibleTrigger>
187191

192+
{/* Quick Wins sub-items - Always show space */}
188193
<CollapsibleContent className="pl-8 space-y-1 mt-1">
189194
<Link
190195
href="/dashboard?tab=good-first-issues"
@@ -284,9 +289,9 @@ export function SidebarToggle({ onClick }: { onClick: () => void }) {
284289
onClick={onClick}
285290
className="lg:hidden fixed top-4 left-4 z-50 bg-background p-2 rounded-lg shadow-lg border border-border hover:bg-accent transition-colors"
286291
>
287-
<svg className="w-6 h-6 text-foreground" fill="none" stroke="currentColor" viewBox="0 0 24 24">
292+
<svg className="w-6 h-6 text-foreground" fill="none" stroke="currentColor" viewBox="0 24 24">
288293
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
289294
</svg>
290295
</button>
291296
)
292-
}
297+
}

0 commit comments

Comments
 (0)