Skip to content

Commit

Permalink
♻️ refactor: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Dec 26, 2024
1 parent e9321e2 commit 74119d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('useCategory', () => {

const { result } = renderHook(() => useCategory(), { wrapper });


act(() => {
const items = result.current;
expect(items.some((item) => item.key === 'profile')).toBe(true);
Expand All @@ -84,7 +83,6 @@ describe('useCategory', () => {
expect(items.some((item) => item.key === 'docs')).toBe(true);
expect(items.some((item) => item.key === 'feedback')).toBe(true);
expect(items.some((item) => item.key === 'changelog')).toBe(true);
expect(items.some((item) => item.key === 'nextauthSignout')).toBe(false);
});
});

Expand Down
25 changes: 5 additions & 20 deletions src/app/(main)/(mobile)/me/(home)/features/useCategory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Download,
Feather,
FileClockIcon,
LogOut,
Settings2,
} from 'lucide-react';
import { useRouter } from 'next/navigation';
Expand All @@ -28,15 +27,11 @@ export const useCategory = () => {
const { canInstall, install } = usePWAInstall();
const { t } = useTranslation(['common', 'setting', 'auth']);
const { showCloudPromotion, hideDocs } = useServerConfigStore(featureFlagsSelectors);
const [isLogin, isLoginWithAuth, isLoginWithClerk, enableAuth, signOut, isLoginWithNextAuth] =
useUserStore((s) => [
authSelectors.isLogin(s),
authSelectors.isLoginWithAuth(s),
authSelectors.isLoginWithClerk(s),
authSelectors.enabledAuth(s),
s.logout,
authSelectors.isLoginWithNextAuth(s),
]);
const [isLogin, isLoginWithAuth, enableAuth] = useUserStore((s) => [
authSelectors.isLogin(s),
authSelectors.isLoginWithAuth(s),
authSelectors.enabledAuth(s),
]);

const profile: CellProps[] = [
{
Expand Down Expand Up @@ -121,15 +116,6 @@ export const useCategory = () => {
},
].filter(Boolean) as CellProps[];

const nextAuthSignOut: CellProps[] = [
{
icon: LogOut,
key: 'nextauthSignout',
label: t('auth:signout'),
onClick: signOut,
},
];

const mainItems = [
{
type: 'divider',
Expand All @@ -142,7 +128,6 @@ export const useCategory = () => {
...(canInstall ? pwa : []),
...(isLogin && !isServerMode ? data : []),
...(!hideDocs ? helps : []),
...(enableAuth && isLoginWithNextAuth ? nextAuthSignOut : []),
].filter(Boolean) as CellProps[];

return mainItems;
Expand Down
3 changes: 1 addition & 2 deletions src/features/User/UserPanel/useMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ export const useMenu = () => {
const openSettings = useOpenSettings();
const { t } = useTranslation(['common', 'setting', 'auth']);
const { showCloudPromotion, hideDocs } = useServerConfigStore(featureFlagsSelectors);
const [enableAuth, isLogin, isLoginWithAuth, isLoginWithClerk] = useUserStore((s) => [
const [enableAuth, isLogin, isLoginWithAuth] = useUserStore((s) => [
authSelectors.enabledAuth(s),
authSelectors.isLogin(s),
authSelectors.isLoginWithAuth(s),
authSelectors.isLoginWithClerk(s),
]);

const profile: MenuProps['items'] = [
Expand Down

0 comments on commit 74119d8

Please sign in to comment.