+
Preference
{profilePreferenceLinks.map((link) => (
(null);
+
+ useOutsideClickDetector(ref, () => {
+ if (sidebarCollapsed === false) {
+ if (window.innerWidth < 768) {
+ toggleSidebar();
+ }
+ }
+ });
+
+ useEffect(() => {
+ const handleResize = () => {
+ if (window.innerWidth <= 768) {
+ toggleSidebar(true);
+ }
+ };
+ handleResize();
+ window.addEventListener("resize", handleResize);
+ return () => {
+ window.removeEventListener("resize", handleResize);
+ };
+ }, [toggleSidebar]);
+
+ const handleItemClick = () => {
+ if (window.innerWidth < 768) {
+ toggleSidebar();
+ }
+ };
+
const handleSignOut = async () => {
setIsSigningOut(true);
@@ -73,16 +103,18 @@ export const ProfileLayoutSidebar = observer(() => {
return (
{link.label}
diff --git a/web/layouts/settings-layout/profile/sidebar.tsx b/web/layouts/settings-layout/profile/sidebar.tsx
index 0a97b3364..4b8a1b854 100644
--- a/web/layouts/settings-layout/profile/sidebar.tsx
+++ b/web/layouts/settings-layout/profile/sidebar.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { mutate } from "swr";
import Link from "next/link";
import { useRouter } from "next/router";
@@ -12,6 +12,7 @@ import useToast from "hooks/use-toast";
import { Tooltip } from "@plane/ui";
// constants
import { PROFILE_ACTION_LINKS } from "constants/profile";
+import useOutsideClickDetector from "hooks/use-outside-click-detector";
const WORKSPACE_ACTION_LINKS = [
{
@@ -52,6 +53,35 @@ export const ProfileLayoutSidebar = observer(() => {
currentUserSettings?.workspace?.fallback_workspace_slug ||
"";
+ const ref = useRef
-
+
@@ -101,14 +133,13 @@ export const ProfileLayoutSidebar = observer(() => {
if (link.key === "change-password" && currentUser?.is_password_autoset) return null;
return (
-
+
{ }
{!sidebarCollapsed && link.label}
@@ -129,19 +160,17 @@ export const ProfileLayoutSidebar = observer(() => {
{workspace?.logo && workspace.logo !== "" ? (
{
)}
{WORKSPACE_ACTION_LINKS.map((link) => (
-
+
{ }
{!sidebarCollapsed && link.label}
@@ -180,9 +208,8 @@ export const ProfileLayoutSidebar = observer(() => {