From 109ca641ddcfd3bcff2d1340fb22dce0c86f6b74 Mon Sep 17 00:00:00 2001 From: tnagorra Date: Tue, 13 Jan 2026 13:44:57 +0545 Subject: [PATCH 1/4] fix(raster-tile): filter out raster tiles from selection if disabled --- .../domain/RasterTileServerInput/index.tsx | 30 +++++++++++++------ .../domain/RasterTileServerOutput/index.tsx | 13 ++++++-- .../domain/VectorTileServerInput/index.tsx | 22 ++++++++++---- .../domain/VectorTileServerOutput/index.tsx | 11 +++++-- app/contexts/EnumsContext.ts | 14 --------- app/views/RootLayout/index.tsx | 19 +----------- backend | 2 +- 7 files changed, 58 insertions(+), 53 deletions(-) diff --git a/app/components/domain/RasterTileServerInput/index.tsx b/app/components/domain/RasterTileServerInput/index.tsx index 8aba5ab..8194968 100644 --- a/app/components/domain/RasterTileServerInput/index.tsx +++ b/app/components/domain/RasterTileServerInput/index.tsx @@ -23,13 +23,8 @@ import ListLayout from '#components/ListLayout'; import NumberInput from '#components/NumberInput'; import RadioInput from '#components/RadioInput'; import TextInput from '#components/TextInput'; -import EnumsContext from '#contexts/EnumsContext'; import TileServerContext from '#contexts/TileServerContext'; import { RasterTileServerNameEnum } from '#generated/types/graphql'; -import { - keySelector, - labelSelector, -} from '#utils/common'; import BaseMap from '../BaseMap'; import GeoJsonAssetMapSource from '../GeoJsonAssetMapSource'; @@ -42,6 +37,18 @@ import { TileInputKeys, } from './schema'; +interface Option { + type: RasterTileServerNameEnum; + label: string; +} + +function imageryKeySelector(item: Option) { + return item.type; +} +function imageryLabelSelector(item: Option) { + return item.label; +} + interface Props { label?: React.ReactNode; value: PartialRasterTileServerInputFields | undefined, @@ -75,9 +82,14 @@ function RasterTileServerInput(props: Props) { const error = getErrorObject(formError); - const { rasterTileServerNameOptions } = useContext(EnumsContext); + const { raster: rasterTileServerNameOptions } = useContext(TileServerContext); const [zoomView, setZoomView] = useState('aoiBounds'); + const workingRasterTileServerNameOptions = useMemo( + () => rasterTileServerNameOptions.filter((option) => !option.disabled) ?? [], + [rasterTileServerNameOptions], + ); + const fieldName = (isDefined(value) && isDefined(value.name) ) ? rasterTileServerNameToTileInputKey[value.name] : 'custom'; @@ -133,11 +145,11 @@ function RasterTileServerInput(props: Props) { listToMap( + rasterTileServers, + (item) => item.type, + (item) => item, + ), + [rasterTileServers], + ); + const { url, credits, @@ -106,7 +113,7 @@ function RasterTileServerOutput(props: Props) { */} ( listToMap(vectorTileServers, ({ type }) => type) ), [vectorTileServers]); @@ -120,9 +130,9 @@ function VectorTileServerInput(props: Props) { listToMap( + vectorTileServers, + (item) => item.type, + (item) => item, + ), + [vectorTileServers], + ); + const { url, credits, diff --git a/app/contexts/EnumsContext.ts b/app/contexts/EnumsContext.ts index 38dcbaf..b46213d 100644 --- a/app/contexts/EnumsContext.ts +++ b/app/contexts/EnumsContext.ts @@ -7,8 +7,6 @@ export interface EnumsContextProps { validateImageSourceTypeOptions: AllEnumsQuery['enums']['ValidateImageSourceTypeEnum'], projectStatusOptions: AllEnumsQuery['enums']['ProjectStatusEnum'], projectTypeOptions: AllEnumsQuery['enums']['ProjectTypeEnum'], - rasterTileServerNameOptions: AllEnumsQuery['enums']['RasterTileServerNameEnum'], - vectorTileServerNameOptions: AllEnumsQuery['enums']['VectorTileServerNameEnum'], tutorialInformationPageBlockTypeOptions: AllEnumsQuery['enums']['TutorialInformationPageBlockTypeEnum'], iconOptions: AllEnumsQuery['enums']['IconEnum'], overlayLayerTypeOptions: AllEnumsQuery['enums']['OverlayLayerTypeEnum'], @@ -31,14 +29,6 @@ export interface EnumsContextProps { AllEnumsQuery['enums']['ProjectTypeEnum'][number]['key'], AllEnumsQuery['enums']['ProjectTypeEnum'][number] > | undefined; - rasterTileServerNameMapping: Record< - AllEnumsQuery['enums']['RasterTileServerNameEnum'][number]['key'], - AllEnumsQuery['enums']['RasterTileServerNameEnum'][number] - > | undefined; - vectorTileServerNameMapping: Record< - AllEnumsQuery['enums']['VectorTileServerNameEnum'][number]['key'], - AllEnumsQuery['enums']['VectorTileServerNameEnum'][number] - > | undefined; tutorialInformationPageBlockTypeMapping: Record< AllEnumsQuery['enums']['TutorialInformationPageBlockTypeEnum'][number]['key'], AllEnumsQuery['enums']['TutorialInformationPageBlockTypeEnum'][number] @@ -66,8 +56,6 @@ export const defaultAllEnumsValue: EnumsContextProps = { validateImageSourceTypeOptions: [], projectStatusOptions: [], projectTypeOptions: [], - rasterTileServerNameOptions: [], - vectorTileServerNameOptions: [], tutorialInformationPageBlockTypeOptions: [], iconOptions: [], overlayLayerTypeOptions: [], @@ -78,8 +66,6 @@ export const defaultAllEnumsValue: EnumsContextProps = { validateImageSourceTypeMapping: undefined, projectStatusMapping: undefined, projectTypeMapping: undefined, - rasterTileServerNameMapping: undefined, - vectorTileServerNameMapping: undefined, tutorialInformationPageBlockTypeMapping: undefined, iconMapping: undefined, overlayLayerTypeMapping: undefined, diff --git a/app/views/RootLayout/index.tsx b/app/views/RootLayout/index.tsx index 8922022..fcb41b9 100644 --- a/app/views/RootLayout/index.tsx +++ b/app/views/RootLayout/index.tsx @@ -41,6 +41,7 @@ query TileServers { credits maxZoom minZoom + disabled } vector { label @@ -78,14 +79,6 @@ query AllEnums { key label } - RasterTileServerNameEnum { - key - label - } - VectorTileServerNameEnum { - key - label - } TutorialInformationPageBlockTypeEnum { key label @@ -201,8 +194,6 @@ function RootLayout() { validateImageSourceTypeOptions: allEnumsResponse?.enums.ValidateImageSourceTypeEnum ?? [], projectStatusOptions: allEnumsResponse?.enums.ProjectStatusEnum ?? [], projectTypeOptions: allEnumsResponse?.enums.ProjectTypeEnum ?? [], - rasterTileServerNameOptions: allEnumsResponse?.enums.RasterTileServerNameEnum ?? [], - vectorTileServerNameOptions: allEnumsResponse?.enums.VectorTileServerNameEnum ?? [], tutorialInformationPageBlockTypeOptions: allEnumsResponse ?.enums.TutorialInformationPageBlockTypeEnum ?? [], iconOptions: allEnumsResponse?.enums.IconEnum ?? [], @@ -225,14 +216,6 @@ function RootLayout() { allEnumsResponse?.enums.ProjectTypeEnum, ({ key }) => key, ), - rasterTileServerNameMapping: listToMap( - allEnumsResponse?.enums.RasterTileServerNameEnum, - ({ key }) => key, - ), - vectorTileServerNameMapping: listToMap( - allEnumsResponse?.enums.VectorTileServerNameEnum, - ({ key }) => key, - ), tutorialInformationPageBlockTypeMapping: listToMap( allEnumsResponse?.enums.TutorialInformationPageBlockTypeEnum, ({ key }) => key, diff --git a/backend b/backend index e1b0df8..ad37364 160000 --- a/backend +++ b/backend @@ -1 +1 @@ -Subproject commit e1b0df8f3e270293b0b9fc9936254b4f859c61a9 +Subproject commit ad37364aeef0a1e8f11586da195c9e1ea39b852e From 880e72b2291441f0125ccb77dd036c8fb91af595 Mon Sep 17 00:00:00 2001 From: tnagorra Date: Tue, 13 Jan 2026 14:34:34 +0545 Subject: [PATCH 2/4] feat: add hint and error support in Checkbox --- app/components/Checkbox/index.tsx | 95 +++++++++++++++++++------------ 1 file changed, 60 insertions(+), 35 deletions(-) diff --git a/app/components/Checkbox/index.tsx b/app/components/Checkbox/index.tsx index 004d059..449cd4f 100644 --- a/app/components/Checkbox/index.tsx +++ b/app/components/Checkbox/index.tsx @@ -3,6 +3,10 @@ import { _cs } from '@togglecorp/fujs'; import ButtonLayout from '#components/ButtonLayout'; import DefaultCheckmark, { Props as CheckmarkProps } from '#components/Checkmark'; +import InputError from '#components/InputError'; +import InputHint from '#components/InputHint'; +import ListLayout from '#components/ListLayout'; +import { SpacingType } from '#utils/styles'; import styles from './styles.module.css'; @@ -19,6 +23,9 @@ export interface Props { value: boolean | undefined | null; onChange: (value: boolean, name: NAME) => void; name: NAME; + hint?: React.ReactNode; + error?: React.ReactNode; + spacing?: SpacingType; } function Checkbox(props: Props) { @@ -35,6 +42,9 @@ function Checkbox(props: Props) { labelClassName, indeterminate, name, + hint, + error, + spacing, ...otherProps } = props; @@ -46,50 +56,65 @@ function Checkbox(props: Props) { [name, onChange], ); - const className = _cs( - classNameFromProps, - indeterminate && styles.indeterminate, - !indeterminate && value && styles.checked, - readOnly && styles.readOnly, - ); - return ( ); } From d2f3a5b1b61a2d59f85a98fa3f3826fd4012bab3 Mon Sep 17 00:00:00 2001 From: tnagorra Date: Tue, 13 Jan 2026 14:35:50 +0545 Subject: [PATCH 3/4] fix: update input hints --- app/components/ZoomLevelSelectInput/index.tsx | 2 +- .../SubOptionInput/index.tsx | 2 ++ .../domain/CustomOptionInput/index.tsx | 5 +++ .../domain/RasterTileServerInput/index.tsx | 3 +- .../domain/VectorTileServerInput/index.tsx | 8 +++-- .../ProjectAdditionalInputs/index.tsx | 4 +-- .../UpdateProcessedProjectForm/index.tsx | 2 +- .../CompletenessProjectSpecifics/index.tsx | 2 +- .../index.tsx | 11 +++++-- .../StreetProjectSpecifics/index.tsx | 2 +- .../ObjectSourceInput/index.tsx | 2 +- .../NewProject/ProjectGeneralInputs/index.tsx | 31 ++++++++++--------- 12 files changed, 47 insertions(+), 27 deletions(-) diff --git a/app/components/ZoomLevelSelectInput/index.tsx b/app/components/ZoomLevelSelectInput/index.tsx index 90bddef..a3af5d8 100644 --- a/app/components/ZoomLevelSelectInput/index.tsx +++ b/app/components/ZoomLevelSelectInput/index.tsx @@ -83,7 +83,7 @@ function ZoomLevelSelectInput(props: Props) { error={error} disabled={disabled} nonClearable - hint="We use the Tile Map Service zoom levels. Please check for your area which zoom level is available. If you use a custom tile server you may be able to use even higher zoom levels." + hint="We use the zoom levels that the tile server provides. Please check for your area which zoom level is available before you create a project." /> ); } diff --git a/app/components/domain/CustomOptionInput/SubOptionInput/index.tsx b/app/components/domain/CustomOptionInput/SubOptionInput/index.tsx index 7e8de7b..13663a6 100644 --- a/app/components/domain/CustomOptionInput/SubOptionInput/index.tsx +++ b/app/components/domain/CustomOptionInput/SubOptionInput/index.tsx @@ -81,6 +81,7 @@ function SubOptionInput(props: Props) { error={error?.value} disabled={disabled} spacing="sm" + hint="Choose a value for each sub-option" /> diff --git a/app/components/domain/CustomOptionInput/index.tsx b/app/components/domain/CustomOptionInput/index.tsx index 74e7edc..adfaccd 100644 --- a/app/components/domain/CustomOptionInput/index.tsx +++ b/app/components/domain/CustomOptionInput/index.tsx @@ -115,6 +115,7 @@ function CustomOptionInput(props: Props) { error={error?.title} disabled={disabled} spacing="sm" + hint="Provide 'Title' for each answer option (e.g. Yes, No, Offset)" />