diff --git a/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx b/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx
index bf56b805..3fe4d52f 100644
--- a/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx
+++ b/apps/web/components/dashboard/sidebar/SidebarProfileOptions.tsx
@@ -1,5 +1,6 @@
"use client";
+import { useToggleTheme } from "@/components/theme-provider";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
@@ -13,28 +14,29 @@ import { signOut } from "next-auth/react";
import { useTheme } from "next-themes";
function DarkModeToggle() {
- const { theme, setTheme } = useTheme();
+ const { theme } = useTheme();
let comp;
if (theme == "dark") {
comp = (
-
+
);
} else {
comp = (
-
+
);
}
return {comp};
}
export default function SidebarProfileOptions() {
+ const toggleTheme = useToggleTheme();
return (
@@ -43,7 +45,7 @@ export default function SidebarProfileOptions() {
-
+
{children};
}
+
+export function useToggleTheme() {
+ const { theme, setTheme } = useTheme();
+ if (theme == "dark") {
+ return () => setTheme("light");
+ } else {
+ return () => setTheme("dark");
+ }
+}