From 94fb5c7eb161e71a1f22ebf754ab68bc2a001464 Mon Sep 17 00:00:00 2001 From: Ahmad <103906421+ahmadk953@users.noreply.github.com> Date: Mon, 13 Jan 2025 19:12:06 -0500 Subject: [PATCH] Added Basic Darkmode and Fixed Small Bugs --- __tests__/__snapshots__/index.test.tsx.snap | 2 +- __tests__/utils.test.ts | 40 ++++ app/(main)/_components/footer.tsx | 2 +- app/(main)/_components/navbar.tsx | 9 +- app/(main)/blog/page.tsx | 10 +- app/(main)/layout.tsx | 6 +- app/(main)/page.tsx | 2 +- .../(dashboard)/_components/Navbar.tsx | 4 +- .../(dashboard)/_components/nav-item.tsx | 11 +- .../[boardId]/_components/board-navbar.tsx | 2 +- .../[boardId]/_components/board-options.tsx | 8 +- .../_components/board-update-image.tsx | 8 +- .../board/[boardId]/_components/card-item.tsx | 6 +- .../board/[boardId]/_components/list-form.tsx | 4 +- .../board/[boardId]/_components/list-item.tsx | 2 +- .../(dashboard)/board/[boardId]/layout.tsx | 6 - .../_components/board-list.tsx | 2 +- .../[organizationId]/activity/page.tsx | 8 +- app/(platform)/layout.tsx | 15 +- app/layout.tsx | 12 +- components/activity-item.tsx | 2 +- components/form/form-input.tsx | 2 +- components/form/form-picker.tsx | 2 +- components/form/form-popover.tsx | 8 +- components/logo.tsx | 12 +- components/modals/card-modal/actions.tsx | 6 +- components/modals/card-modal/activity.tsx | 6 +- components/modals/card-modal/description.tsx | 8 +- components/modals/card-modal/header.tsx | 4 +- components/modals/pro-modal.tsx | 4 +- components/theme-provider.tsx | 11 + components/ui/button.tsx | 5 +- components/ui/dropdown-menu.tsx | 200 ++++++++++++++++++ components/ui/mode-toggle.tsx | 39 ++++ docs/mint.json | 5 +- docs/public/logo-dark.svg | 38 ++++ .../{logo-transparent.svg => logo-light.svg} | 0 package.json | 3 + public/logo-dark.svg | 38 ++++ .../{logo-transparent.svg => logo-light.svg} | 0 tailwind.config.ts | 2 +- yarn.lock | 111 ++++++++++ 42 files changed, 593 insertions(+), 72 deletions(-) create mode 100644 __tests__/utils.test.ts create mode 100644 components/theme-provider.tsx create mode 100644 components/ui/dropdown-menu.tsx create mode 100644 components/ui/mode-toggle.tsx create mode 100644 docs/public/logo-dark.svg rename docs/public/{logo-transparent.svg => logo-light.svg} (100%) create mode 100644 public/logo-dark.svg rename public/{logo-transparent.svg => logo-light.svg} (100%) diff --git a/__tests__/__snapshots__/index.test.tsx.snap b/__tests__/__snapshots__/index.test.tsx.snap index e76a1fd..41d1f31 100644 --- a/__tests__/__snapshots__/index.test.tsx.snap +++ b/__tests__/__snapshots__/index.test.tsx.snap @@ -14,7 +14,7 @@ exports[`Home renders homepage unchanged 1`] = ` No 1 task management app

Tasko helps teams move

diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts new file mode 100644 index 0000000..11bc331 --- /dev/null +++ b/__tests__/utils.test.ts @@ -0,0 +1,40 @@ +import { cn, absoluteUrl } from '@/lib/utils'; + +describe('absoluteUrl', () => { + const originalEnv = process.env; + + beforeEach(() => { + process.env = { + ...originalEnv, + NEXT_PUBLIC_APP_URL: 'https://example.com', + }; + }); + + afterEach(() => { + process.env = originalEnv; + }); + + it('should return the correct absolute URL', () => { + const pathname = '/test'; + expect(absoluteUrl(pathname)).toBe('https://example.com/test'); + }); + + it('should handle empty pathname', () => { + const pathname = ''; + expect(absoluteUrl(pathname)).toBe('https://example.com'); + }); +}); + +describe('cn', () => { + it('should merge multiple class names', () => { + expect(cn('class1', 'class2')).toBe('class1 class2'); + }); + + it('should handle conditional class names', () => { + const isActive = true; + expect(cn('base', isActive && 'active')).toBe('base active'); + + const isDisabled = false; + expect(cn('base', isDisabled && 'disabled')).toBe('base'); + }); +}); diff --git a/app/(main)/_components/footer.tsx b/app/(main)/_components/footer.tsx index bf6da7a..bea046b 100644 --- a/app/(main)/_components/footer.tsx +++ b/app/(main)/_components/footer.tsx @@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'; export const Footer = () => { return ( -
+
diff --git a/app/(main)/_components/navbar.tsx b/app/(main)/_components/navbar.tsx index b8374e0..335e7a1 100644 --- a/app/(main)/_components/navbar.tsx +++ b/app/(main)/_components/navbar.tsx @@ -3,6 +3,7 @@ import { auth } from '@clerk/nextjs/server'; import { Logo } from '@/components/logo'; import { Button } from '@/components/ui/button'; +import { ModeToggle } from '@/components/ui/mode-toggle'; export const Navbar = async () => { const { userId } = await auth(); @@ -10,7 +11,7 @@ export const Navbar = async () => { let isSignedIn = !!userId; return ( -
+
+ ); }; diff --git a/app/(main)/blog/page.tsx b/app/(main)/blog/page.tsx index 4e956f5..6951af9 100644 --- a/app/(main)/blog/page.tsx +++ b/app/(main)/blog/page.tsx @@ -5,7 +5,9 @@ import Link from 'next/link'; const BlogPage = () => { return (
-

Blog

+

+ Blog +

{allBlogPosts.map((post) => (
@@ -17,10 +19,12 @@ const BlogPage = () => { alt='post cover image' className='aspect-video w-full rounded-md object-cover' /> -

+

{post.title}

-

{post.summary}

+

+ {post.summary} +

))} diff --git a/app/(main)/layout.tsx b/app/(main)/layout.tsx index 9cdd5d6..2a2dc51 100644 --- a/app/(main)/layout.tsx +++ b/app/(main)/layout.tsx @@ -3,9 +3,11 @@ import { Navbar } from './_components/navbar'; const MarketingLayout = ({ children }: { children: React.ReactNode }) => { return ( -
+
-
{children}
+
+ {children} +
); diff --git a/app/(main)/page.tsx b/app/(main)/page.tsx index ab5657e..d525869 100644 --- a/app/(main)/page.tsx +++ b/app/(main)/page.tsx @@ -26,7 +26,7 @@ const MarketingPage = () => { No 1 task management app
-

+

Tasko helps teams move

diff --git a/app/(platform)/(dashboard)/_components/Navbar.tsx b/app/(platform)/(dashboard)/_components/Navbar.tsx index d05701a..60a131c 100644 --- a/app/(platform)/(dashboard)/_components/Navbar.tsx +++ b/app/(platform)/(dashboard)/_components/Navbar.tsx @@ -6,10 +6,11 @@ import { Button } from '@/components/ui/button'; import { FormPopover } from '@/components/form/form-popover'; import { MobileSidebar } from './mobile-sidebar'; +import { ModeToggle } from '@/components/ui/mode-toggle'; export const Navbar = () => { return ( -