From 1ceeb144ba20f3f1b369c8c1a2de70391ac25fdb Mon Sep 17 00:00:00 2001
From: mortale2004 <114370142+mortale2004@users.noreply.github.com>
Date: Thu, 26 Sep 2024 16:47:06 +0530
Subject: [PATCH] fix: The theme toggle button appears twice. (#1315)
* fix: Greeting in the home page
* fix:UX of 'Sidebar.tsx' while navigating to course ccontent.
* fixed: extra dropdown button for the changing theme and formatting
* fixed: incorrect greeting issue
---
src/components/Greeting.tsx | 8 +++++---
src/components/Sidebar.tsx | 1 +
src/components/profile-menu/ProfileDropdown.tsx | 5 -----
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/components/Greeting.tsx b/src/components/Greeting.tsx
index d52ecc7e3..38f265e41 100644
--- a/src/components/Greeting.tsx
+++ b/src/components/Greeting.tsx
@@ -5,10 +5,12 @@ export const Greeting = () => {
const currentHour = new Date().getHours();
// Determine the appropriate greeting based on the time of day
- let greeting = 'Good Morning';
- if (currentHour >= 12 && currentHour < 18) {
+ let greeting;
+ if (currentHour >= 4 && currentHour < 12) {
+ greeting = 'Good Morning';
+ } else if (currentHour >= 12 && currentHour < 17) {
greeting = 'Good Afternoon';
- } else if (currentHour >= 18 || currentHour < 5) {
+ } else if (currentHour >= 17 && currentHour <= 20) {
greeting = 'Good Evening';
} else {
greeting = 'Surprise to see you here!';
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 10614e6e0..c3e70dd37 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -101,6 +101,7 @@ export function Sidebar({
currentUrlContentId,
);
setCurrentActiveContentIds(pathArray || []);
+ setSidebarOpen(false);
}
}
}, [pathName, findPathToContent, fullCourseContent]);
diff --git a/src/components/profile-menu/ProfileDropdown.tsx b/src/components/profile-menu/ProfileDropdown.tsx
index d70504847..84a52359a 100644
--- a/src/components/profile-menu/ProfileDropdown.tsx
+++ b/src/components/profile-menu/ProfileDropdown.tsx
@@ -20,7 +20,6 @@ import {
} from '@/components/ui/dropdown-menu';
import ExternalLinks from './ExternalLinks';
import { signOut } from 'next-auth/react';
-import { SelectTheme } from '../ThemeToggler';
const ProfileDropdown = () => {
const menuItemLinks = [
@@ -78,10 +77,6 @@ const ProfileDropdown = () => {
-
-
-
-
{
signOut();