Skip to content

Commit

Permalink
fix: fix route disable if disable plugin store
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Dec 6, 2023
1 parent 16ed9da commit ad59c97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions client/web/src/routes/Main/Content/Personal/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ SidebarSection.displayName = 'SidebarSection';
export const PersonalSidebar: React.FC = React.memo(() => {
const converseList = useDMConverseList();
const userInfo = useUserInfo();
const { disablePluginStore } = useGlobalConfigStore((state) => ({
disablePluginStore: state.disablePluginStore,
}));
const disablePluginStore = useGlobalConfigStore(
(state) => state.disablePluginStore
);
const hasFriendRequest = useAppSelector(
(state) =>
state.user.friendRequests.findIndex(
Expand Down
8 changes: 7 additions & 1 deletion client/web/src/routes/Main/Content/Personal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ import { PersonalConverse } from './Converse';
import { FriendPanel } from './Friends';
import { PluginsPanel } from './Plugins';
import { PersonalSidebar } from './Sidebar';
import { useGlobalConfigStore } from 'tailchat-shared';

export const Personal: React.FC = React.memo(() => {
const [lastVisitPanelUrl, setLastVisitPanelUrl] = useUserSessionPreference(
'personLastVisitPanelUrl'
);
const location = useLocation();
const disablePluginStore = useGlobalConfigStore(
(state) => state.disablePluginStore
);

useEffect(() => {
setLastVisitPanelUrl(location.pathname);
Expand All @@ -24,7 +28,9 @@ export const Personal: React.FC = React.memo(() => {
<PageContent data-tc-role="content-personal" sidebar={<PersonalSidebar />}>
<Routes>
<Route path="/friends" element={<FriendPanel />} />
<Route path="/plugins" element={<PluginsPanel />} />
{!disablePluginStore && (
<Route path="/plugins" element={<PluginsPanel />} />
)}
<Route path="/converse/:converseId" element={<PersonalConverse />} />
{pluginCustomPanel
.filter((p) => p.position === 'personal')
Expand Down

0 comments on commit ad59c97

Please sign in to comment.