Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface Props {
customOptions: PartialCustomOptionInputFields[] | undefined;
}

function LocateFeaturesScenarioPreview(props: Props) {
function LocateObjectScenarioPreview(props: Props) {
const {
className,
scenario,
Expand Down Expand Up @@ -140,7 +140,7 @@ function LocateFeaturesScenarioPreview(props: Props) {

return (
<ListLayout
className={_cs(styles.locateFeaturesScenarioPreview, className)}
className={_cs(styles.locateObjectScenarioPreview, className)}
layout="block"
>
<MobilePreview
Expand All @@ -165,4 +165,4 @@ function LocateFeaturesScenarioPreview(props: Props) {
);
}

export default LocateFeaturesScenarioPreview;
export default LocateObjectScenarioPreview;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.locate-features-scenario-preview {
.locate-object-scenario-preview {
isolation: isolate;

.content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface Props {
defaultBounds: GeoJSON.Polygon | undefined | null;
}

function LocateFeaturesDetails(props: Props) {
function LocateObjectDetails(props: Props) {
const {
data,
defaultBounds,
Expand Down Expand Up @@ -69,4 +69,4 @@ function LocateFeaturesDetails(props: Props) {
);
}

export default LocateFeaturesDetails;
export default LocateObjectDetails;
4 changes: 2 additions & 2 deletions app/components/domain/ProjectSpecificDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ProjectTypeOutput from '../ProjectTypeOutput';
import CompareDetails from './CompareDetails';
import CompletenessDetails from './CompletenessDetails';
import FindDetails from './FindDetails';
import LocateFeaturesDetails from './LocateFeatures';
import LocateObjectDetails from './LocateObject';
import StreetDetails from './StreetDetails';
import ValidateDetails from './ValidateDetails';
import ValidateImageDetails from './ValidateImageDetails';
Expand Down Expand Up @@ -137,7 +137,7 @@ function ProjectSpecificDetails(props: Props) {
)}
{/* eslint-disable-next-line no-underscore-dangle */}
{projectData?.project.projectTypeSpecifics?.__typename === 'LocateProjectPropertyType' && (
<LocateFeaturesDetails
<LocateObjectDetails
data={projectData.project.projectTypeSpecifics}
defaultBounds={defaultBounds}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PartialLocateFeaturesSpecificFields>;
setFieldValue: (...entries: EntriesAsList<PartialLocateFeaturesSpecificFields>) => void;
value: PartialLocateObjectSpecificFields | undefined | null;
error: LeafError | ObjectError<PartialLocateObjectSpecificFields>;
setFieldValue: (...entries: EntriesAsList<PartialLocateObjectSpecificFields>) => void;
disabled?: boolean;
}

function LocateFeaturesProjectSpecifics(props: Props) {
function LocateObjectProjectSpecifics(props: Props) {
const {
projectId,
value,
Expand Down Expand Up @@ -125,4 +125,4 @@ function LocateFeaturesProjectSpecifics(props: Props) {
);
}

export default LocateFeaturesProjectSpecifics;
export default LocateObjectProjectSpecifics;
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ import {
type UpdateProjectContext,
} from '../schema';

export type PartialLocateFeaturesSpecificFields = PartialForm<
export type PartialLocateObjectSpecificFields = PartialForm<
DeepNonNullable<LocateProjectPropertyInput>,
'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<LocateFeaturesSpecificFormSchema['fields']> => ({
const locateObjectSpecificFormSchema: LocateObjectSpecificFormSchema = {
fields: (): ReturnType<LocateObjectSpecificFormSchema['fields']> => ({
zoomLevel: {
required: true,
validations: [greaterThanOrEqualToCondition(14), lessThanOrEqualToCondition(22)],
Expand All @@ -54,4 +54,4 @@ const locateFeaturesSpecificFormSchema: LocateFeaturesSpecificFormSchema = {
}),
};

export default locateFeaturesSpecificFormSchema;
export default locateObjectSpecificFormSchema;
26 changes: 13 additions & 13 deletions app/views/EditProject/UpdateProjectForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 (
<PageLayout
Expand Down Expand Up @@ -594,10 +594,10 @@ function UpdateProjectForm(props: Props) {
/>
)}
{projectContext.projectType === ProjectTypeEnum.Locate && (
<LocateFeaturesProjectSpecifics
<LocateObjectProjectSpecifics
projectId={projectData.project.id}
value={locateFeaturesProjectTypeSpecifics}
setFieldValue={setLocateFeaturesProjectSpecificsFieldValue}
value={locateObjectProjectTypeSpecifics}
setFieldValue={setLocateObjectProjectSpecificsFieldValue}
error={getErrorObject(error?.projectTypeSpecifics)?.locate}
disabled={projectTypeSpecificInputsDisabled || readOnly}
/>
Expand Down
4 changes: 2 additions & 2 deletions app/views/EditProject/UpdateProjectForm/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -142,7 +142,7 @@ const projectUpdateFormSchema: ProjectUpdateFormSchema = {
if (projectType === ProjectTypeEnum.Locate) {
return {
...defaultValue,
locate: locateFeaturesSpecificFormSchema,
locate: locateObjectSpecificFormSchema,
};
}

Expand Down
2 changes: 1 addition & 1 deletion app/views/EditProject/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ query ProjectDetails($id: ID!) {
title
value
}
defaultLocateFeaturesCustomOptions: defaultCustomOptions(projectType: LOCATE) {
defaultLocateObjectCustomOptions: defaultCustomOptions(projectType: LOCATE) {
description
icon
iconColor
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<PartialLocateFeaturesPropertyInputFields>) => void;
error: LeafError | ObjectError<PartialLocateFeaturesPropertyInputFields>;
value: PartialLocateObjectPropertyInputFields | undefined;
setFieldValue: (...entries: EntriesAsList<PartialLocateObjectPropertyInputFields>) => void;
error: LeafError | ObjectError<PartialLocateObjectPropertyInputFields>;
disabled?: boolean;
}

function LocateFeaturesPropertyInput(props: Props) {
function LocateObjectPropertyInput(props: Props) {
const {
className,
value,
Expand Down Expand Up @@ -65,4 +65,4 @@ function LocateFeaturesPropertyInput(props: Props) {
);
}

export default LocateFeaturesPropertyInput;
export default LocateObjectPropertyInput;
Original file line number Diff line number Diff line change
@@ -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<LocateTutorialTaskPropertyInput>;
export type PartialLocateObjectPropertyInputFields = PartialForm<
LocateObjectPropertyInputFields
>;

type TaskSchema = ObjectSchema<PartialLocateObjectPropertyInputFields>;

const locateObjectPropertyInputSchema: TaskSchema = {
fields: (): ReturnType<TaskSchema['fields']> => ({
tileX: {},
tileY: {},
tileZ: {},
}),
};

export default locateObjectPropertyInputSchema;
10 changes: 5 additions & 5 deletions app/views/EditTutorial/ScenarioPageInput/TaskInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -114,7 +114,7 @@ function TaskInput(props: Props) {
{},
);

const setLocateFeaturesProjectSpecificsFieldValue = useFormObject<'locate', PartialLocateFeaturesPropertyInputFields>(
const setLocateObjectProjectSpecificsFieldValue = useFormObject<'locate', PartialLocateObjectPropertyInputFields>(
'locate' as const,
setProjectSpecificFieldValue,
{},
Expand Down Expand Up @@ -240,9 +240,9 @@ function TaskInput(props: Props) {
/>
)}
{projectData?.projectType === ProjectTypeEnum.Locate && (
<LocateFeaturesPropertyInput
<LocateObjectPropertyInput
value={value.projectTypeSpecifics?.locate}
setFieldValue={setLocateFeaturesProjectSpecificsFieldValue}
setFieldValue={setLocateObjectProjectSpecificsFieldValue}
error={getErrorObject(error?.projectTypeSpecifics)?.locate}
disabled
/>
Expand Down
4 changes: 2 additions & 2 deletions app/views/EditTutorial/ScenarioPageInput/TaskInput/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -110,7 +110,7 @@ const taskSchema: TaskSchema = {
if (projectType === ProjectTypeEnum.Locate) {
return {
...defaultSchema,
locate: locateFeaturesPropertyInputSchema,
locate: locateObjectPropertyInputSchema,
};
}

Expand Down
4 changes: 2 additions & 2 deletions app/views/EditTutorial/ScenarioPageInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -358,7 +358,7 @@ function ScenarioPageInput(props: Props) {
)}
{/* eslint-disable-next-line no-underscore-dangle */}
{projectData?.projectTypeSpecifics?.__typename === 'LocateProjectPropertyType' && (
<LocateFeaturesScenarioPreview
<LocateObjectScenarioPreview
scenario={value}
tileServerProperty={projectData.projectTypeSpecifics?.tileServerProperty}
projectInstruction={projectData.projectInstruction}
Expand Down
Loading
Loading