renaming layout and changing icons (#10781)
Updating icons and renaming View Settings to Layout Fixes : https://github.com/twentyhq/core-team-issues/issues/486 Fixes : https://github.com/twentyhq/core-team-issues/issues/484 Fixes : https://github.com/twentyhq/core-team-issues/issues/488
This commit is contained in:
@ -1,22 +1,22 @@
|
|||||||
import { ObjectOptionsDropdownFieldsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownFieldsContent';
|
import { ObjectOptionsDropdownFieldsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownFieldsContent';
|
||||||
import { ObjectOptionsDropdownHiddenFieldsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenFieldsContent';
|
import { ObjectOptionsDropdownHiddenFieldsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenFieldsContent';
|
||||||
import { ObjectOptionsDropdownHiddenRecordGroupsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenRecordGroupsContent';
|
import { ObjectOptionsDropdownHiddenRecordGroupsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenRecordGroupsContent';
|
||||||
|
import { ObjectOptionsDropdownLayoutContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent';
|
||||||
|
import { ObjectOptionsDropdownLayoutOpenInContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutOpenInContent';
|
||||||
import { ObjectOptionsDropdownMenuContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent';
|
import { ObjectOptionsDropdownMenuContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent';
|
||||||
import { ObjectOptionsDropdownRecordGroupFieldsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupFieldsContent';
|
import { ObjectOptionsDropdownRecordGroupFieldsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupFieldsContent';
|
||||||
import { ObjectOptionsDropdownRecordGroupsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent';
|
import { ObjectOptionsDropdownRecordGroupsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent';
|
||||||
import { ObjectOptionsDropdownRecordGroupSortContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent';
|
import { ObjectOptionsDropdownRecordGroupSortContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent';
|
||||||
import { ObjectOptionsDropdownViewSettingsContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownViewSettingsContent';
|
|
||||||
import { ObjectOptionsDropdownViewSettingsOpenInContent } from '@/object-record/object-options-dropdown/components/ObjectOptionsDropdownViewSettingsOpenInContent';
|
|
||||||
import { useOptionsDropdown } from '@/object-record/object-options-dropdown/hooks/useOptionsDropdown';
|
import { useOptionsDropdown } from '@/object-record/object-options-dropdown/hooks/useOptionsDropdown';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownContent = () => {
|
export const ObjectOptionsDropdownContent = () => {
|
||||||
const { currentContentId } = useOptionsDropdown();
|
const { currentContentId } = useOptionsDropdown();
|
||||||
|
|
||||||
switch (currentContentId) {
|
switch (currentContentId) {
|
||||||
case 'viewSettings':
|
case 'layout':
|
||||||
return <ObjectOptionsDropdownViewSettingsContent />;
|
return <ObjectOptionsDropdownLayoutContent />;
|
||||||
case 'viewSettingsOpenIn':
|
case 'layoutOpenIn':
|
||||||
return <ObjectOptionsDropdownViewSettingsOpenInContent />;
|
return <ObjectOptionsDropdownLayoutOpenInContent />;
|
||||||
case 'fields':
|
case 'fields':
|
||||||
return <ObjectOptionsDropdownFieldsContent />;
|
return <ObjectOptionsDropdownFieldsContent />;
|
||||||
case 'hiddenFields':
|
case 'hiddenFields':
|
||||||
|
|||||||
@ -18,7 +18,7 @@ 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';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownViewSettingsContent = () => {
|
export const ObjectOptionsDropdownLayoutContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
const { currentView } = useGetCurrentViewOnly();
|
const { currentView } = useGetCurrentViewOnly();
|
||||||
|
|
||||||
@ -42,11 +42,11 @@ export const ObjectOptionsDropdownViewSettingsContent = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader StartIcon={IconChevronLeft} onClick={resetContent}>
|
<DropdownMenuHeader StartIcon={IconChevronLeft} onClick={resetContent}>
|
||||||
{t`View settings`}
|
{t`Layout`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
<DropdownMenuItemsContainer>
|
<DropdownMenuItemsContainer>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={() => onContentChange('viewSettingsOpenIn')}
|
onClick={() => onContentChange('layoutOpenIn')}
|
||||||
LeftIcon={
|
LeftIcon={
|
||||||
recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL
|
recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL
|
||||||
? IconLayoutSidebarRight
|
? IconLayoutSidebarRight
|
||||||
@ -60,6 +60,7 @@ export const ObjectOptionsDropdownViewSettingsContent = () => {
|
|||||||
}
|
}
|
||||||
hasSubMenu
|
hasSubMenu
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{viewType === ViewType.Kanban && (
|
{viewType === ViewType.Kanban && (
|
||||||
<MenuItemToggle
|
<MenuItemToggle
|
||||||
LeftIcon={IconBaselineDensitySmall}
|
LeftIcon={IconBaselineDensitySmall}
|
||||||
@ -15,7 +15,7 @@ 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';
|
||||||
|
|
||||||
export const ObjectOptionsDropdownViewSettingsOpenInContent = () => {
|
export const ObjectOptionsDropdownLayoutOpenInContent = () => {
|
||||||
const { onContentChange } = useOptionsDropdown();
|
const { onContentChange } = useOptionsDropdown();
|
||||||
const recordIndexOpenRecordIn = useRecoilValue(recordIndexOpenRecordInState);
|
const recordIndexOpenRecordIn = useRecoilValue(recordIndexOpenRecordInState);
|
||||||
const { currentView } = useGetCurrentViewOnly();
|
const { currentView } = useGetCurrentViewOnly();
|
||||||
@ -25,7 +25,7 @@ export const ObjectOptionsDropdownViewSettingsOpenInContent = () => {
|
|||||||
<>
|
<>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
StartIcon={IconChevronLeft}
|
StartIcon={IconChevronLeft}
|
||||||
onClick={() => onContentChange('viewSettings')}
|
onClick={() => onContentChange('layout')}
|
||||||
>
|
>
|
||||||
{t`Open in`}
|
{t`Open in`}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
@ -1,11 +1,13 @@
|
|||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
|
import { capitalize, isDefined } from 'twenty-shared';
|
||||||
import {
|
import {
|
||||||
AppTooltip,
|
AppTooltip,
|
||||||
IconCopy,
|
IconCopy,
|
||||||
IconLayout,
|
IconLayoutKanban,
|
||||||
IconLayoutList,
|
IconLayoutList,
|
||||||
IconList,
|
IconList,
|
||||||
IconTag,
|
IconListDetails,
|
||||||
|
IconTable,
|
||||||
IconTrash,
|
IconTrash,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
useIcons,
|
useIcons,
|
||||||
@ -24,11 +26,11 @@ import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
|||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||||
import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
|
import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
|
||||||
|
import { ViewType } from '@/views/types/ViewType';
|
||||||
import { useDeleteViewFromCurrentState } from '@/views/view-picker/hooks/useDeleteViewFromCurrentState';
|
import { useDeleteViewFromCurrentState } from '@/views/view-picker/hooks/useDeleteViewFromCurrentState';
|
||||||
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 { isDefined } from 'twenty-shared';
|
|
||||||
|
|
||||||
export const ObjectOptionsDropdownMenuContent = () => {
|
export const ObjectOptionsDropdownMenuContent = () => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
@ -74,6 +76,7 @@ export const ObjectOptionsDropdownMenuContent = () => {
|
|||||||
deleteViewFromCurrentState();
|
deleteViewFromCurrentState();
|
||||||
closeDropdown();
|
closeDropdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { enqueueSnackBar } = useSnackBar();
|
const { enqueueSnackBar } = useSnackBar();
|
||||||
|
|
||||||
@ -85,9 +88,12 @@ export const ObjectOptionsDropdownMenuContent = () => {
|
|||||||
|
|
||||||
<DropdownMenuItemsContainer scrollable={false}>
|
<DropdownMenuItemsContainer scrollable={false}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={() => onContentChange('viewSettings')}
|
onClick={() => onContentChange('layout')}
|
||||||
LeftIcon={IconLayout}
|
LeftIcon={
|
||||||
text={t`View settings`}
|
currentView?.type === ViewType.Table ? IconTable : IconLayoutKanban
|
||||||
|
}
|
||||||
|
text={t`Layout`}
|
||||||
|
contextualText={`${capitalize(currentView?.type ?? '')}`}
|
||||||
hasSubMenu
|
hasSubMenu
|
||||||
/>
|
/>
|
||||||
</DropdownMenuItemsContainer>
|
</DropdownMenuItemsContainer>
|
||||||
@ -96,7 +102,7 @@ export const ObjectOptionsDropdownMenuContent = () => {
|
|||||||
<DropdownMenuItemsContainer scrollable={false}>
|
<DropdownMenuItemsContainer scrollable={false}>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={() => onContentChange('fields')}
|
onClick={() => onContentChange('fields')}
|
||||||
LeftIcon={IconTag}
|
LeftIcon={IconListDetails}
|
||||||
text={t`Fields`}
|
text={t`Fields`}
|
||||||
contextualText={`${visibleBoardFields.length} shown`}
|
contextualText={`${visibleBoardFields.length} shown`}
|
||||||
hasSubMenu
|
hasSubMenu
|
||||||
|
|||||||
@ -123,7 +123,7 @@ const createStory = (contentId: ObjectOptionsContentId | null): Story => ({
|
|||||||
|
|
||||||
export const Default = createStory(null);
|
export const Default = createStory(null);
|
||||||
|
|
||||||
export const ViewSettings = createStory('viewSettings');
|
export const Layout = createStory('layout');
|
||||||
|
|
||||||
export const Fields = createStory('fields');
|
export const Fields = createStory('fields');
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
export type ObjectOptionsContentId =
|
export type ObjectOptionsContentId =
|
||||||
| 'viewSettings'
|
| 'layout'
|
||||||
| 'viewSettingsOpenIn'
|
| 'layoutOpenIn'
|
||||||
| 'fields'
|
| 'fields'
|
||||||
| 'hiddenFields'
|
| 'hiddenFields'
|
||||||
| 'recordGroups'
|
| 'recordGroups'
|
||||||
|
|||||||
Reference in New Issue
Block a user