Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

feat: Make secondary sidebar collapsable

Khuram Niazc8bea90cd4f1
diff --git a/src/components/questions/QuestionsSidebar.tsx b/src/components/questions/QuestionsSidebar.tsx
index 9332448..4df397e 100644
--- a/src/components/questions/QuestionsSidebar.tsx
+++ b/src/components/questions/QuestionsSidebar.tsx
@@ -1,4 +1,6 @@
"use client";
+import { useState } from "react";
+import { ChevronLeft, ChevronRight } from "lucide-react";
import { cn } from "@/lib/utils";
type TagWithCount = {
@@ -21,48 +23,72 @@ function QuestionsSidebar({
selectedFilter,
onFilterChange,
}: QuestionsSidebarProps) {
+ const [collapsed, setCollapsed] = useState(false);
+
return (
- <div className="w-48 border-r py-4 hidden md:block h-full">
- <h3 className="font-semibold mb-4 text-sm">Skill Tags</h3>
- <ul className="space-y-1">
- <li>
- <button
- onClick={() => onFilterChange(undefined)}
- className={cn(
- "w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
- "hover:bg-accent hover:text-accent-foreground",
- !selectedFilter && "bg-accent text-accent-foreground font-medium"
- )}
- >
- <span className="flex justify-between items-center">
- <span>All</span>
- <span className="text-muted-foreground text-xs">
- {totalQuestions}
- </span>
- </span>
- </button>
- </li>
- {tags.map((tag) => (
- <li key={tag.id}>
- <button
- onClick={() => onFilterChange(tag.id)}
- className={cn(
- "w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
- "hover:bg-accent hover:text-accent-foreground",
- selectedFilter === tag.id &&
- "bg-accent text-accent-foreground font-medium"
- )}
- >
- <span className="flex justify-between items-center">
- <span className="truncate">{tag.label}</span>
- <span className="text-muted-foreground text-xs">
- {tag.questionCount}
+ <div
+ className={cn(
+ "relative border-r py-4 hidden md:flex flex-col h-full transition-all duration-200",
+ collapsed ? "w-0 overflow-visible" : "w-48",
+ )}
+ >
+ <button
+ onClick={() => setCollapsed((prev) => !prev)}
+ className="absolute -right-3 top-4 z-10 flex items-center justify-center w-6 h-6 rounded-full border bg-background text-muted-foreground hover:text-foreground hover:bg-accent transition-colors"
+ aria-label={collapsed ? "Expand sidebar" : "Collapse sidebar"}
+ >
+ {collapsed ? (
+ <ChevronRight className="h-3.5 w-3.5" />
+ ) : (
+ <ChevronLeft className="h-3.5 w-3.5" />
+ )}
+ </button>
+
+ {!collapsed && (
+ <>
+ <h3 className="font-semibold mb-4 text-sm px-1">Skill Tags</h3>
+ <ul className="space-y-1">
+ <li>
+ <button
+ onClick={() => onFilterChange(undefined)}
+ className={cn(
+ "w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
+ "hover:bg-accent hover:text-accent-foreground",
+ !selectedFilter &&
+ "bg-accent text-accent-foreground font-medium",
+ )}
+ >
+ <span className="flex justify-between items-center">
+ <span>All</span>
+ <span className="text-muted-foreground text-xs">
+ {totalQuestions}
+ </span>
</span>
- </span>
- </button>
- </li>
- ))}
- </ul>
+ </button>
+ </li>
+ {tags.map((tag) => (
+ <li key={tag.id}>
+ <button
+ onClick={() => onFilterChange(tag.id)}
+ className={cn(
+ "w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
+ "hover:bg-accent hover:text-accent-foreground",
+ selectedFilter === tag.id &&
+ "bg-accent text-accent-foreground font-medium",
+ )}
+ >
+ <span className="flex justify-between items-center">
+ <span className="truncate">{tag.label}</span>
+ <span className="text-muted-foreground text-xs">
+ {tag.questionCount}
+ </span>
+ </span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ </>
+ )}
</div>
);
}
diff --git a/src/components/tasks/TasksSidebar.tsx b/src/components/tasks/TasksSidebar.tsx
index 272fe2e..7b720d8 100644
--- a/src/components/tasks/TasksSidebar.tsx
+++ b/src/components/tasks/TasksSidebar.tsx
@@ -1,4 +1,6 @@
"use client";
+import { useState } from "react";
+import { ChevronLeft, ChevronRight } from "lucide-react";
import { cn } from "@/lib/utils";
type ActivityTypeWithCount = {
@@ -21,48 +23,72 @@ function TasksSidebar({
selectedFilter,
onFilterChange,
}: TasksSidebarProps) {
+ const [collapsed, setCollapsed] = useState(false);
+
return (
- <div className="w-48 border-r py-4 hidden md:block h-full">
- <h3 className="font-semibold mb-4 text-sm">Activity Types</h3>
- <ul className="space-y-1">
- <li>
- <button
- onClick={() => onFilterChange(undefined)}
- className={cn(
- "w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
- "hover:bg-accent hover:text-accent-foreground",
- !selectedFilter && "bg-accent text-accent-foreground font-medium"
- )}
- >
- <span className="flex justify-between items-center">
- <span>All</span>
- <span className="text-muted-foreground text-xs">
- {totalTasks}
- </span>
- </span>
- </button>
- </li>
- {activityTypes.map((type) => (
- <li key={type.id}>
- <button
- onClick={() => onFilterChange(type.id)}
- className={cn(
- "w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
- "hover:bg-accent hover:text-accent-foreground",
- selectedFilter === type.id &&
- "bg-accent text-accent-foreground font-medium"
- )}
- >
- <span className="flex justify-between items-center">
- <span className="truncate">{type.label}</span>
- <span className="text-muted-foreground text-xs">
- {type.taskCount}
+ <div
+ className={cn(
+ "relative border-r py-4 hidden md:flex flex-col h-full transition-all duration-200",
+ collapsed ? "w-0 overflow-visible" : "w-48",
+ )}
+ >
+ <button
+ onClick={() => setCollapsed((prev) => !prev)}
+ className="absolute -right-3 top-4 z-10 flex items-center justify-center w-6 h-6 rounded-full border bg-background text-muted-foreground hover:text-foreground hover:bg-accent transition-colors"
+ aria-label={collapsed ? "Expand sidebar" : "Collapse sidebar"}
+ >
+ {collapsed ? (
+ <ChevronRight className="h-3.5 w-3.5" />
+ ) : (
+ <ChevronLeft className="h-3.5 w-3.5" />
+ )}
+ </button>
+
+ {!collapsed && (
+ <>
+ <h3 className="font-semibold mb-4 text-sm px-1">Activity Types</h3>
+ <ul className="space-y-1">
+ <li>
+ <button
+ onClick={() => onFilterChange(undefined)}
+ className={cn(
+ "w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
+ "hover:bg-accent hover:text-accent-foreground",
+ !selectedFilter &&
+ "bg-accent text-accent-foreground font-medium",
+ )}
+ >
+ <span className="flex justify-between items-center">
+ <span>All</span>
+ <span className="text-muted-foreground text-xs">
+ {totalTasks}
+ </span>
</span>
- </span>
- </button>
- </li>
- ))}
- </ul>
+ </button>
+ </li>
+ {activityTypes.map((type) => (
+ <li key={type.id}>
+ <button
+ onClick={() => onFilterChange(type.id)}
+ className={cn(
+ "w-full text-left px-3 py-2 rounded-md text-sm transition-colors",
+ "hover:bg-accent hover:text-accent-foreground",
+ selectedFilter === type.id &&
+ "bg-accent text-accent-foreground font-medium",
+ )}
+ >
+ <span className="flex justify-between items-center">
+ <span className="truncate">{type.label}</span>
+ <span className="text-muted-foreground text-xs">
+ {type.taskCount}
+ </span>
+ </span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ </>
+ )}
</div>
);
}