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:
Kanav Arora 2023-12-07 15:43:32 +05:30 committed by GitHub
parent b72d6a9d9d
commit b2912f4b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 12 deletions

View File

@ -5,9 +5,10 @@ import { isNonEmptyString } from '@sniptt/guards';
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural';
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 { PageBody } from '@/ui/layout/page/PageBody';
import { PageContainer } from '@/ui/layout/page/PageContainer';
@ -35,6 +36,11 @@ export const RecordTablePage = () => {
const navigate = useNavigate();
const { icons } = useLazyLoadIcons();
const { findObjectMetadataItemByNamePlural } =
useObjectMetadataItemForSettings();
useEffect(() => {
if (
!isNonEmptyString(objectNamePlural) &&
@ -54,7 +60,17 @@ export const RecordTablePage = () => {
return (
<PageContainer>
<PageHeader title="Objects" Icon={IconBuildingSkyscraper}>
<PageHeader
title={
objectNamePlural.charAt(0).toUpperCase() + objectNamePlural.slice(1)
}
Icon={
icons[
findObjectMetadataItemByNamePlural(objectNamePlural)!.icon ??
'Icon123'
]
}
>
<PageHotkeysEffect onAddButtonClick={handleAddButtonClick} />
<PageAddButton onClick={handleAddButtonClick} />
</PageHeader>

View File

@ -235,5 +235,4 @@ export const ValidationStep = <T extends string>({
<ContinueButton onContinue={onContinue} title="Confirm" />
</>
);
};

View File

@ -1,15 +1,15 @@
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 { NavigationBar } from '../NavigationBar';
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
import {
IconList,
IconSearch,
IconCheckbox,
IconSettings,
} from '@/ui/display/icon';
const meta: Meta<typeof NavigationBar> = {
title: 'UI/Navigation/NavigationBar/NavigationBar',

View File

@ -6,10 +6,10 @@ import { userEvent, within } from '@storybook/testing-library';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { FieldRatingValue } from '../../../../types/FieldMetadata';
import { FieldContextProvider } from '../../../__stories__/FieldContextProvider';
import { useRatingField } from '../../../hooks/useRatingField';
import { RatingFieldInput, RatingFieldInputProps } from '../RatingFieldInput';
import { FieldRatingValue } from '../../../../types/FieldMetadata';
const RatingFieldValueSetterEffect = ({
value,

View File

@ -63,4 +63,3 @@ export const castAsPositiveIntegerOrNull = (
return null;
};