Skip to content

Commit

Permalink
fix: The theme toggle button appears twice. (code100x#1315)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mortale2004 authored Sep 26, 2024
1 parent b3b65c1 commit 1ceeb14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/components/Greeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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!';
Expand Down
1 change: 1 addition & 0 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export function Sidebar({
currentUrlContentId,
);
setCurrentActiveContentIds(pathArray || []);
setSidebarOpen(false);
}
}
}, [pathName, findPathToContent, fullCourseContent]);
Expand Down
5 changes: 0 additions & 5 deletions src/components/profile-menu/ProfileDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -78,10 +77,6 @@ const ProfileDropdown = () => {

<DropdownMenuSeparator />

<DropdownMenuItem>
<SelectTheme text={true} />
</DropdownMenuItem>

<DropdownMenuItem
onClick={() => {
signOut();
Expand Down

0 comments on commit 1ceeb14

Please sign in to comment.