|
1 | | -import { Form, Link, useNavigation, useSearchParams } from "@remix-run/react"; |
| 1 | +import { |
| 2 | + Form, |
| 3 | + Link, |
| 4 | + useMatches, |
| 5 | + useNavigation, |
| 6 | + useSearchParams, |
| 7 | +} from "@remix-run/react"; |
2 | 8 | import { |
3 | 9 | DropdownMenu, |
4 | 10 | DropdownMenuContent, |
@@ -35,6 +41,7 @@ export default function Menu() { |
35 | 41 | const navigation = useNavigation(); |
36 | 42 | const isLoggingOut = Boolean(navigation.state === "submitting"); |
37 | 43 | const user = useOptionalUser(); |
| 44 | + const matches = useMatches(); |
38 | 45 |
|
39 | 46 | const { t } = useTranslation("menu"); |
40 | 47 |
|
@@ -92,26 +99,32 @@ export default function Menu() { |
92 | 99 | <Spinner /> |
93 | 100 | </div> |
94 | 101 | )} |
95 | | - <Link to="/explore"> |
96 | | - <DropdownMenuItem className="cursor-pointer"> |
97 | | - <Compass className="mr-2 h-5 w-5" /> |
98 | | - <span>{"Explore"}</span> |
99 | | - </DropdownMenuItem> |
100 | | - </Link> |
101 | | - <Link to="/profile/me"> |
102 | | - <DropdownMenuItem className="cursor-pointer"> |
103 | | - <User2 className="mr-2 h-5 w-5" /> |
104 | | - Profile |
105 | | - </DropdownMenuItem> |
106 | | - </Link> |
| 102 | + {!(matches[1].pathname === "/explore") && ( |
| 103 | + <Link to="/explore"> |
| 104 | + <DropdownMenuItem className="cursor-pointer"> |
| 105 | + <Compass className="mr-2 h-5 w-5" /> |
| 106 | + <span>{"Explore"}</span> |
| 107 | + </DropdownMenuItem> |
| 108 | + </Link> |
| 109 | + )} |
| 110 | + {!(matches[1].pathname === "/profile") && ( |
| 111 | + <Link to="/profile/me"> |
| 112 | + <DropdownMenuItem className="cursor-pointer"> |
| 113 | + <User2 className="mr-2 h-5 w-5" /> |
| 114 | + Profile |
| 115 | + </DropdownMenuItem> |
| 116 | + </Link> |
| 117 | + )} |
107 | 118 |
|
108 | | - <Link to="/settings"> |
109 | | - <DropdownMenuItem className=" cursor-pointer"> |
110 | | - <Settings className="mr-2 h-5 w-5" /> |
111 | | - <span>{"Settings"}</span> |
112 | | - </DropdownMenuItem> |
113 | | - <DropdownMenuSeparator /> |
114 | | - </Link> |
| 119 | + {!(matches[1].pathname === "/settings") && ( |
| 120 | + <Link to="/settings/profile"> |
| 121 | + <DropdownMenuItem className=" cursor-pointer"> |
| 122 | + <Settings className="mr-2 h-5 w-5" /> |
| 123 | + <span>{"Settings"}</span> |
| 124 | + </DropdownMenuItem> |
| 125 | + <DropdownMenuSeparator /> |
| 126 | + </Link> |
| 127 | + )} |
115 | 128 | </DropdownMenuGroup> |
116 | 129 | )} |
117 | 130 | <DropdownMenuGroup> |
|
0 commit comments