@ -1,4 +1,5 @@
|
|||||||
import { Button, IconHeart } from 'twenty-ui';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
|
import { Button, IconButton, IconHeart } from 'twenty-ui';
|
||||||
|
|
||||||
type PageFavoriteButtonProps = {
|
type PageFavoriteButtonProps = {
|
||||||
isFavorite: boolean;
|
isFavorite: boolean;
|
||||||
@ -10,16 +11,32 @@ export const PageFavoriteButton = ({
|
|||||||
onClick,
|
onClick,
|
||||||
}: PageFavoriteButtonProps) => {
|
}: PageFavoriteButtonProps) => {
|
||||||
const title = isFavorite ? 'Remove from favorites' : 'Add to favorites';
|
const title = isFavorite ? 'Remove from favorites' : 'Add to favorites';
|
||||||
|
const isPageHeaderV2Enabled = useIsFeatureEnabled(
|
||||||
|
'IS_PAGE_HEADER_V2_ENABLED',
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<Button
|
<>
|
||||||
Icon={IconHeart}
|
{isPageHeaderV2Enabled ? (
|
||||||
dataTestId="favorite-button"
|
<Button
|
||||||
size="small"
|
Icon={IconHeart}
|
||||||
variant="secondary"
|
dataTestId="favorite-button"
|
||||||
accent={isFavorite ? 'danger' : 'default'}
|
size="small"
|
||||||
title={title}
|
variant="secondary"
|
||||||
onClick={onClick}
|
accent={isFavorite ? 'danger' : 'default'}
|
||||||
ariaLabel={title}
|
title={title}
|
||||||
/>
|
onClick={onClick}
|
||||||
|
ariaLabel={title}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<IconButton
|
||||||
|
Icon={IconHeart}
|
||||||
|
size="medium"
|
||||||
|
variant="secondary"
|
||||||
|
data-testid="add-button"
|
||||||
|
accent={isFavorite ? 'danger' : 'default'}
|
||||||
|
onClick={onClick}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { PageAddButton } from '@/ui/layout/page/components/PageAddButton';
|
|||||||
import { PageHeader } from '@/ui/layout/page/components/PageHeader';
|
import { PageHeader } from '@/ui/layout/page/components/PageHeader';
|
||||||
import { PageHotkeysEffect } from '@/ui/layout/page/components/PageHotkeysEffect';
|
import { PageHotkeysEffect } from '@/ui/layout/page/components/PageHotkeysEffect';
|
||||||
import { ViewType } from '@/views/types/ViewType';
|
import { ViewType } from '@/views/types/ViewType';
|
||||||
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { useIcons } from 'twenty-ui';
|
import { useIcons } from 'twenty-ui';
|
||||||
@ -44,6 +45,10 @@ export const RecordIndexPageHeader = () => {
|
|||||||
onCreateRecord();
|
onCreateRecord();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isPageHeaderV2Enabled = useIsFeatureEnabled(
|
||||||
|
'IS_PAGE_HEADER_V2_ENABLED',
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageHeader title={pageHeaderTitle} Icon={Icon}>
|
<PageHeader title={pageHeaderTitle} Icon={Icon}>
|
||||||
<PageHotkeysEffect onAddButtonClick={handleAddButtonClick} />
|
<PageHotkeysEffect onAddButtonClick={handleAddButtonClick} />
|
||||||
@ -53,7 +58,7 @@ export const RecordIndexPageHeader = () => {
|
|||||||
) : (
|
) : (
|
||||||
<RecordIndexPageKanbanAddButton />
|
<RecordIndexPageKanbanAddButton />
|
||||||
))}
|
))}
|
||||||
<PageHeaderOpenCommandMenuButton />
|
{isPageHeaderV2Enabled && <PageHeaderOpenCommandMenuButton />}
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,20 +1,38 @@
|
|||||||
import { Button, IconDotsVertical } from 'twenty-ui';
|
import { Button, IconButton, IconDotsVertical } from 'twenty-ui';
|
||||||
|
|
||||||
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||||
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
|
|
||||||
export const PageHeaderOpenCommandMenuButton = () => {
|
export const PageHeaderOpenCommandMenuButton = () => {
|
||||||
const { openCommandMenu } = useCommandMenu();
|
const { openCommandMenu } = useCommandMenu();
|
||||||
|
|
||||||
|
const isPageHeaderV2Enabled = useIsFeatureEnabled(
|
||||||
|
'IS_PAGE_HEADER_V2_ENABLED',
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<>
|
||||||
Icon={IconDotsVertical}
|
{isPageHeaderV2Enabled ? (
|
||||||
dataTestId="page-header-open-command-menu-button"
|
<Button
|
||||||
size="small"
|
Icon={IconDotsVertical}
|
||||||
variant="secondary"
|
dataTestId="page-header-open-command-menu-button"
|
||||||
accent="default"
|
size="small"
|
||||||
shortcut="⌘K"
|
variant="secondary"
|
||||||
ariaLabel="Open command menu"
|
accent="default"
|
||||||
onClick={openCommandMenu}
|
shortcut="⌘K"
|
||||||
/>
|
ariaLabel="Open command menu"
|
||||||
|
onClick={openCommandMenu}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<IconButton
|
||||||
|
Icon={IconDotsVertical}
|
||||||
|
size="medium"
|
||||||
|
dataTestId="more-showpage-button"
|
||||||
|
accent="default"
|
||||||
|
variant="secondary"
|
||||||
|
onClick={openCommandMenu}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,18 +1,38 @@
|
|||||||
import { Button, IconPlus } from 'twenty-ui';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
|
import { Button, IconButton, IconPlus } from 'twenty-ui';
|
||||||
|
|
||||||
type PageAddButtonProps = {
|
type PageAddButtonProps = {
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PageAddButton = ({ onClick }: PageAddButtonProps) => (
|
export const PageAddButton = ({ onClick }: PageAddButtonProps) => {
|
||||||
<Button
|
const isPageHeaderV2Enabled = useIsFeatureEnabled(
|
||||||
Icon={IconPlus}
|
'IS_PAGE_HEADER_V2_ENABLED',
|
||||||
dataTestId="add-button"
|
);
|
||||||
size="small"
|
return (
|
||||||
variant="secondary"
|
<>
|
||||||
accent="default"
|
{isPageHeaderV2Enabled ? (
|
||||||
title="New record"
|
<Button
|
||||||
onClick={onClick}
|
Icon={IconPlus}
|
||||||
ariaLabel="New record"
|
dataTestId="add-button"
|
||||||
/>
|
size="small"
|
||||||
);
|
variant="secondary"
|
||||||
|
accent="default"
|
||||||
|
title="New record"
|
||||||
|
onClick={onClick}
|
||||||
|
ariaLabel="New record"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<IconButton
|
||||||
|
Icon={IconPlus}
|
||||||
|
dataTestId="add-button"
|
||||||
|
size="medium"
|
||||||
|
variant="secondary"
|
||||||
|
accent="default"
|
||||||
|
ariaLabel="Add"
|
||||||
|
onClick={onClick}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { NavigationDrawerCollapseButton } from '@/ui/navigation/navigation-drawe
|
|||||||
|
|
||||||
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
|
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
|
||||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||||
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
|
|
||||||
export const PAGE_BAR_MIN_HEIGHT = 40;
|
export const PAGE_BAR_MIN_HEIGHT = 40;
|
||||||
|
|
||||||
@ -111,6 +112,10 @@ export const PageHeader = ({
|
|||||||
isNavigationDrawerExpandedState,
|
isNavigationDrawerExpandedState,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isPageHeaderV2Enabled = useIsFeatureEnabled(
|
||||||
|
'IS_PAGE_HEADER_V2_ENABLED',
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledTopBarContainer>
|
<StyledTopBarContainer>
|
||||||
<StyledLeftContainer>
|
<StyledLeftContainer>
|
||||||
@ -129,6 +134,24 @@ export const PageHeader = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<StyledTopBarIconStyledTitleContainer>
|
<StyledTopBarIconStyledTitleContainer>
|
||||||
|
{!isPageHeaderV2Enabled && hasPaginationButtons && (
|
||||||
|
<>
|
||||||
|
<IconButton
|
||||||
|
Icon={IconChevronUp}
|
||||||
|
size="small"
|
||||||
|
variant="secondary"
|
||||||
|
disabled={!hasPreviousRecord}
|
||||||
|
onClick={() => navigateToPreviousRecord?.()}
|
||||||
|
/>
|
||||||
|
<IconButton
|
||||||
|
Icon={IconChevronDown}
|
||||||
|
size="small"
|
||||||
|
variant="secondary"
|
||||||
|
disabled={!hasNextRecord}
|
||||||
|
onClick={() => navigateToNextRecord?.()}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{Icon && <Icon size={theme.icon.size.md} />}
|
{Icon && <Icon size={theme.icon.size.md} />}
|
||||||
{title && (
|
{title && (
|
||||||
<StyledTitleContainer data-testid="top-bar-title">
|
<StyledTitleContainer data-testid="top-bar-title">
|
||||||
@ -143,7 +166,7 @@ export const PageHeader = ({
|
|||||||
</StyledLeftContainer>
|
</StyledLeftContainer>
|
||||||
|
|
||||||
<StyledPageActionContainer>
|
<StyledPageActionContainer>
|
||||||
{hasPaginationButtons && (
|
{isPageHeaderV2Enabled && hasPaginationButtons && (
|
||||||
<>
|
<>
|
||||||
<IconButton
|
<IconButton
|
||||||
Icon={IconChevronUp}
|
Icon={IconChevronUp}
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Button, IconCheckbox, IconNotes, IconPlus, MenuItem } from 'twenty-ui';
|
import {
|
||||||
|
Button,
|
||||||
|
IconButton,
|
||||||
|
IconCheckbox,
|
||||||
|
IconNotes,
|
||||||
|
IconPlus,
|
||||||
|
MenuItem,
|
||||||
|
} from 'twenty-ui';
|
||||||
|
|
||||||
import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateActivityDrawer';
|
import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateActivityDrawer';
|
||||||
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
|
||||||
@ -10,6 +17,7 @@ import { SHOW_PAGE_ADD_BUTTON_DROPDOWN_ID } from '@/ui/layout/show-page/constant
|
|||||||
|
|
||||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||||
import { isWorkflowSubObjectMetadata } from '@/object-metadata/utils/isWorkflowSubObjectMetadata';
|
import { isWorkflowSubObjectMetadata } from '@/object-metadata/utils/isWorkflowSubObjectMetadata';
|
||||||
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
import { Dropdown } from '../../dropdown/components/Dropdown';
|
import { Dropdown } from '../../dropdown/components/Dropdown';
|
||||||
import { DropdownMenu } from '../../dropdown/components/DropdownMenu';
|
import { DropdownMenu } from '../../dropdown/components/DropdownMenu';
|
||||||
|
|
||||||
@ -45,6 +53,10 @@ export const ShowPageAddButton = ({
|
|||||||
closeDropdown();
|
closeDropdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isPageHeaderV2Enabled = useIsFeatureEnabled(
|
||||||
|
'IS_PAGE_HEADER_V2_ENABLED',
|
||||||
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
activityTargetObject.targetObjectNameSingular ===
|
activityTargetObject.targetObjectNameSingular ===
|
||||||
CoreObjectNameSingular.Task ||
|
CoreObjectNameSingular.Task ||
|
||||||
@ -60,15 +72,25 @@ export const ShowPageAddButton = ({
|
|||||||
<Dropdown
|
<Dropdown
|
||||||
dropdownId={SHOW_PAGE_ADD_BUTTON_DROPDOWN_ID}
|
dropdownId={SHOW_PAGE_ADD_BUTTON_DROPDOWN_ID}
|
||||||
clickableComponent={
|
clickableComponent={
|
||||||
<Button
|
isPageHeaderV2Enabled ? (
|
||||||
Icon={IconPlus}
|
<Button
|
||||||
dataTestId="add-button"
|
Icon={IconPlus}
|
||||||
size="small"
|
dataTestId="add-button"
|
||||||
variant="secondary"
|
size="small"
|
||||||
accent="default"
|
variant="secondary"
|
||||||
title="New note/task"
|
accent="default"
|
||||||
ariaLabel="New note/task"
|
title="New note/task"
|
||||||
/>
|
ariaLabel="New note/task"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<IconButton
|
||||||
|
Icon={IconPlus}
|
||||||
|
size="medium"
|
||||||
|
dataTestId="add-showpage-button"
|
||||||
|
accent="default"
|
||||||
|
variant="secondary"
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
dropdownComponents={
|
dropdownComponents={
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
|
|||||||
@ -18,4 +18,5 @@ export type FeatureFlagKey =
|
|||||||
| 'IS_ADVANCED_FILTERS_ENABLED'
|
| 'IS_ADVANCED_FILTERS_ENABLED'
|
||||||
| 'IS_AGGREGATE_QUERY_ENABLED'
|
| 'IS_AGGREGATE_QUERY_ENABLED'
|
||||||
| 'IS_FAVORITE_FOLDER_ENABLED'
|
| 'IS_FAVORITE_FOLDER_ENABLED'
|
||||||
| 'IS_VIEW_GROUPS_ENABLED';
|
| 'IS_VIEW_GROUPS_ENABLED'
|
||||||
|
| 'IS_PAGE_HEADER_V2_ENABLED';
|
||||||
|
|||||||
@ -95,6 +95,11 @@ export const seedFeatureFlags = async (
|
|||||||
workspaceId: workspaceId,
|
workspaceId: workspaceId,
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: FeatureFlagKey.IsPageHeaderV2Enabled,
|
||||||
|
workspaceId: workspaceId,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
])
|
])
|
||||||
.execute();
|
.execute();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -18,4 +18,5 @@ export enum FeatureFlagKey {
|
|||||||
IsFavoriteFolderEnabled = 'IS_FAVORITE_FOLDER_ENABLED',
|
IsFavoriteFolderEnabled = 'IS_FAVORITE_FOLDER_ENABLED',
|
||||||
IsFavoriteFolderEntityEnabled = 'IS_FAVORITE_FOLDER_ENTITY_ENABLED',
|
IsFavoriteFolderEntityEnabled = 'IS_FAVORITE_FOLDER_ENTITY_ENABLED',
|
||||||
IsViewGroupsEnabled = 'IS_VIEW_GROUPS_ENABLED',
|
IsViewGroupsEnabled = 'IS_VIEW_GROUPS_ENABLED',
|
||||||
|
IsPageHeaderV2Enabled = 'IS_PAGE_HEADER_V2_ENABLED',
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user