Fix 2 small bugs following tasks migration (#6483)
This PR fixes two bugs: - A broken link to the task page that had been left on the mobile version - On Kanban cards, the badge for notes/tasks wasn't properly displayed because the title wasn't loaded from the backend
This commit is contained in:
@ -1,21 +1,12 @@
|
|||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
import { useRecoilState } from 'recoil';
|
import { useRecoilState } from 'recoil';
|
||||||
import {
|
import { IconComponent, IconList, IconSearch, IconSettings } from 'twenty-ui';
|
||||||
IconCheckbox,
|
|
||||||
IconComponent,
|
|
||||||
IconList,
|
|
||||||
IconSearch,
|
|
||||||
IconSettings,
|
|
||||||
} from 'twenty-ui';
|
|
||||||
|
|
||||||
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||||
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
|
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
|
||||||
import { AppPath } from '@/types/AppPath';
|
|
||||||
import { NavigationBar } from '@/ui/navigation/navigation-bar/components/NavigationBar';
|
import { NavigationBar } from '@/ui/navigation/navigation-bar/components/NavigationBar';
|
||||||
import { isNavigationDrawerOpenState } from '@/ui/navigation/states/isNavigationDrawerOpenState';
|
import { isNavigationDrawerOpenState } from '@/ui/navigation/states/isNavigationDrawerOpenState';
|
||||||
|
|
||||||
import { useIsSettingsPage } from '../hooks/useIsSettingsPage';
|
import { useIsSettingsPage } from '../hooks/useIsSettingsPage';
|
||||||
import { useIsTasksPage } from '../hooks/useIsTasksPage';
|
|
||||||
import { currentMobileNavigationDrawerState } from '../states/currentMobileNavigationDrawerState';
|
import { currentMobileNavigationDrawerState } from '../states/currentMobileNavigationDrawerState';
|
||||||
|
|
||||||
type NavigationBarItemName = 'main' | 'search' | 'tasks' | 'settings';
|
type NavigationBarItemName = 'main' | 'search' | 'tasks' | 'settings';
|
||||||
@ -23,9 +14,7 @@ type NavigationBarItemName = 'main' | 'search' | 'tasks' | 'settings';
|
|||||||
export const MobileNavigationBar = () => {
|
export const MobileNavigationBar = () => {
|
||||||
const [isCommandMenuOpened] = useRecoilState(isCommandMenuOpenedState);
|
const [isCommandMenuOpened] = useRecoilState(isCommandMenuOpenedState);
|
||||||
const { closeCommandMenu, openCommandMenu } = useCommandMenu();
|
const { closeCommandMenu, openCommandMenu } = useCommandMenu();
|
||||||
const isTasksPage = useIsTasksPage();
|
|
||||||
const isSettingsPage = useIsSettingsPage();
|
const isSettingsPage = useIsSettingsPage();
|
||||||
const navigate = useNavigate();
|
|
||||||
const [isNavigationDrawerOpen, setIsNavigationDrawerOpen] = useRecoilState(
|
const [isNavigationDrawerOpen, setIsNavigationDrawerOpen] = useRecoilState(
|
||||||
isNavigationDrawerOpenState,
|
isNavigationDrawerOpenState,
|
||||||
);
|
);
|
||||||
@ -36,11 +25,9 @@ export const MobileNavigationBar = () => {
|
|||||||
? currentMobileNavigationDrawer
|
? currentMobileNavigationDrawer
|
||||||
: isCommandMenuOpened
|
: isCommandMenuOpened
|
||||||
? 'search'
|
? 'search'
|
||||||
: isTasksPage
|
: isSettingsPage
|
||||||
? 'tasks'
|
? 'settings'
|
||||||
: isSettingsPage
|
: 'main';
|
||||||
? 'settings'
|
|
||||||
: 'main';
|
|
||||||
|
|
||||||
const items: {
|
const items: {
|
||||||
name: NavigationBarItemName;
|
name: NavigationBarItemName;
|
||||||
@ -68,15 +55,6 @@ export const MobileNavigationBar = () => {
|
|||||||
setIsNavigationDrawerOpen(false);
|
setIsNavigationDrawerOpen(false);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'tasks',
|
|
||||||
Icon: IconCheckbox,
|
|
||||||
onClick: () => {
|
|
||||||
closeCommandMenu();
|
|
||||||
setIsNavigationDrawerOpen(false);
|
|
||||||
navigate(AppPath.TasksPage);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'settings',
|
name: 'settings',
|
||||||
Icon: IconSettings,
|
Icon: IconSettings,
|
||||||
|
|||||||
@ -44,6 +44,18 @@ export const useRecordBoardRecordGqlFields = ({
|
|||||||
),
|
),
|
||||||
...(hasPositionField(objectMetadataItem) ? { position: true } : undefined),
|
...(hasPositionField(objectMetadataItem) ? { position: true } : undefined),
|
||||||
...identifierQueryFields,
|
...identifierQueryFields,
|
||||||
|
noteTargets: {
|
||||||
|
note: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
taskTargets: {
|
||||||
|
task: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isDefined(kanbanFieldMetadataName)) {
|
if (isDefined(kanbanFieldMetadataName)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user