@meghpatel-007/next-starter 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +27 -0
- package/README.md +131 -2
- package/bin/index.js +8 -0
- package/package.json +44 -4
- package/src/cli.js +242 -0
- package/src/git.js +25 -0
- package/src/install.js +55 -0
- package/src/scaffold.js +110 -0
- package/src/utils.js +70 -0
- package/template/AGENTS.md +9 -0
- package/template/LICENSE +28 -0
- package/template/README.md +36 -0
- package/template/_gitignore +41 -0
- package/template/components.json +25 -0
- package/template/eslint.config.mjs +11 -0
- package/template/next-env.d.ts +7 -0
- package/template/next.config.ts +59 -0
- package/template/package.json +49 -0
- package/template/postcss.config.mjs +6 -0
- package/template/public/apps.png +0 -0
- package/template/public/customizer.png +0 -0
- package/template/public/dashboard-dark.png +0 -0
- package/template/public/dashboard-light.png +0 -0
- package/template/public/dashboard.png +0 -0
- package/template/public/favicon-dark.png +0 -0
- package/template/public/favicon.png +0 -0
- package/template/public/feature-1-dark.png +0 -0
- package/template/public/feature-1-light.png +0 -0
- package/template/public/feature-2-dark.png +0 -0
- package/template/public/feature-2-light.png +0 -0
- package/template/public/file.svg +1 -0
- package/template/public/globe.svg +1 -0
- package/template/public/hero-images-container.png +0 -0
- package/template/public/next.svg +1 -0
- package/template/public/vercel.svg +1 -0
- package/template/public/window.svg +1 -0
- package/template/src/app/(auth)/errors/forbidden/components/forbidden-error.tsx +36 -0
- package/template/src/app/(auth)/errors/forbidden/page.tsx +5 -0
- package/template/src/app/(auth)/errors/internal-server-error/components/internal-server-error.tsx +36 -0
- package/template/src/app/(auth)/errors/internal-server-error/page.tsx +5 -0
- package/template/src/app/(auth)/errors/not-found/components/not-found-error.tsx +36 -0
- package/template/src/app/(auth)/errors/not-found/page.tsx +5 -0
- package/template/src/app/(auth)/errors/unauthorized/components/unauthorized-error.tsx +36 -0
- package/template/src/app/(auth)/errors/unauthorized/page.tsx +5 -0
- package/template/src/app/(auth)/errors/under-maintenance/components/under-maintenance-error.tsx +33 -0
- package/template/src/app/(auth)/errors/under-maintenance/page.tsx +5 -0
- package/template/src/app/(auth)/forgot-password/components/forgot-password-form-1.tsx +61 -0
- package/template/src/app/(auth)/forgot-password/page.tsx +22 -0
- package/template/src/app/(auth)/forgot-password-2/components/forgot-password-form-2.tsx +38 -0
- package/template/src/app/(auth)/forgot-password-2/page.tsx +25 -0
- package/template/src/app/(auth)/forgot-password-3/components/forgot-password-form-3.tsx +66 -0
- package/template/src/app/(auth)/forgot-password-3/page.tsx +9 -0
- package/template/src/app/(auth)/layout.tsx +14 -0
- package/template/src/app/(auth)/sign-in/components/login-form-1.tsx +143 -0
- package/template/src/app/(auth)/sign-in/page.tsx +22 -0
- package/template/src/app/(auth)/sign-in-2/components/login-form-2.tsx +78 -0
- package/template/src/app/(auth)/sign-in-2/page.tsx +25 -0
- package/template/src/app/(auth)/sign-in-3/components/login-form-3.tsx +130 -0
- package/template/src/app/(auth)/sign-in-3/page.tsx +11 -0
- package/template/src/app/(auth)/sign-up/components/signup-form-1.tsx +245 -0
- package/template/src/app/(auth)/sign-up/page.tsx +22 -0
- package/template/src/app/(auth)/sign-up-2/components/signup-form-2.tsx +89 -0
- package/template/src/app/(auth)/sign-up-2/page.tsx +25 -0
- package/template/src/app/(auth)/sign-up-3/components/signup-form-3.tsx +152 -0
- package/template/src/app/(auth)/sign-up-3/page.tsx +9 -0
- package/template/src/app/(dashboard)/calendar/components/calendar-main.tsx +446 -0
- package/template/src/app/(dashboard)/calendar/components/calendar-sidebar.tsx +78 -0
- package/template/src/app/(dashboard)/calendar/components/calendar-unified.tsx +431 -0
- package/template/src/app/(dashboard)/calendar/components/calendar.tsx +90 -0
- package/template/src/app/(dashboard)/calendar/components/calendars.tsx +265 -0
- package/template/src/app/(dashboard)/calendar/components/date-picker.tsx +56 -0
- package/template/src/app/(dashboard)/calendar/components/event-form.tsx +468 -0
- package/template/src/app/(dashboard)/calendar/components/quick-actions.tsx +159 -0
- package/template/src/app/(dashboard)/calendar/data/calendars.json +37 -0
- package/template/src/app/(dashboard)/calendar/data/event-dates.json +30 -0
- package/template/src/app/(dashboard)/calendar/data/events.json +62 -0
- package/template/src/app/(dashboard)/calendar/data.ts +55 -0
- package/template/src/app/(dashboard)/calendar/page.tsx +10 -0
- package/template/src/app/(dashboard)/calendar/types.ts +20 -0
- package/template/src/app/(dashboard)/calendar/use-calendar.ts +93 -0
- package/template/src/app/(dashboard)/chat/components/chat-header.tsx +266 -0
- package/template/src/app/(dashboard)/chat/components/chat.tsx +212 -0
- package/template/src/app/(dashboard)/chat/components/conversation-list-new.tsx +248 -0
- package/template/src/app/(dashboard)/chat/components/conversation-list.tsx +242 -0
- package/template/src/app/(dashboard)/chat/components/message-input.tsx +235 -0
- package/template/src/app/(dashboard)/chat/components/message-list.tsx +325 -0
- package/template/src/app/(dashboard)/chat/data/conversations.json +92 -0
- package/template/src/app/(dashboard)/chat/data/messages.json +224 -0
- package/template/src/app/(dashboard)/chat/data/users.json +47 -0
- package/template/src/app/(dashboard)/chat/page.tsx +49 -0
- package/template/src/app/(dashboard)/chat/use-chat.ts +149 -0
- package/template/src/app/(dashboard)/dashboard/components/chart-area-interactive.tsx +304 -0
- package/template/src/app/(dashboard)/dashboard/components/data-table.tsx +1156 -0
- package/template/src/app/(dashboard)/dashboard/components/section-cards.tsx +102 -0
- package/template/src/app/(dashboard)/dashboard/data/data.json +614 -0
- package/template/src/app/(dashboard)/dashboard/data/focus-documents-data.json +47 -0
- package/template/src/app/(dashboard)/dashboard/data/key-personnel-data.json +47 -0
- package/template/src/app/(dashboard)/dashboard/data/past-performance-data.json +47 -0
- package/template/src/app/(dashboard)/dashboard/page.tsx +37 -0
- package/template/src/app/(dashboard)/dashboard/schemas/task-schema.ts +13 -0
- package/template/src/app/(dashboard)/dashboard-2/components/customer-insights.tsx +390 -0
- package/template/src/app/(dashboard)/dashboard-2/components/dashboard-header.tsx +103 -0
- package/template/src/app/(dashboard)/dashboard-2/components/metrics-overview.tsx +95 -0
- package/template/src/app/(dashboard)/dashboard-2/components/quick-actions.tsx +50 -0
- package/template/src/app/(dashboard)/dashboard-2/components/recent-transactions.tsx +164 -0
- package/template/src/app/(dashboard)/dashboard-2/components/revenue-breakdown.tsx +269 -0
- package/template/src/app/(dashboard)/dashboard-2/components/sales-chart.tsx +170 -0
- package/template/src/app/(dashboard)/dashboard-2/components/top-products.tsx +140 -0
- package/template/src/app/(dashboard)/dashboard-2/data/dashboard-data.json +39 -0
- package/template/src/app/(dashboard)/dashboard-2/page.tsx +49 -0
- package/template/src/app/(dashboard)/faqs/components/faq-list.tsx +148 -0
- package/template/src/app/(dashboard)/faqs/components/features-grid.tsx +46 -0
- package/template/src/app/(dashboard)/faqs/data/categories.json +10 -0
- package/template/src/app/(dashboard)/faqs/data/faqs.json +278 -0
- package/template/src/app/(dashboard)/faqs/data/features.ts +37 -0
- package/template/src/app/(dashboard)/faqs/page.tsx +16 -0
- package/template/src/app/(dashboard)/layout.tsx +83 -0
- package/template/src/app/(dashboard)/mail/components/account-switcher.tsx +69 -0
- package/template/src/app/(dashboard)/mail/components/mail-display.tsx +290 -0
- package/template/src/app/(dashboard)/mail/components/mail-list.tsx +94 -0
- package/template/src/app/(dashboard)/mail/components/mail.tsx +226 -0
- package/template/src/app/(dashboard)/mail/components/nav.tsx +83 -0
- package/template/src/app/(dashboard)/mail/data.tsx +300 -0
- package/template/src/app/(dashboard)/mail/index.tsx +6 -0
- package/template/src/app/(dashboard)/mail/page.tsx +18 -0
- package/template/src/app/(dashboard)/mail/use-mail.ts +20 -0
- package/template/src/app/(dashboard)/pricing/components/faq-section.tsx +79 -0
- package/template/src/app/(dashboard)/pricing/components/features-grid.tsx +51 -0
- package/template/src/app/(dashboard)/pricing/data/faqs.json +32 -0
- package/template/src/app/(dashboard)/pricing/data/features.ts +61 -0
- package/template/src/app/(dashboard)/pricing/page.tsx +24 -0
- package/template/src/app/(dashboard)/settings/account/page.tsx +276 -0
- package/template/src/app/(dashboard)/settings/appearance/page.tsx +313 -0
- package/template/src/app/(dashboard)/settings/billing/components/billing-history-card.tsx +53 -0
- package/template/src/app/(dashboard)/settings/billing/components/current-plan-card.tsx +82 -0
- package/template/src/app/(dashboard)/settings/billing/data/billing-history.json +23 -0
- package/template/src/app/(dashboard)/settings/billing/data/current-plan.json +12 -0
- package/template/src/app/(dashboard)/settings/billing/page.tsx +57 -0
- package/template/src/app/(dashboard)/settings/connections/page.tsx +366 -0
- package/template/src/app/(dashboard)/settings/notifications/page.tsx +845 -0
- package/template/src/app/(dashboard)/settings/user/page.tsx +415 -0
- package/template/src/app/(dashboard)/tasks/components/add-task-modal.tsx +291 -0
- package/template/src/app/(dashboard)/tasks/components/columns.tsx +159 -0
- package/template/src/app/(dashboard)/tasks/components/data-table-column-header.tsx +46 -0
- package/template/src/app/(dashboard)/tasks/components/data-table-faceted-filter.tsx +164 -0
- package/template/src/app/(dashboard)/tasks/components/data-table-pagination.tsx +107 -0
- package/template/src/app/(dashboard)/tasks/components/data-table-row-actions.tsx +72 -0
- package/template/src/app/(dashboard)/tasks/components/data-table-toolbar.tsx +189 -0
- package/template/src/app/(dashboard)/tasks/components/data-table-view-options.tsx +67 -0
- package/template/src/app/(dashboard)/tasks/components/data-table.tsx +122 -0
- package/template/src/app/(dashboard)/tasks/components/user-nav.tsx +70 -0
- package/template/src/app/(dashboard)/tasks/data/data.tsx +66 -0
- package/template/src/app/(dashboard)/tasks/data/schema.ts +13 -0
- package/template/src/app/(dashboard)/tasks/data/tasks.json +352 -0
- package/template/src/app/(dashboard)/tasks/page.tsx +204 -0
- package/template/src/app/(dashboard)/users/components/data-table.tsx +600 -0
- package/template/src/app/(dashboard)/users/components/stat-cards.tsx +91 -0
- package/template/src/app/(dashboard)/users/components/user-form-dialog.tsx +291 -0
- package/template/src/app/(dashboard)/users/data.json +182 -0
- package/template/src/app/(dashboard)/users/page.tsx +84 -0
- package/template/src/app/favicon.ico +0 -0
- package/template/src/app/globals.css +193 -0
- package/template/src/app/landing/components/about-section.tsx +125 -0
- package/template/src/app/landing/components/blog-section.tsx +86 -0
- package/template/src/app/landing/components/contact-section.tsx +299 -0
- package/template/src/app/landing/components/cta-section.tsx +121 -0
- package/template/src/app/landing/components/faq-section.tsx +125 -0
- package/template/src/app/landing/components/features-section.tsx +221 -0
- package/template/src/app/landing/components/footer.tsx +273 -0
- package/template/src/app/landing/components/hero-section.tsx +121 -0
- package/template/src/app/landing/components/landing-theme-customizer.tsx +563 -0
- package/template/src/app/landing/components/logo-carousel.tsx +130 -0
- package/template/src/app/landing/components/navbar.tsx +367 -0
- package/template/src/app/landing/components/pricing-section.tsx +214 -0
- package/template/src/app/landing/components/stats-section.tsx +71 -0
- package/template/src/app/landing/components/team-section.tsx +224 -0
- package/template/src/app/landing/components/testimonials-section.tsx +148 -0
- package/template/src/app/landing/landing-page-content.tsx +60 -0
- package/template/src/app/landing/page.tsx +6 -0
- package/template/src/app/layout.tsx +31 -0
- package/template/src/app/loading.tsx +10 -0
- package/template/src/app/not-found.tsx +20 -0
- package/template/src/app/page.tsx +32 -0
- package/template/src/assets/react.svg +1 -0
- package/template/src/components/app-sidebar.tsx +241 -0
- package/template/src/components/color-picker.tsx +91 -0
- package/template/src/components/command-search.tsx +251 -0
- package/template/src/components/dot-pattern.tsx +131 -0
- package/template/src/components/dynamic-imports.ts +28 -0
- package/template/src/components/icons/brand-icons.tsx +114 -0
- package/template/src/components/image-3d.tsx +90 -0
- package/template/src/components/landing/mega-menu.tsx +143 -0
- package/template/src/components/layouts/base-layout.tsx +109 -0
- package/template/src/components/logo.tsx +44 -0
- package/template/src/components/mode-toggle.tsx +76 -0
- package/template/src/components/nav-main.tsx +121 -0
- package/template/src/components/nav-secondary.tsx +43 -0
- package/template/src/components/nav-user.tsx +122 -0
- package/template/src/components/pricing-plans.tsx +181 -0
- package/template/src/components/sidebar-notification.tsx +59 -0
- package/template/src/components/site-footer.tsx +30 -0
- package/template/src/components/site-header.tsx +87 -0
- package/template/src/components/theme-customizer/circular-transition.css +115 -0
- package/template/src/components/theme-customizer/import-modal.tsx +128 -0
- package/template/src/components/theme-customizer/index.tsx +229 -0
- package/template/src/components/theme-customizer/layout-tab.tsx +274 -0
- package/template/src/components/theme-customizer/main.tsx +7 -0
- package/template/src/components/theme-customizer/theme-tab.tsx +403 -0
- package/template/src/components/theme-customizer.tsx +6 -0
- package/template/src/components/theme-provider.tsx +62 -0
- package/template/src/components/ui/accordion.tsx +77 -0
- package/template/src/components/ui/alert.tsx +75 -0
- package/template/src/components/ui/avatar.tsx +108 -0
- package/template/src/components/ui/badge.tsx +51 -0
- package/template/src/components/ui/breadcrumb.tsx +121 -0
- package/template/src/components/ui/button.tsx +57 -0
- package/template/src/components/ui/calendar.tsx +228 -0
- package/template/src/components/ui/card-decorator.tsx +20 -0
- package/template/src/components/ui/card.tsx +102 -0
- package/template/src/components/ui/chart.tsx +372 -0
- package/template/src/components/ui/checkbox.tsx +27 -0
- package/template/src/components/ui/collapsible.tsx +21 -0
- package/template/src/components/ui/command.tsx +193 -0
- package/template/src/components/ui/dialog.tsx +156 -0
- package/template/src/components/ui/drawer.tsx +224 -0
- package/template/src/components/ui/dropdown-menu.tsx +271 -0
- package/template/src/components/ui/field.tsx +238 -0
- package/template/src/components/ui/hover-card.tsx +50 -0
- package/template/src/components/ui/input-group.tsx +158 -0
- package/template/src/components/ui/input.tsx +19 -0
- package/template/src/components/ui/kbd.tsx +26 -0
- package/template/src/components/ui/label.tsx +19 -0
- package/template/src/components/ui/loading-spinner.tsx +31 -0
- package/template/src/components/ui/navigation-menu.tsx +170 -0
- package/template/src/components/ui/popover.tsx +89 -0
- package/template/src/components/ui/progress.tsx +82 -0
- package/template/src/components/ui/radio-group.tsx +37 -0
- package/template/src/components/ui/resizable.tsx +49 -0
- package/template/src/components/ui/scroll-area.tsx +54 -0
- package/template/src/components/ui/select.tsx +201 -0
- package/template/src/components/ui/separator.tsx +24 -0
- package/template/src/components/ui/sheet.tsx +134 -0
- package/template/src/components/ui/sidebar.tsx +726 -0
- package/template/src/components/ui/skeleton.tsx +13 -0
- package/template/src/components/ui/switch.tsx +31 -0
- package/template/src/components/ui/table.tsx +115 -0
- package/template/src/components/ui/tabs.tsx +81 -0
- package/template/src/components/ui/textarea.tsx +17 -0
- package/template/src/components/ui/toast.tsx +229 -0
- package/template/src/components/ui/toggle-group.tsx +89 -0
- package/template/src/components/ui/toggle.tsx +44 -0
- package/template/src/components/ui/tooltip.tsx +65 -0
- package/template/src/components/upgrade-to-pro-button.tsx +107 -0
- package/template/src/config/site.ts +8 -0
- package/template/src/config/theme-customizer-constants.ts +56 -0
- package/template/src/config/theme-data.ts +29 -0
- package/template/src/contexts/sidebar-config.ts +16 -0
- package/template/src/contexts/sidebar-context.tsx +33 -0
- package/template/src/contexts/theme-context.ts +16 -0
- package/template/src/hooks/use-circular-transition.ts +83 -0
- package/template/src/hooks/use-fullscreen.ts +43 -0
- package/template/src/hooks/use-mobile.ts +18 -0
- package/template/src/hooks/use-sidebar-config.ts +15 -0
- package/template/src/hooks/use-theme-manager.ts +218 -0
- package/template/src/hooks/use-theme.ts +11 -0
- package/template/src/lib/data-table.ts +54 -0
- package/template/src/lib/fonts.ts +8 -0
- package/template/src/lib/utils.ts +7 -0
- package/template/src/proxy.ts +38 -0
- package/template/src/types/theme-customizer.ts +45 -0
- package/template/src/types/theme.ts +58 -0
- package/template/src/utils/shadcn-ui-theme-presets.ts +741 -0
- package/template/src/utils/tweakcn-theme-presets.ts +3425 -0
- package/template/tsconfig.json +41 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useState } from "react"
|
|
4
|
+
import {
|
|
5
|
+
Check,
|
|
6
|
+
ChevronRight,
|
|
7
|
+
Plus,
|
|
8
|
+
Eye,
|
|
9
|
+
EyeOff,
|
|
10
|
+
MoreHorizontal,
|
|
11
|
+
} from "lucide-react"
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
Collapsible,
|
|
15
|
+
CollapsibleContent,
|
|
16
|
+
CollapsibleTrigger,
|
|
17
|
+
} from "@/components/ui/collapsible"
|
|
18
|
+
import {
|
|
19
|
+
DropdownMenu,
|
|
20
|
+
DropdownMenuContent,
|
|
21
|
+
DropdownMenuGroup,
|
|
22
|
+
DropdownMenuItem,
|
|
23
|
+
DropdownMenuSeparator,
|
|
24
|
+
DropdownMenuTrigger,
|
|
25
|
+
} from "@/components/ui/dropdown-menu"
|
|
26
|
+
import { cn } from "@/lib/utils"
|
|
27
|
+
|
|
28
|
+
interface CalendarItem {
|
|
29
|
+
id: string
|
|
30
|
+
name: string
|
|
31
|
+
color: string
|
|
32
|
+
visible: boolean
|
|
33
|
+
type: "personal" | "work" | "shared"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface CalendarGroup {
|
|
37
|
+
name: string
|
|
38
|
+
items: CalendarItem[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface CalendarsProps {
|
|
42
|
+
calendars?: {
|
|
43
|
+
name: string
|
|
44
|
+
items: string[]
|
|
45
|
+
}[]
|
|
46
|
+
onCalendarToggle?: (calendarId: string, visible: boolean) => void
|
|
47
|
+
onCalendarEdit?: (calendarId: string) => void
|
|
48
|
+
onCalendarDelete?: (calendarId: string) => void
|
|
49
|
+
onNewCalendar?: () => void
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Enhanced calendar data with colors and visibility
|
|
53
|
+
const enhancedCalendars: CalendarGroup[] = [
|
|
54
|
+
{
|
|
55
|
+
name: "My Calendars",
|
|
56
|
+
items: [
|
|
57
|
+
{
|
|
58
|
+
id: "personal",
|
|
59
|
+
name: "Personal",
|
|
60
|
+
color: "bg-blue-500",
|
|
61
|
+
visible: true,
|
|
62
|
+
type: "personal",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "work",
|
|
66
|
+
name: "Work",
|
|
67
|
+
color: "bg-green-500",
|
|
68
|
+
visible: true,
|
|
69
|
+
type: "work",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "family",
|
|
73
|
+
name: "Family",
|
|
74
|
+
color: "bg-pink-500",
|
|
75
|
+
visible: true,
|
|
76
|
+
type: "personal",
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "Favorites",
|
|
82
|
+
items: [
|
|
83
|
+
{
|
|
84
|
+
id: "holidays",
|
|
85
|
+
name: "Holidays",
|
|
86
|
+
color: "bg-red-500",
|
|
87
|
+
visible: true,
|
|
88
|
+
type: "shared",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "birthdays",
|
|
92
|
+
name: "Birthdays",
|
|
93
|
+
color: "bg-purple-500",
|
|
94
|
+
visible: true,
|
|
95
|
+
type: "personal",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "Other",
|
|
101
|
+
items: [
|
|
102
|
+
{
|
|
103
|
+
id: "travel",
|
|
104
|
+
name: "Travel",
|
|
105
|
+
color: "bg-orange-500",
|
|
106
|
+
visible: false,
|
|
107
|
+
type: "personal",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "reminders",
|
|
111
|
+
name: "Reminders",
|
|
112
|
+
color: "bg-yellow-500",
|
|
113
|
+
visible: true,
|
|
114
|
+
type: "personal",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "deadlines",
|
|
118
|
+
name: "Deadlines",
|
|
119
|
+
color: "bg-red-600",
|
|
120
|
+
visible: true,
|
|
121
|
+
type: "work",
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
export function Calendars({
|
|
128
|
+
onCalendarToggle,
|
|
129
|
+
onCalendarEdit,
|
|
130
|
+
onCalendarDelete,
|
|
131
|
+
onNewCalendar,
|
|
132
|
+
}: CalendarsProps) {
|
|
133
|
+
const [calendarData, setCalendarData] = useState(enhancedCalendars)
|
|
134
|
+
|
|
135
|
+
const handleToggleVisibility = (calendarId: string) => {
|
|
136
|
+
setCalendarData((prev) =>
|
|
137
|
+
prev.map((group) => ({
|
|
138
|
+
...group,
|
|
139
|
+
items: group.items.map((item) =>
|
|
140
|
+
item.id === calendarId ? { ...item, visible: !item.visible } : item
|
|
141
|
+
),
|
|
142
|
+
}))
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
const calendar = calendarData
|
|
146
|
+
.flatMap((g) => g.items)
|
|
147
|
+
.find((c) => c.id === calendarId)
|
|
148
|
+
if (calendar) {
|
|
149
|
+
onCalendarToggle?.(calendarId, !calendar.visible)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<div className="flex flex-col gap-4">
|
|
155
|
+
{calendarData.map((calendar, index) => (
|
|
156
|
+
<div key={calendar.name}>
|
|
157
|
+
<Collapsible defaultOpen={index === 0} className="group/collapsible">
|
|
158
|
+
<CollapsibleTrigger className="flex items-center justify-between w-full p-2 hover:bg-accent hover:text-accent-foreground rounded-md cursor-pointer">
|
|
159
|
+
<span className="text-sm font-medium">{calendar.name}</span>
|
|
160
|
+
<div className="flex items-center gap-1">
|
|
161
|
+
{index === 0 && (
|
|
162
|
+
<div
|
|
163
|
+
className="size-5 flex items-center justify-center opacity-0 group-hover/collapsible:opacity-100 cursor-pointer hover:bg-accent rounded-sm"
|
|
164
|
+
onClick={(e) => {
|
|
165
|
+
e.stopPropagation()
|
|
166
|
+
onNewCalendar?.()
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
<Plus className="size-3" />
|
|
170
|
+
</div>
|
|
171
|
+
)}
|
|
172
|
+
<ChevronRight className="size-4 transition-transform group-data-open/collapsible:rotate-90" />
|
|
173
|
+
</div>
|
|
174
|
+
</CollapsibleTrigger>
|
|
175
|
+
|
|
176
|
+
<CollapsibleContent>
|
|
177
|
+
<div className="flex flex-col mt-2 gap-1">
|
|
178
|
+
{calendar.items.map((item) => (
|
|
179
|
+
<div key={item.id} className="group/calendar-item">
|
|
180
|
+
<div className="flex items-center justify-between p-2 hover:bg-accent/50 rounded-md">
|
|
181
|
+
<div className="flex items-center gap-3 flex-1">
|
|
182
|
+
{/* Calendar Color & Visibility Toggle */}
|
|
183
|
+
<button
|
|
184
|
+
onClick={() => handleToggleVisibility(item.id)}
|
|
185
|
+
className={cn(
|
|
186
|
+
"flex aspect-square size-4 shrink-0 items-center justify-center rounded-sm border transition-all cursor-pointer",
|
|
187
|
+
item.visible
|
|
188
|
+
? cn("border-transparent text-white", item.color)
|
|
189
|
+
: "border-border bg-transparent"
|
|
190
|
+
)}
|
|
191
|
+
>
|
|
192
|
+
{item.visible && <Check className="size-3" />}
|
|
193
|
+
</button>
|
|
194
|
+
|
|
195
|
+
{/* Calendar Name */}
|
|
196
|
+
<span
|
|
197
|
+
className={cn(
|
|
198
|
+
"flex-1 truncate text-sm cursor-pointer",
|
|
199
|
+
!item.visible && "text-muted-foreground"
|
|
200
|
+
)}
|
|
201
|
+
onClick={() => handleToggleVisibility(item.id)}
|
|
202
|
+
>
|
|
203
|
+
{item.name}
|
|
204
|
+
</span>
|
|
205
|
+
|
|
206
|
+
{/* Visibility Icon */}
|
|
207
|
+
<div className="opacity-0 group-hover/calendar-item:opacity-100">
|
|
208
|
+
{item.visible ? (
|
|
209
|
+
<Eye className="size-3 text-muted-foreground" />
|
|
210
|
+
) : (
|
|
211
|
+
<EyeOff className="size-3 text-muted-foreground" />
|
|
212
|
+
)}
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
{/* More Options */}
|
|
216
|
+
<DropdownMenu>
|
|
217
|
+
<DropdownMenuTrigger
|
|
218
|
+
nativeButton={false}
|
|
219
|
+
render={
|
|
220
|
+
<div
|
|
221
|
+
className="size-5 flex items-center justify-center p-0 opacity-0 group-hover/calendar-item:opacity-100 cursor-pointer hover:bg-accent rounded-sm"
|
|
222
|
+
onClick={(e) => e.stopPropagation()}
|
|
223
|
+
/>
|
|
224
|
+
}
|
|
225
|
+
>
|
|
226
|
+
<MoreHorizontal />
|
|
227
|
+
</DropdownMenuTrigger>
|
|
228
|
+
<DropdownMenuContent align="end" side="right">
|
|
229
|
+
<DropdownMenuGroup>
|
|
230
|
+
<DropdownMenuItem
|
|
231
|
+
onClick={() => onCalendarEdit?.(item.id)}
|
|
232
|
+
className="cursor-pointer"
|
|
233
|
+
>
|
|
234
|
+
Edit calendar
|
|
235
|
+
</DropdownMenuItem>
|
|
236
|
+
<DropdownMenuItem
|
|
237
|
+
onClick={() => handleToggleVisibility(item.id)}
|
|
238
|
+
className="cursor-pointer"
|
|
239
|
+
>
|
|
240
|
+
{item.visible ? "Hide" : "Show"} calendar
|
|
241
|
+
</DropdownMenuItem>
|
|
242
|
+
</DropdownMenuGroup>
|
|
243
|
+
<DropdownMenuSeparator />
|
|
244
|
+
<DropdownMenuGroup>
|
|
245
|
+
<DropdownMenuItem
|
|
246
|
+
onClick={() => onCalendarDelete?.(item.id)}
|
|
247
|
+
className="cursor-pointer text-destructive"
|
|
248
|
+
>
|
|
249
|
+
Delete calendar
|
|
250
|
+
</DropdownMenuItem>
|
|
251
|
+
</DropdownMenuGroup>
|
|
252
|
+
</DropdownMenuContent>
|
|
253
|
+
</DropdownMenu>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
))}
|
|
258
|
+
</div>
|
|
259
|
+
</CollapsibleContent>
|
|
260
|
+
</Collapsible>
|
|
261
|
+
</div>
|
|
262
|
+
))}
|
|
263
|
+
</div>
|
|
264
|
+
)
|
|
265
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useState } from "react"
|
|
4
|
+
import { Calendar } from "@/components/ui/calendar"
|
|
5
|
+
|
|
6
|
+
interface DatePickerProps {
|
|
7
|
+
selectedDate?: Date
|
|
8
|
+
onDateSelect?: (date: Date) => void
|
|
9
|
+
events?: Array<{ date: Date; count: number }>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function DatePicker({
|
|
13
|
+
selectedDate,
|
|
14
|
+
onDateSelect,
|
|
15
|
+
events = [],
|
|
16
|
+
}: DatePickerProps) {
|
|
17
|
+
const [date, setDate] = useState<Date | undefined>(selectedDate || new Date())
|
|
18
|
+
|
|
19
|
+
const handleDateSelect = (selectedDate: Date | undefined) => {
|
|
20
|
+
if (selectedDate) {
|
|
21
|
+
setDate(selectedDate)
|
|
22
|
+
onDateSelect?.(selectedDate)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Create a map of dates with events for styling
|
|
27
|
+
const eventDates = events.reduce(
|
|
28
|
+
(acc, event) => {
|
|
29
|
+
const dateKey = event.date.toDateString()
|
|
30
|
+
acc[dateKey] = event.count
|
|
31
|
+
return acc
|
|
32
|
+
},
|
|
33
|
+
{} as Record<string, number>
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="flex justify-center">
|
|
38
|
+
<Calendar
|
|
39
|
+
mode="single"
|
|
40
|
+
selected={date}
|
|
41
|
+
onSelect={handleDateSelect}
|
|
42
|
+
className="w-full [&_[role=gridcell]_button]:cursor-pointer [&_button]:cursor-pointer"
|
|
43
|
+
modifiers={{
|
|
44
|
+
hasEvents: (date) => {
|
|
45
|
+
const eventCount = eventDates[date.toDateString()]
|
|
46
|
+
return Boolean(eventCount && eventCount > 0)
|
|
47
|
+
},
|
|
48
|
+
}}
|
|
49
|
+
modifiersClassNames={{
|
|
50
|
+
hasEvents:
|
|
51
|
+
"relative after:absolute after:bottom-1 after:right-1 after:w-1.5 after:h-1.5 after:bg-primary after:rounded-full",
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|