refacto(twenty-front): improve DropdownMenuHeader api (#10961)
This commit is contained in:
@ -28,6 +28,7 @@ import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-sta
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared';
|
||||||
import { IconApps, IconChevronLeft, MenuItem, useIcons } from 'twenty-ui';
|
import { IconApps, IconChevronLeft, MenuItem, useIcons } from 'twenty-ui';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectFilterDropdownFilterSelectCompositeFieldSubMenu = () => {
|
export const ObjectFilterDropdownFilterSelectCompositeFieldSubMenu = () => {
|
||||||
const [searchText] = useState('');
|
const [searchText] = useState('');
|
||||||
@ -187,8 +188,12 @@ export const ObjectFilterDropdownFilterSelectCompositeFieldSubMenu = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={handleSubMenuBack}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={handleSubMenuBack}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{getFilterableFieldTypeLabel(objectFilterDropdownSubMenuFieldType)}
|
{getFilterableFieldTypeLabel(objectFilterDropdownSubMenuFieldType)}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM
|
|||||||
import { ViewFieldsVisibilityDropdownSection } from '@/views/components/ViewFieldsVisibilityDropdownSection';
|
import { ViewFieldsVisibilityDropdownSection } from '@/views/components/ViewFieldsVisibilityDropdownSection';
|
||||||
import { ViewType } from '@/views/types/ViewType';
|
import { ViewType } from '@/views/types/ViewType';
|
||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownFieldsContent = () => {
|
export const ObjectOptionsDropdownFieldsContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -52,8 +53,12 @@ export const ObjectOptionsDropdownFieldsContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={resetContent}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={resetContent}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t`Fields`}
|
{t`Fields`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import { ViewFieldsVisibilityDropdownSection } from '@/views/components/ViewFiel
|
|||||||
import { ViewType } from '@/views/types/ViewType';
|
import { ViewType } from '@/views/types/ViewType';
|
||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownHiddenFieldsContent = () => {
|
export const ObjectOptionsDropdownHiddenFieldsContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -66,8 +67,12 @@ export const ObjectOptionsDropdownHiddenFieldsContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={() => onContentChange('fields')}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={() => onContentChange('fields')}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t`Hidden Fields`}
|
{t`Hidden Fields`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import { useLingui } from '@lingui/react/macro';
|
|||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownHiddenRecordGroupsContent = () => {
|
export const ObjectOptionsDropdownHiddenRecordGroupsContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -74,8 +75,12 @@ export const ObjectOptionsDropdownHiddenRecordGroupsContent = () => {
|
|||||||
<>
|
<>
|
||||||
<DropdownMenuItemsContainer>
|
<DropdownMenuItemsContainer>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={() => onContentChange('recordGroups')}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={() => onContentChange('recordGroups')}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Hidden {recordGroupFieldMetadata?.label}
|
Hidden {recordGroupFieldMetadata?.label}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
|
|||||||
import { ViewType } from '@/views/types/ViewType';
|
import { ViewType } from '@/views/types/ViewType';
|
||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownLayoutContent = () => {
|
export const ObjectOptionsDropdownLayoutContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -42,8 +43,12 @@ export const ObjectOptionsDropdownLayoutContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={resetContent}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={resetContent}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t`Layout`}
|
{t`Layout`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
|
|||||||
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
|
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownLayoutOpenInContent = () => {
|
export const ObjectOptionsDropdownLayoutOpenInContent = () => {
|
||||||
const { onContentChange } = useOptionsDropdown();
|
const { onContentChange } = useOptionsDropdown();
|
||||||
@ -24,8 +25,12 @@ export const ObjectOptionsDropdownLayoutOpenInContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={() => onContentChange('layout')}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={() => onContentChange('layout')}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t`Open in`}
|
{t`Open in`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import { useDeleteViewFromCurrentState } from '@/views/view-picker/hooks/useDele
|
|||||||
import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/states/viewPickerReferenceViewIdComponentState';
|
import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/states/viewPickerReferenceViewIdComponentState';
|
||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownMenuContent = () => {
|
export const ObjectOptionsDropdownMenuContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -82,7 +83,11 @@ export const ObjectOptionsDropdownMenuContent = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader StartIcon={CurrentViewIcon ?? IconList}>
|
<DropdownMenuHeader
|
||||||
|
StartComponent={
|
||||||
|
<DropdownMenuHeaderLeftComponent Icon={CurrentViewIcon ?? IconList} />
|
||||||
|
}
|
||||||
|
>
|
||||||
{currentView?.name}
|
{currentView?.name}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import { useSetRecoilState } from 'recoil';
|
|||||||
import { isDefined } from 'twenty-shared';
|
import { isDefined } from 'twenty-shared';
|
||||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownRecordGroupFieldsContent = () => {
|
export const ObjectOptionsDropdownRecordGroupFieldsContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -106,11 +107,15 @@ export const ObjectOptionsDropdownRecordGroupFieldsContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={() =>
|
<DropdownMenuHeaderLeftComponent
|
||||||
isDefined(recordGroupFieldMetadata)
|
onClick={() =>
|
||||||
? onContentChange('recordGroups')
|
isDefined(recordGroupFieldMetadata)
|
||||||
: resetContent()
|
? onContentChange('recordGroups')
|
||||||
|
: resetContent()
|
||||||
|
}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
Group by
|
Group by
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenu
|
|||||||
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
|
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
|
||||||
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownRecordGroupSortContent = () => {
|
export const ObjectOptionsDropdownRecordGroupSortContent = () => {
|
||||||
const { currentContentId, onContentChange } = useOptionsDropdown();
|
const { currentContentId, onContentChange } = useOptionsDropdown();
|
||||||
@ -43,8 +44,12 @@ export const ObjectOptionsDropdownRecordGroupSortContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={() => onContentChange('recordGroups')}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={() => onContentChange('recordGroups')}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Sort
|
Sort
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/component-
|
|||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
|
import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
|
||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownRecordGroupsContent = () => {
|
export const ObjectOptionsDropdownRecordGroupsContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -89,8 +90,12 @@ export const ObjectOptionsDropdownRecordGroupsContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={resetContent}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={resetContent}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Group by
|
Group by
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-sta
|
|||||||
import { Trans, useLingui } from '@lingui/react/macro';
|
import { Trans, useLingui } from '@lingui/react/macro';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
|
import { useTheme } from '@emotion/react';
|
||||||
|
|
||||||
export const StyledInput = styled.input`
|
export const StyledInput = styled.input`
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@ -187,6 +188,8 @@ export const ObjectSortDropdownButton = ({
|
|||||||
|
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
|
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
dropdownId={OBJECT_SORT_DROPDOWN_ID}
|
dropdownId={OBJECT_SORT_DROPDOWN_ID}
|
||||||
@ -218,12 +221,12 @@ export const ObjectSortDropdownButton = ({
|
|||||||
</StyledSelectedSortDirectionContainer>
|
</StyledSelectedSortDirectionContainer>
|
||||||
)}
|
)}
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
EndIcon={IconChevronDown}
|
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setIsRecordSortDirectionMenuUnfolded(
|
setIsRecordSortDirectionMenuUnfolded(
|
||||||
!isRecordSortDirectionMenuUnfolded,
|
!isRecordSortDirectionMenuUnfolded,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
EndComponent={<IconChevronDown size={theme.icon.size.md} />}
|
||||||
>
|
>
|
||||||
{selectedRecordSortDirection === 'asc'
|
{selectedRecordSortDirection === 'asc'
|
||||||
? t`Ascending`
|
? t`Ascending`
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import {
|
|||||||
MenuItem,
|
MenuItem,
|
||||||
useIcons,
|
useIcons,
|
||||||
} from 'twenty-ui';
|
} from 'twenty-ui';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const RecordBoardColumnHeaderAggregateDropdownFieldsContent = () => {
|
export const RecordBoardColumnHeaderAggregateDropdownFieldsContent = () => {
|
||||||
const {
|
const {
|
||||||
@ -49,11 +50,15 @@ export const RecordBoardColumnHeaderAggregateDropdownFieldsContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={() =>
|
<DropdownMenuHeaderLeftComponent
|
||||||
previousContentId
|
onClick={() =>
|
||||||
? onContentChange(previousContentId)
|
previousContentId
|
||||||
: resetContent()
|
? onContentChange(previousContentId)
|
||||||
|
: resetContent()
|
||||||
|
}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{getAggregateOperationLabel(aggregateOperation)}
|
{getAggregateOperationLabel(aggregateOperation)}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import isEmpty from 'lodash.isempty';
|
|||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
import { IconCheck, IconChevronLeft } from 'twenty-ui';
|
import { IconCheck, IconChevronLeft } from 'twenty-ui';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const RecordBoardColumnHeaderAggregateDropdownOptionsContent = ({
|
export const RecordBoardColumnHeaderAggregateDropdownOptionsContent = ({
|
||||||
availableAggregations,
|
availableAggregations,
|
||||||
@ -59,8 +60,12 @@ export const RecordBoardColumnHeaderAggregateDropdownOptionsContent = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={resetContent}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={resetContent}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
|||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
import { IconChevronLeft } from 'twenty-ui';
|
import { IconChevronLeft } from 'twenty-ui';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const RecordTableColumnAggregateFooterDropdownSubmenuContent = ({
|
export const RecordTableColumnAggregateFooterDropdownSubmenuContent = ({
|
||||||
aggregateOperations,
|
aggregateOperations,
|
||||||
@ -33,8 +34,12 @@ export const RecordTableColumnAggregateFooterDropdownSubmenuContent = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={resetContent}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={resetContent}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -1,13 +1,6 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { ComponentProps, MouseEvent, ReactElement } from 'react';
|
import { ComponentProps, MouseEvent } from 'react';
|
||||||
import { Avatar, AvatarProps, IconComponent } from 'twenty-ui';
|
import { IconComponent } from 'twenty-ui';
|
||||||
import { DropdownMenuHeaderStartIcon } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderStartIcon';
|
|
||||||
import { isDefined } from 'twenty-shared';
|
|
||||||
import { useTheme } from '@emotion/react';
|
|
||||||
import {
|
|
||||||
Dropdown,
|
|
||||||
DropdownProps,
|
|
||||||
} from '@/ui/layout/dropdown/components/Dropdown';
|
|
||||||
|
|
||||||
const StyledHeader = styled.li`
|
const StyledHeader = styled.li`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -37,7 +30,7 @@ const StyledChildrenWrapper = styled.span`
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledEndIcon = styled.div`
|
const StyledEndComponent = styled.div`
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
color: ${({ theme }) => theme.font.color.tertiary};
|
color: ${({ theme }) => theme.font.color.tertiary};
|
||||||
padding: ${({ theme }) => theme.spacing(1)};
|
padding: ${({ theme }) => theme.spacing(1)};
|
||||||
@ -53,50 +46,24 @@ const StyledEndIcon = styled.div`
|
|||||||
type DropdownMenuHeaderProps = ComponentProps<'li'> & {
|
type DropdownMenuHeaderProps = ComponentProps<'li'> & {
|
||||||
EndIcon?: IconComponent;
|
EndIcon?: IconComponent;
|
||||||
onClick?: (event: MouseEvent<HTMLLIElement>) => void;
|
onClick?: (event: MouseEvent<HTMLLIElement>) => void;
|
||||||
onStartIconClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
||||||
testId?: string;
|
testId?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
DropdownOnEndIcon?: ReactElement<DropdownProps, typeof Dropdown>;
|
StartComponent?: React.ReactNode;
|
||||||
} & (
|
EndComponent?: React.ReactNode;
|
||||||
| { StartIcon?: IconComponent }
|
};
|
||||||
| { StartAvatar?: ReactElement<AvatarProps, typeof Avatar> }
|
|
||||||
);
|
|
||||||
export const DropdownMenuHeader = ({
|
export const DropdownMenuHeader = ({
|
||||||
children,
|
children,
|
||||||
EndIcon,
|
StartComponent,
|
||||||
onStartIconClick,
|
|
||||||
onClick,
|
onClick,
|
||||||
testId,
|
testId,
|
||||||
className,
|
className,
|
||||||
...props
|
EndComponent,
|
||||||
}: DropdownMenuHeaderProps) => {
|
}: DropdownMenuHeaderProps) => {
|
||||||
const theme = useTheme();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledHeader data-testid={testId} className={className} onClick={onClick}>
|
<StyledHeader data-testid={testId} className={className} onClick={onClick}>
|
||||||
{'StartIcon' in props && isDefined(props.StartIcon) && (
|
{StartComponent && StartComponent}
|
||||||
<DropdownMenuHeaderStartIcon
|
|
||||||
onClick={onStartIconClick}
|
|
||||||
StartIcon={props.StartIcon}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{!('StartIcon' in props) &&
|
|
||||||
'StartAvatar' in props &&
|
|
||||||
isDefined(props.StartAvatar) && (
|
|
||||||
<DropdownMenuHeaderStartIcon
|
|
||||||
onClick={onStartIconClick}
|
|
||||||
StartAvatar={props.StartAvatar}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<StyledChildrenWrapper>{children}</StyledChildrenWrapper>
|
<StyledChildrenWrapper>{children}</StyledChildrenWrapper>
|
||||||
{'DropdownOnEndIcon' in props && (
|
{EndComponent && <StyledEndComponent>{EndComponent}</StyledEndComponent>}
|
||||||
<StyledEndIcon>{props.DropdownOnEndIcon}</StyledEndIcon>
|
|
||||||
)}
|
|
||||||
{!('DropdownOnEndIcon' in props) && EndIcon && (
|
|
||||||
<StyledEndIcon>
|
|
||||||
<EndIcon size={theme.icon.size.md} />
|
|
||||||
</StyledEndIcon>
|
|
||||||
)}
|
|
||||||
</StyledHeader>
|
</StyledHeader>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -25,13 +25,13 @@ const StyledAvatarWrapper = styled.div`
|
|||||||
padding: ${({ theme }) => theme.spacing(1)};
|
padding: ${({ theme }) => theme.spacing(1)};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const DropdownMenuHeaderStartIcon = ({
|
export const DropdownMenuHeaderLeftComponent = ({
|
||||||
onClick,
|
onClick,
|
||||||
...props
|
...props
|
||||||
}: { onClick?: (event: MouseEvent<HTMLButtonElement>) => void } & (
|
}: { onClick?: (event: MouseEvent<HTMLButtonElement>) => void } & (
|
||||||
| { StartIcon: IconComponent }
|
| { Icon: IconComponent }
|
||||||
| {
|
| {
|
||||||
StartAvatar: ReactElement<AvatarProps, typeof Avatar>;
|
Avatar: ReactElement<AvatarProps, typeof Avatar>;
|
||||||
}
|
}
|
||||||
| Record<never, never>
|
| Record<never, never>
|
||||||
)) => {
|
)) => {
|
||||||
@ -39,25 +39,25 @@ export const DropdownMenuHeaderStartIcon = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{'StartIcon' in props &&
|
{'Icon' in props &&
|
||||||
(onClick ? (
|
(onClick ? (
|
||||||
<LightIconButton
|
<LightIconButton
|
||||||
Icon={props.StartIcon}
|
Icon={props.Icon}
|
||||||
accent="tertiary"
|
accent="tertiary"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<StyledNonClickableStartIcon>
|
<StyledNonClickableStartIcon>
|
||||||
<props.StartIcon
|
<props.Icon
|
||||||
size={theme.icon.size.sm}
|
size={theme.icon.size.sm}
|
||||||
color={theme.font.color.tertiary}
|
color={theme.font.color.tertiary}
|
||||||
/>
|
/>
|
||||||
</StyledNonClickableStartIcon>
|
</StyledNonClickableStartIcon>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{'StartAvatar' in props && (
|
{'Avatar' in props && (
|
||||||
<StyledAvatarWrapper>{props.StartAvatar}</StyledAvatarWrapper>
|
<StyledAvatarWrapper>{props.Avatar}</StyledAvatarWrapper>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -1,34 +0,0 @@
|
|||||||
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
|
||||||
import { IconComponent, IconDotsVertical, LightIconButton } from 'twenty-ui';
|
|
||||||
import { SelectHotkeyScope } from '@/ui/input/types/SelectHotkeyScope';
|
|
||||||
import { Placement } from '@floating-ui/react';
|
|
||||||
import { ReactNode } from 'react';
|
|
||||||
|
|
||||||
export type DropdownMenuHeaderWithDropdownMenuProps = {
|
|
||||||
EndIcon?: IconComponent;
|
|
||||||
dropdownPlacement?: Placement;
|
|
||||||
dropdownComponents: ReactNode;
|
|
||||||
dropdownId: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DropdownMenuHeaderWithDropdownMenu = (
|
|
||||||
props: DropdownMenuHeaderWithDropdownMenuProps,
|
|
||||||
) => {
|
|
||||||
return (
|
|
||||||
<div className="hoverable-buttons">
|
|
||||||
<Dropdown
|
|
||||||
clickableComponent={
|
|
||||||
<LightIconButton
|
|
||||||
Icon={props.EndIcon ?? IconDotsVertical}
|
|
||||||
size="small"
|
|
||||||
accent="tertiary"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
dropdownPlacement={props.dropdownPlacement ?? 'bottom-end'}
|
|
||||||
dropdownComponents={props.dropdownComponents}
|
|
||||||
dropdownId={props.dropdownId}
|
|
||||||
dropdownHotkeyScope={{ scope: SelectHotkeyScope.Select }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@ -22,6 +22,7 @@ import { DropdownMenuItemsContainer } from '../DropdownMenuItemsContainer';
|
|||||||
import { DropdownMenuSearchInput } from '../DropdownMenuSearchInput';
|
import { DropdownMenuSearchInput } from '../DropdownMenuSearchInput';
|
||||||
import { DropdownMenuSeparator } from '../DropdownMenuSeparator';
|
import { DropdownMenuSeparator } from '../DropdownMenuSeparator';
|
||||||
import { StyledDropdownMenuSubheader } from '../StyledDropdownMenuSubheader';
|
import { StyledDropdownMenuSubheader } from '../StyledDropdownMenuSubheader';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
const meta: Meta<typeof Dropdown> = {
|
const meta: Meta<typeof Dropdown> = {
|
||||||
title: 'UI/Layout/Dropdown/Dropdown',
|
title: 'UI/Layout/Dropdown/Dropdown',
|
||||||
@ -219,7 +220,11 @@ export const WithHeaders: Story = {
|
|||||||
args: {
|
args: {
|
||||||
dropdownComponents: (
|
dropdownComponents: (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader StartIcon={IconChevronLeft}>
|
<DropdownMenuHeader
|
||||||
|
StartComponent={
|
||||||
|
<DropdownMenuHeaderLeftComponent Icon={IconChevronLeft} />
|
||||||
|
}
|
||||||
|
>
|
||||||
Header
|
Header
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
<StyledDropdownMenuSubheader>Subheader 1</StyledDropdownMenuSubheader>
|
<StyledDropdownMenuSubheader>Subheader 1</StyledDropdownMenuSubheader>
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenu
|
|||||||
import { SelectHotkeyScope } from '@/ui/input/types/SelectHotkeyScope';
|
import { SelectHotkeyScope } from '@/ui/input/types/SelectHotkeyScope';
|
||||||
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
|
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
|
||||||
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
const meta: Meta<typeof DropdownMenuHeader> = {
|
const meta: Meta<typeof DropdownMenuHeader> = {
|
||||||
title: 'UI/Layout/Dropdown/DropdownMenuHeader',
|
title: 'UI/Layout/Dropdown/DropdownMenuHeader',
|
||||||
@ -31,21 +32,14 @@ export const Text: Story = {
|
|||||||
};
|
};
|
||||||
export const StartIcon: Story = {
|
export const StartIcon: Story = {
|
||||||
args: {
|
args: {
|
||||||
StartIcon: IconChevronLeft,
|
StartComponent: <DropdownMenuHeaderLeftComponent Icon={IconChevronLeft} />,
|
||||||
children: 'Start Icon',
|
children: 'Start Icon',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const EndIcon: Story = {
|
|
||||||
args: {
|
|
||||||
EndIcon: IconChevronRight,
|
|
||||||
children: 'End Icon',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const StartAndEndIcon: Story = {
|
export const StartAndEndIcon: Story = {
|
||||||
args: {
|
args: {
|
||||||
StartIcon: IconChevronLeft,
|
StartComponent: <DropdownMenuHeaderLeftComponent Icon={IconChevronLeft} />,
|
||||||
EndIcon: IconChevronRight,
|
EndIcon: IconChevronRight,
|
||||||
children: 'Start and End Icon',
|
children: 'Start and End Icon',
|
||||||
},
|
},
|
||||||
@ -53,7 +47,7 @@ export const StartAndEndIcon: Story = {
|
|||||||
|
|
||||||
export const StartAvatar: Story = {
|
export const StartAvatar: Story = {
|
||||||
args: {
|
args: {
|
||||||
StartAvatar: (
|
StartComponent: (
|
||||||
<Avatar placeholder="placeholder" avatarUrl={AVATAR_URL_MOCK} />
|
<Avatar placeholder="placeholder" avatarUrl={AVATAR_URL_MOCK} />
|
||||||
),
|
),
|
||||||
children: 'Avatar',
|
children: 'Avatar',
|
||||||
@ -63,10 +57,10 @@ export const StartAvatar: Story = {
|
|||||||
export const ContextDropdownAndAvatar: Story = {
|
export const ContextDropdownAndAvatar: Story = {
|
||||||
args: {
|
args: {
|
||||||
children: 'Context Dropdown',
|
children: 'Context Dropdown',
|
||||||
StartAvatar: (
|
StartComponent: (
|
||||||
<Avatar placeholder="placeholder" avatarUrl={AVATAR_URL_MOCK} />
|
<Avatar placeholder="placeholder" avatarUrl={AVATAR_URL_MOCK} />
|
||||||
),
|
),
|
||||||
DropdownOnEndIcon: (
|
EndComponent: (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
dropdownId={'story-dropdown-id-context-menu'}
|
dropdownId={'story-dropdown-id-context-menu'}
|
||||||
dropdownHotkeyScope={{ scope: SelectHotkeyScope.Select }}
|
dropdownHotkeyScope={{ scope: SelectHotkeyScope.Select }}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export const MultiWorkspaceDropdownButton = () => {
|
|||||||
dropdownHotkeyScope={{
|
dropdownHotkeyScope={{
|
||||||
scope: NavigationDrawerHotKeyScope.MultiWorkspaceDropdownButton,
|
scope: NavigationDrawerHotKeyScope.MultiWorkspaceDropdownButton,
|
||||||
}}
|
}}
|
||||||
dropdownOffset={{ y: 0, x: 0 }}
|
dropdownOffset={{ y: -35, x: -5 }}
|
||||||
clickableComponent={
|
clickableComponent={
|
||||||
<MultiWorkspaceDropdownClickableComponent
|
<MultiWorkspaceDropdownClickableComponent
|
||||||
isDropdownOpen={isDropdownOpen}
|
isDropdownOpen={isDropdownOpen}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNaviga
|
|||||||
export const MultiWorkspaceDropdownClickableComponent = ({
|
export const MultiWorkspaceDropdownClickableComponent = ({
|
||||||
isDropdownOpen,
|
isDropdownOpen,
|
||||||
}: {
|
}: {
|
||||||
isDropdownOpen: boolean;
|
isDropdownOpen?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|||||||
@ -36,6 +36,7 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
|||||||
import { SelectHotkeyScope } from '@/ui/input/types/SelectHotkeyScope';
|
import { SelectHotkeyScope } from '@/ui/input/types/SelectHotkeyScope';
|
||||||
import { useColorScheme } from '@/ui/theme/hooks/useColorScheme';
|
import { useColorScheme } from '@/ui/theme/hooks/useColorScheme';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
const StyledDescription = styled.div`
|
const StyledDescription = styled.div`
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
@ -91,13 +92,17 @@ export const MultiWorkspaceDropdownDefaultComponents = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartAvatar={
|
StartComponent={
|
||||||
<Avatar
|
<DropdownMenuHeaderLeftComponent
|
||||||
placeholder={currentWorkspace?.displayName || ''}
|
Avatar={
|
||||||
avatarUrl={currentWorkspace?.logo ?? DEFAULT_WORKSPACE_LOGO}
|
<Avatar
|
||||||
|
placeholder={currentWorkspace?.displayName || ''}
|
||||||
|
avatarUrl={currentWorkspace?.logo ?? DEFAULT_WORKSPACE_LOGO}
|
||||||
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
DropdownOnEndIcon={
|
EndComponent={
|
||||||
<Dropdown
|
<Dropdown
|
||||||
clickableComponent={
|
clickableComponent={
|
||||||
<LightIconButton
|
<LightIconButton
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { multiWorkspaceDropdownState } from '@/ui/navigation/navigation-drawer/s
|
|||||||
import { useSetRecoilState } from 'recoil';
|
import { useSetRecoilState } from 'recoil';
|
||||||
import { useColorScheme } from '@/ui/theme/hooks/useColorScheme';
|
import { useColorScheme } from '@/ui/theme/hooks/useColorScheme';
|
||||||
import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader';
|
import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const MultiWorkspaceDropdownThemesComponents = () => {
|
export const MultiWorkspaceDropdownThemesComponents = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -18,8 +19,12 @@ export const MultiWorkspaceDropdownThemesComponents = () => {
|
|||||||
return (
|
return (
|
||||||
<DropdownMenuItemsContainer>
|
<DropdownMenuItemsContainer>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={() => setMultiWorkspaceDropdownState('default')}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={() => setMultiWorkspaceDropdownState('default')}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t`Theme`}
|
{t`Theme`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import { multiWorkspaceDropdownState } from '@/ui/navigation/navigation-drawer/s
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput';
|
import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput';
|
||||||
import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader';
|
import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const MultiWorkspaceDropdownWorkspacesListComponents = () => {
|
export const MultiWorkspaceDropdownWorkspacesListComponents = () => {
|
||||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||||
@ -37,8 +38,12 @@ export const MultiWorkspaceDropdownWorkspacesListComponents = () => {
|
|||||||
return (
|
return (
|
||||||
<DropdownMenuItemsContainer>
|
<DropdownMenuItemsContainer>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={() => setMultiWorkspaceDropdownState('default')}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={() => setMultiWorkspaceDropdownState('default')}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t`Other workspaces`}
|
{t`Other workspaces`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import { viewPickerSelectedIconComponentState } from '@/views/view-picker/states
|
|||||||
import { viewPickerTypeComponentState } from '@/views/view-picker/states/viewPickerTypeComponentState';
|
import { viewPickerTypeComponentState } from '@/views/view-picker/states/viewPickerTypeComponentState';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { useLingui } from '@lingui/react/macro';
|
import { useLingui } from '@lingui/react/macro';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
const StyledNoKanbanFieldAvailableContainer = styled.div`
|
const StyledNoKanbanFieldAvailableContainer = styled.div`
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
@ -130,7 +131,11 @@ export const ViewPickerContentCreateMode = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader StartIcon={IconX} onStartIconClick={handleClose}>
|
<DropdownMenuHeader
|
||||||
|
StartComponent={
|
||||||
|
<DropdownMenuHeaderLeftComponent onClick={handleClose} Icon={IconX} />
|
||||||
|
}
|
||||||
|
>
|
||||||
{t`Create view`}
|
{t`Create view`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import { viewPickerInputNameComponentState } from '@/views/view-picker/states/vi
|
|||||||
import { viewPickerIsDirtyComponentState } from '@/views/view-picker/states/viewPickerIsDirtyComponentState';
|
import { viewPickerIsDirtyComponentState } from '@/views/view-picker/states/viewPickerIsDirtyComponentState';
|
||||||
import { viewPickerIsPersistingComponentState } from '@/views/view-picker/states/viewPickerIsPersistingComponentState';
|
import { viewPickerIsPersistingComponentState } from '@/views/view-picker/states/viewPickerIsPersistingComponentState';
|
||||||
import { viewPickerSelectedIconComponentState } from '@/views/view-picker/states/viewPickerSelectedIconComponentState';
|
import { viewPickerSelectedIconComponentState } from '@/views/view-picker/states/viewPickerSelectedIconComponentState';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
export const ViewPickerContentEditMode = () => {
|
export const ViewPickerContentEditMode = () => {
|
||||||
const { setViewPickerMode } = useViewPickerMode();
|
const { setViewPickerMode } = useViewPickerMode();
|
||||||
@ -68,8 +69,12 @@ export const ViewPickerContentEditMode = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={handleClose}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={handleClose}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Edit view
|
Edit view
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import {
|
|||||||
OverflowingTextWithTooltip,
|
OverflowingTextWithTooltip,
|
||||||
useIcons,
|
useIcons,
|
||||||
} from 'twenty-ui';
|
} from 'twenty-ui';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
type WorkflowVariablesDropdownFieldItemsProps = {
|
type WorkflowVariablesDropdownFieldItemsProps = {
|
||||||
step: StepOutputSchema;
|
step: StepOutputSchema;
|
||||||
@ -116,8 +117,12 @@ export const WorkflowVariablesDropdownFieldItems = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartComponent={
|
||||||
onStartIconClick={goBack}
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={goBack}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
style={{ position: 'fixed' }}
|
style={{ position: 'fixed' }}
|
||||||
>
|
>
|
||||||
<OverflowingTextWithTooltip
|
<OverflowingTextWithTooltip
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import {
|
|||||||
OverflowingTextWithTooltip,
|
OverflowingTextWithTooltip,
|
||||||
useIcons,
|
useIcons,
|
||||||
} from 'twenty-ui';
|
} from 'twenty-ui';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
type WorkflowVariablesDropdownObjectItemsProps = {
|
type WorkflowVariablesDropdownObjectItemsProps = {
|
||||||
step: StepOutputSchema;
|
step: StepOutputSchema;
|
||||||
@ -98,7 +99,14 @@ export const WorkflowVariablesDropdownObjectItems = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader StartIcon={IconChevronLeft} onStartIconClick={goBack}>
|
<DropdownMenuHeader
|
||||||
|
StartComponent={
|
||||||
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={goBack}
|
||||||
|
Icon={IconChevronLeft}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
<OverflowingTextWithTooltip
|
<OverflowingTextWithTooltip
|
||||||
text={getStepHeaderLabel(step, currentPath)}
|
text={getStepHeaderLabel(step, currentPath)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import {
|
|||||||
OverflowingTextWithTooltip,
|
OverflowingTextWithTooltip,
|
||||||
useIcons,
|
useIcons,
|
||||||
} from 'twenty-ui';
|
} from 'twenty-ui';
|
||||||
|
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
|
||||||
|
|
||||||
type WorkflowVariablesDropdownWorkflowStepItemsProps = {
|
type WorkflowVariablesDropdownWorkflowStepItemsProps = {
|
||||||
dropdownId: string;
|
dropdownId: string;
|
||||||
@ -37,7 +38,14 @@ export const WorkflowVariablesDropdownWorkflowStepItems = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader StartIcon={IconX} onStartIconClick={closeDropdown}>
|
<DropdownMenuHeader
|
||||||
|
StartComponent={
|
||||||
|
<DropdownMenuHeaderLeftComponent
|
||||||
|
onClick={closeDropdown}
|
||||||
|
Icon={IconX}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
<OverflowingTextWithTooltip text={'Select Step'} />
|
<OverflowingTextWithTooltip text={'Select Step'} />
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
<DropdownMenuSearchInput
|
<DropdownMenuSearchInput
|
||||||
|
|||||||
Reference in New Issue
Block a user