From e50764c1430fa0504ca6f274f8b744086711f1a1 Mon Sep 17 00:00:00 2001 From: frozenhelium Date: Tue, 9 Jun 2026 12:48:35 +0545 Subject: [PATCH] feat(locate): rename to Locate Objects --- .../index.tsx | 6 ++--- .../styles.module.css | 2 +- .../index.tsx | 4 +-- .../domain/ProjectSpecificDetails/index.tsx | 4 +-- .../index.tsx | 12 ++++----- .../schema.ts | 14 +++++----- .../EditProject/UpdateProjectForm/index.tsx | 26 +++++++++---------- .../EditProject/UpdateProjectForm/schema.ts | 4 +-- app/views/EditProject/query.ts | 2 +- .../LocateFeaturesPropertyInput/schema.ts | 24 ----------------- .../index.tsx | 12 ++++----- .../LocateObjectPropertyInput/schema.ts | 24 +++++++++++++++++ .../ScenarioPageInput/TaskInput/index.tsx | 10 +++---- .../ScenarioPageInput/TaskInput/schema.ts | 4 +-- .../EditTutorial/ScenarioPageInput/index.tsx | 4 +-- app/views/EditTutorial/utils.ts | 12 ++++----- app/views/NewProject/index.tsx | 2 +- 17 files changed, 83 insertions(+), 83 deletions(-) rename app/components/domain/{LocateFeaturesScenarioPreview => LocateObjectScenarioPreview}/index.tsx (96%) rename app/components/domain/{LocateFeaturesScenarioPreview => LocateObjectScenarioPreview}/styles.module.css (90%) rename app/components/domain/ProjectSpecificDetails/{LocateFeatures => LocateObject}/index.tsx (96%) rename app/views/EditProject/UpdateProjectForm/{LocateFeaturesProjectSpecifics => LocateObjectProjectSpecifics}/index.tsx (90%) rename app/views/EditProject/UpdateProjectForm/{LocateFeaturesProjectSpecifics => LocateObjectProjectSpecifics}/schema.ts (75%) delete mode 100644 app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateFeaturesPropertyInput/schema.ts rename app/views/EditTutorial/ScenarioPageInput/TaskInput/{LocateFeaturesPropertyInput => LocateObjectPropertyInput}/index.tsx (77%) create mode 100644 app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateObjectPropertyInput/schema.ts diff --git a/app/components/domain/LocateFeaturesScenarioPreview/index.tsx b/app/components/domain/LocateObjectScenarioPreview/index.tsx similarity index 96% rename from app/components/domain/LocateFeaturesScenarioPreview/index.tsx rename to app/components/domain/LocateObjectScenarioPreview/index.tsx index 14b37a9..dd80223 100644 --- a/app/components/domain/LocateFeaturesScenarioPreview/index.tsx +++ b/app/components/domain/LocateObjectScenarioPreview/index.tsx @@ -37,7 +37,7 @@ interface Props { customOptions: PartialCustomOptionInputFields[] | undefined; } -function LocateFeaturesScenarioPreview(props: Props) { +function LocateObjectScenarioPreview(props: Props) { const { className, scenario, @@ -140,7 +140,7 @@ function LocateFeaturesScenarioPreview(props: Props) { return ( diff --git a/app/views/EditProject/UpdateProjectForm/LocateFeaturesProjectSpecifics/index.tsx b/app/views/EditProject/UpdateProjectForm/LocateObjectProjectSpecifics/index.tsx similarity index 90% rename from app/views/EditProject/UpdateProjectForm/LocateFeaturesProjectSpecifics/index.tsx rename to app/views/EditProject/UpdateProjectForm/LocateObjectProjectSpecifics/index.tsx index febe0e6..8518692 100644 --- a/app/views/EditProject/UpdateProjectForm/LocateFeaturesProjectSpecifics/index.tsx +++ b/app/views/EditProject/UpdateProjectForm/LocateObjectProjectSpecifics/index.tsx @@ -26,17 +26,17 @@ import { labelSelector, } from '#utils/common'; -import { type PartialLocateFeaturesSpecificFields } from './schema'; +import { type PartialLocateObjectSpecificFields } from './schema'; interface Props { projectId: string; - value: PartialLocateFeaturesSpecificFields | undefined | null; - error: LeafError | ObjectError; - setFieldValue: (...entries: EntriesAsList) => void; + value: PartialLocateObjectSpecificFields | undefined | null; + error: LeafError | ObjectError; + setFieldValue: (...entries: EntriesAsList) => void; disabled?: boolean; } -function LocateFeaturesProjectSpecifics(props: Props) { +function LocateObjectProjectSpecifics(props: Props) { const { projectId, value, @@ -125,4 +125,4 @@ function LocateFeaturesProjectSpecifics(props: Props) { ); } -export default LocateFeaturesProjectSpecifics; +export default LocateObjectProjectSpecifics; diff --git a/app/views/EditProject/UpdateProjectForm/LocateFeaturesProjectSpecifics/schema.ts b/app/views/EditProject/UpdateProjectForm/LocateObjectProjectSpecifics/schema.ts similarity index 75% rename from app/views/EditProject/UpdateProjectForm/LocateFeaturesProjectSpecifics/schema.ts rename to app/views/EditProject/UpdateProjectForm/LocateObjectProjectSpecifics/schema.ts index a291434..11c417f 100644 --- a/app/views/EditProject/UpdateProjectForm/LocateFeaturesProjectSpecifics/schema.ts +++ b/app/views/EditProject/UpdateProjectForm/LocateObjectProjectSpecifics/schema.ts @@ -16,23 +16,23 @@ import { type UpdateProjectContext, } from '../schema'; -export type PartialLocateFeaturesSpecificFields = PartialForm< +export type PartialLocateObjectSpecificFields = PartialForm< DeepNonNullable, 'clientId' >; -type LocateFeaturesSpecificFormSchema = ObjectSchema< - PartialLocateFeaturesSpecificFields, +type LocateObjectSpecificFormSchema = ObjectSchema< + PartialLocateObjectSpecificFields, PartialProjectUpdateInput, UpdateProjectContext >; -export const defaultLocateFeaturesSpecificFormValue: PartialLocateFeaturesSpecificFields = { +export const defaultLocateObjectSpecificFormValue: PartialLocateObjectSpecificFields = { tileServerProperty: defaultRasterTileServerInputValue, zoomLevel: 18, }; -const locateFeaturesSpecificFormSchema: LocateFeaturesSpecificFormSchema = { - fields: (): ReturnType => ({ +const locateObjectSpecificFormSchema: LocateObjectSpecificFormSchema = { + fields: (): ReturnType => ({ zoomLevel: { required: true, validations: [greaterThanOrEqualToCondition(14), lessThanOrEqualToCondition(22)], @@ -54,4 +54,4 @@ const locateFeaturesSpecificFormSchema: LocateFeaturesSpecificFormSchema = { }), }; -export default locateFeaturesSpecificFormSchema; +export default locateObjectSpecificFormSchema; diff --git a/app/views/EditProject/UpdateProjectForm/index.tsx b/app/views/EditProject/UpdateProjectForm/index.tsx index 776fd36..b88634e 100644 --- a/app/views/EditProject/UpdateProjectForm/index.tsx +++ b/app/views/EditProject/UpdateProjectForm/index.tsx @@ -59,11 +59,11 @@ import { defaultFindSpecificFormValue, PartialFindSpecificFields, } from './FindProjectSpecifics/schema'; -import LocateFeaturesProjectSpecifics from './LocateFeaturesProjectSpecifics/index.tsx'; +import LocateObjectProjectSpecifics from './LocateObjectProjectSpecifics/index.tsx'; import { - defaultLocateFeaturesSpecificFormValue, - PartialLocateFeaturesSpecificFields, -} from './LocateFeaturesProjectSpecifics/schema.ts'; + defaultLocateObjectSpecificFormValue, + PartialLocateObjectSpecificFields, +} from './LocateObjectProjectSpecifics/schema.ts'; import StreetProjectSpecifics from './StreetProjectSpecifics/index.tsx'; import { defaultStreetSpecificFormValue, @@ -178,8 +178,8 @@ function UpdateProjectForm(props: Props) { } if (projectData.project.projectType === ProjectTypeEnum.Locate) { return { - ...defaultLocateFeaturesSpecificFormValue, - customOptions: projectData.defaultLocateFeaturesCustomOptions.map( + ...defaultLocateObjectSpecificFormValue, + customOptions: projectData.defaultLocateObjectCustomOptions.map( (customOption) => ({ clientId: ulid(), ...customOption, @@ -403,10 +403,10 @@ function UpdateProjectForm(props: Props) { defaultStreetSpecificFormValue, ); - const setLocateFeaturesProjectSpecificsFieldValue = useFormObject<'locate', PartialLocateFeaturesSpecificFields>( + const setLocateObjectProjectSpecificsFieldValue = useFormObject<'locate', PartialLocateObjectSpecificFields>( 'locate', setProjectSpecificFieldValue, - defaultLocateFeaturesSpecificFormValue, + defaultLocateObjectSpecificFormValue, ); const pending = updateProjectPending; @@ -437,8 +437,8 @@ function UpdateProjectForm(props: Props) { ?.validateImage as PartialValidateSpecificFields | undefined; const streetProjectTypeSpecifics = value.projectTypeSpecifics ?.street as PartialStreetSpecificFields | undefined; - const locateFeaturesProjectTypeSpecifics = value.projectTypeSpecifics - ?.locate as PartialLocateFeaturesSpecificFields | undefined; + const locateObjectProjectTypeSpecifics = value.projectTypeSpecifics + ?.locate as PartialLocateObjectSpecificFields | undefined; return ( )} {projectContext.projectType === ProjectTypeEnum.Locate && ( - diff --git a/app/views/EditProject/UpdateProjectForm/schema.ts b/app/views/EditProject/UpdateProjectForm/schema.ts index 730559e..c6f3e05 100644 --- a/app/views/EditProject/UpdateProjectForm/schema.ts +++ b/app/views/EditProject/UpdateProjectForm/schema.ts @@ -16,7 +16,7 @@ import { DeepNonNullable } from '#utils/types'; import compareSpecificFormSchema from './CompareProjectSpecifics/schema'; import completenessSpecificFormSchema from './CompletenessProjectSpecifics/schema'; import findSpecificFormSchema from './FindProjectSpecifics/schema'; -import locateFeaturesSpecificFormSchema from './LocateFeaturesProjectSpecifics/schema.ts'; +import locateObjectSpecificFormSchema from './LocateObjectProjectSpecifics/schema.ts'; import streetSpecificFormSchema from './StreetProjectSpecifics/schema.ts'; import validateImageSpecificFormSchema from './ValidateImageProjectSpecifics/schema.ts'; import validateSpecificFormSchema from './ValidateProjectSpecifics/schema'; @@ -142,7 +142,7 @@ const projectUpdateFormSchema: ProjectUpdateFormSchema = { if (projectType === ProjectTypeEnum.Locate) { return { ...defaultValue, - locate: locateFeaturesSpecificFormSchema, + locate: locateObjectSpecificFormSchema, }; } diff --git a/app/views/EditProject/query.ts b/app/views/EditProject/query.ts index a38f500..ae25c77 100644 --- a/app/views/EditProject/query.ts +++ b/app/views/EditProject/query.ts @@ -30,7 +30,7 @@ query ProjectDetails($id: ID!) { title value } - defaultLocateFeaturesCustomOptions: defaultCustomOptions(projectType: LOCATE) { + defaultLocateObjectCustomOptions: defaultCustomOptions(projectType: LOCATE) { description icon iconColor diff --git a/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateFeaturesPropertyInput/schema.ts b/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateFeaturesPropertyInput/schema.ts deleted file mode 100644 index a58e7e2..0000000 --- a/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateFeaturesPropertyInput/schema.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { - ObjectSchema, - PartialForm, -} from '@togglecorp/toggle-form'; - -import { LocateTutorialTaskPropertyInput } from '#generated/types/graphql'; -import { DeepNonNullable } from '#utils/types'; - -export type LocateFeaturesPropertyInputFields = DeepNonNullable; -export type PartialLocateFeaturesPropertyInputFields = PartialForm< - LocateFeaturesPropertyInputFields ->; - -type TaskSchema = ObjectSchema; - -const locateFeaturesPropertyInputSchema: TaskSchema = { - fields: (): ReturnType => ({ - tileX: {}, - tileY: {}, - tileZ: {}, - }), -}; - -export default locateFeaturesPropertyInputSchema; diff --git a/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateFeaturesPropertyInput/index.tsx b/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateObjectPropertyInput/index.tsx similarity index 77% rename from app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateFeaturesPropertyInput/index.tsx rename to app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateObjectPropertyInput/index.tsx index 029f195..14c5dab 100644 --- a/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateFeaturesPropertyInput/index.tsx +++ b/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateObjectPropertyInput/index.tsx @@ -8,17 +8,17 @@ import { import ListLayout from '#components/ListLayout'; import NumberInput from '#components/NumberInput'; -import { PartialLocateFeaturesPropertyInputFields } from './schema'; +import { PartialLocateObjectPropertyInputFields } from './schema'; interface Props { className?: string; - value: PartialLocateFeaturesPropertyInputFields | undefined; - setFieldValue: (...entries: EntriesAsList) => void; - error: LeafError | ObjectError; + value: PartialLocateObjectPropertyInputFields | undefined; + setFieldValue: (...entries: EntriesAsList) => void; + error: LeafError | ObjectError; disabled?: boolean; } -function LocateFeaturesPropertyInput(props: Props) { +function LocateObjectPropertyInput(props: Props) { const { className, value, @@ -65,4 +65,4 @@ function LocateFeaturesPropertyInput(props: Props) { ); } -export default LocateFeaturesPropertyInput; +export default LocateObjectPropertyInput; diff --git a/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateObjectPropertyInput/schema.ts b/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateObjectPropertyInput/schema.ts new file mode 100644 index 0000000..ffeb809 --- /dev/null +++ b/app/views/EditTutorial/ScenarioPageInput/TaskInput/LocateObjectPropertyInput/schema.ts @@ -0,0 +1,24 @@ +import { + ObjectSchema, + PartialForm, +} from '@togglecorp/toggle-form'; + +import { LocateTutorialTaskPropertyInput } from '#generated/types/graphql'; +import { DeepNonNullable } from '#utils/types'; + +export type LocateObjectPropertyInputFields = DeepNonNullable; +export type PartialLocateObjectPropertyInputFields = PartialForm< + LocateObjectPropertyInputFields +>; + +type TaskSchema = ObjectSchema; + +const locateObjectPropertyInputSchema: TaskSchema = { + fields: (): ReturnType => ({ + tileX: {}, + tileY: {}, + tileZ: {}, + }), +}; + +export default locateObjectPropertyInputSchema; diff --git a/app/views/EditTutorial/ScenarioPageInput/TaskInput/index.tsx b/app/views/EditTutorial/ScenarioPageInput/TaskInput/index.tsx index 1fb2904..59a446f 100644 --- a/app/views/EditTutorial/ScenarioPageInput/TaskInput/index.tsx +++ b/app/views/EditTutorial/ScenarioPageInput/TaskInput/index.tsx @@ -22,14 +22,14 @@ import { import { PartialComparePropertyInputFields } from './ComparePropertyInput/schema'; import { PartialCompletenessPropertyInputFields } from './CompletenessPropertyInput/schema'; import { PartialFindPropertyInputFields } from './FindPropertyInput/schema'; -import { PartialLocateFeaturesPropertyInputFields } from './LocateFeaturesPropertyInput/schema'; +import { PartialLocateObjectPropertyInputFields } from './LocateObjectPropertyInput/schema'; import { PartialStreetPropertyInputFields } from './StreetPropertyInput/schema'; import { PartialValidateImagePropertyInputFields } from './ValidateImagePropertyInput/schema'; import { PartialValidatePropertyInputFields } from './ValidatePropertyInput/schema'; import ComparePropertyInput from './ComparePropertyInput'; import CompletenessPropertyInput from './CompletenessPropertyInput'; import FindPropertyInput from './FindPropertyInput'; -import LocateFeaturesPropertyInput from './LocateFeaturesPropertyInput'; +import LocateObjectPropertyInput from './LocateObjectPropertyInput'; import { PartialProjectTypeSpecifics, PartialTaskInputFields, @@ -114,7 +114,7 @@ function TaskInput(props: Props) { {}, ); - const setLocateFeaturesProjectSpecificsFieldValue = useFormObject<'locate', PartialLocateFeaturesPropertyInputFields>( + const setLocateObjectProjectSpecificsFieldValue = useFormObject<'locate', PartialLocateObjectPropertyInputFields>( 'locate' as const, setProjectSpecificFieldValue, {}, @@ -240,9 +240,9 @@ function TaskInput(props: Props) { /> )} {projectData?.projectType === ProjectTypeEnum.Locate && ( - diff --git a/app/views/EditTutorial/ScenarioPageInput/TaskInput/schema.ts b/app/views/EditTutorial/ScenarioPageInput/TaskInput/schema.ts index 4538045..d2d528e 100644 --- a/app/views/EditTutorial/ScenarioPageInput/TaskInput/schema.ts +++ b/app/views/EditTutorial/ScenarioPageInput/TaskInput/schema.ts @@ -19,7 +19,7 @@ import { import comparePropertyInputSchema from './ComparePropertyInput/schema'; import completenessPropertyInputSchema from './CompletenessPropertyInput/schema'; import findPropertyInputSchema from './FindPropertyInput/schema'; -import locateFeaturesPropertyInputSchema from './LocateFeaturesPropertyInput/schema'; +import locateObjectPropertyInputSchema from './LocateObjectPropertyInput/schema'; import streetPropertyInputSchema from './StreetPropertyInput/schema'; import validateImagePropertyInputSchema from './ValidateImagePropertyInput/schema'; import validatePropertyInputSchema from './ValidatePropertyInput/schema'; @@ -110,7 +110,7 @@ const taskSchema: TaskSchema = { if (projectType === ProjectTypeEnum.Locate) { return { ...defaultSchema, - locate: locateFeaturesPropertyInputSchema, + locate: locateObjectPropertyInputSchema, }; } diff --git a/app/views/EditTutorial/ScenarioPageInput/index.tsx b/app/views/EditTutorial/ScenarioPageInput/index.tsx index fe1d626..7ed9a95 100644 --- a/app/views/EditTutorial/ScenarioPageInput/index.tsx +++ b/app/views/EditTutorial/ScenarioPageInput/index.tsx @@ -26,7 +26,7 @@ import CompareScenarioPreview from '#components/domain/CompareScenarioPreview'; import CompletenessScenarioPreview from '#components/domain/CompletenessScenarioPreview'; import FindScenarioPreview from '#components/domain/FindScenarioPreview'; import IconSelectInput from '#components/domain/IconSelectInput'; -import LocateFeaturesScenarioPreview from '#components/domain/LocateFeaturesScenarioPreview'; +import LocateObjectScenarioPreview from '#components/domain/LocateObjectScenarioPreview'; import StreetScenarioPreview from '#components/domain/StreetScenarioPreview'; import TutorialPreviewScreenSelectInput, { PreviewItem, @@ -358,7 +358,7 @@ function ScenarioPageInput(props: Props) { )} {/* eslint-disable-next-line no-underscore-dangle */} {projectData?.projectTypeSpecifics?.__typename === 'LocateProjectPropertyType' && ( - = { /> ), - [ProjectTypeEnum.Locate]: 'Locate features', + [ProjectTypeEnum.Locate]: 'Locate objects', }; function NewProject() {