mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-27 22:32:49 +03:00
2795-fix(front): ObjectNamePlural added as Page Header title (#2852)
* 2795-fix(front): ObjectNamePlural added as Page Header title * 2795-fix(front): Icon fix * fix linting errors --------- Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
parent
b72d6a9d9d
commit
b2912f4b4b
@ -5,9 +5,10 @@ import { isNonEmptyString } from '@sniptt/guards';
|
|||||||
|
|
||||||
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
|
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
|
||||||
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
|
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
|
||||||
|
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
|
||||||
import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural';
|
import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural';
|
||||||
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
||||||
import { IconBuildingSkyscraper } from '@/ui/display/icon';
|
import { useLazyLoadIcons } from '@/ui/input/hooks/useLazyLoadIcons';
|
||||||
import { PageAddButton } from '@/ui/layout/page/PageAddButton';
|
import { PageAddButton } from '@/ui/layout/page/PageAddButton';
|
||||||
import { PageBody } from '@/ui/layout/page/PageBody';
|
import { PageBody } from '@/ui/layout/page/PageBody';
|
||||||
import { PageContainer } from '@/ui/layout/page/PageContainer';
|
import { PageContainer } from '@/ui/layout/page/PageContainer';
|
||||||
@ -35,6 +36,11 @@ export const RecordTablePage = () => {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const { icons } = useLazyLoadIcons();
|
||||||
|
|
||||||
|
const { findObjectMetadataItemByNamePlural } =
|
||||||
|
useObjectMetadataItemForSettings();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
!isNonEmptyString(objectNamePlural) &&
|
!isNonEmptyString(objectNamePlural) &&
|
||||||
@ -54,7 +60,17 @@ export const RecordTablePage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer>
|
<PageContainer>
|
||||||
<PageHeader title="Objects" Icon={IconBuildingSkyscraper}>
|
<PageHeader
|
||||||
|
title={
|
||||||
|
objectNamePlural.charAt(0).toUpperCase() + objectNamePlural.slice(1)
|
||||||
|
}
|
||||||
|
Icon={
|
||||||
|
icons[
|
||||||
|
findObjectMetadataItemByNamePlural(objectNamePlural)!.icon ??
|
||||||
|
'Icon123'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
<PageHotkeysEffect onAddButtonClick={handleAddButtonClick} />
|
<PageHotkeysEffect onAddButtonClick={handleAddButtonClick} />
|
||||||
<PageAddButton onClick={handleAddButtonClick} />
|
<PageAddButton onClick={handleAddButtonClick} />
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
@ -235,5 +235,4 @@ export const ValidationStep = <T extends string>({
|
|||||||
<ContinueButton onContinue={onContinue} title="Confirm" />
|
<ContinueButton onContinue={onContinue} title="Confirm" />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { Meta, StoryObj } from '@storybook/react';
|
import { Meta, StoryObj } from '@storybook/react';
|
||||||
|
|
||||||
|
import {
|
||||||
|
IconCheckbox,
|
||||||
|
IconList,
|
||||||
|
IconSearch,
|
||||||
|
IconSettings,
|
||||||
|
} from '@/ui/display/icon';
|
||||||
|
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||||
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
|
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
|
||||||
|
|
||||||
import { NavigationBar } from '../NavigationBar';
|
import { NavigationBar } from '../NavigationBar';
|
||||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
|
||||||
import {
|
|
||||||
IconList,
|
|
||||||
IconSearch,
|
|
||||||
IconCheckbox,
|
|
||||||
IconSettings,
|
|
||||||
} from '@/ui/display/icon';
|
|
||||||
|
|
||||||
const meta: Meta<typeof NavigationBar> = {
|
const meta: Meta<typeof NavigationBar> = {
|
||||||
title: 'UI/Navigation/NavigationBar/NavigationBar',
|
title: 'UI/Navigation/NavigationBar/NavigationBar',
|
||||||
|
@ -6,10 +6,10 @@ import { userEvent, within } from '@storybook/testing-library';
|
|||||||
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
||||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||||
|
|
||||||
|
import { FieldRatingValue } from '../../../../types/FieldMetadata';
|
||||||
import { FieldContextProvider } from '../../../__stories__/FieldContextProvider';
|
import { FieldContextProvider } from '../../../__stories__/FieldContextProvider';
|
||||||
import { useRatingField } from '../../../hooks/useRatingField';
|
import { useRatingField } from '../../../hooks/useRatingField';
|
||||||
import { RatingFieldInput, RatingFieldInputProps } from '../RatingFieldInput';
|
import { RatingFieldInput, RatingFieldInputProps } from '../RatingFieldInput';
|
||||||
import { FieldRatingValue } from '../../../../types/FieldMetadata';
|
|
||||||
|
|
||||||
const RatingFieldValueSetterEffect = ({
|
const RatingFieldValueSetterEffect = ({
|
||||||
value,
|
value,
|
||||||
|
@ -63,4 +63,3 @@ export const castAsPositiveIntegerOrNull = (
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user