Skip to content

Commit fdd7cb6

Browse files
committed
Update sourceName with sourceLayer
1 parent 0ab118e commit fdd7cb6

File tree

6 files changed

+32
-32
lines changed

6 files changed

+32
-32
lines changed

app/components/VectorTileMapSource/index.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function VectorTileMapSource(props: Props) {
3939
const {
4040
url,
4141
credits,
42-
sourceName,
42+
sourceLayer,
4343
minZoom,
4444
maxZoom,
4545
} = useMemo(() => {
@@ -62,7 +62,7 @@ function VectorTileMapSource(props: Props) {
6262
return {
6363
url: tileConfig.tileServer?.custom?.url,
6464
credits: tileConfig.tileServer?.custom?.credits,
65-
sourceName: tileConfig.tileServer?.custom?.sourceName,
65+
sourceLayer: tileConfig.tileServer?.custom?.sourceLayer,
6666
};
6767
}
6868

@@ -72,7 +72,7 @@ function VectorTileMapSource(props: Props) {
7272
return {
7373
url: vectorTileServerMapping[name]?.url,
7474
credits: vectorTileServerMapping[name]?.credits,
75-
sourceName: tileServer?.sourceName,
75+
sourceLayer: tileServer?.sourceLayer,
7676
minZoom: vectorTileServerMapping[name]?.minZoom,
7777
maxZoom: vectorTileServerMapping[name]?.maxZoom,
7878
};
@@ -93,35 +93,35 @@ function VectorTileMapSource(props: Props) {
9393
}, [url, credits, minZoom, maxZoom]);
9494

9595
const lineLayerOptions = useMemo<Omit<maplibregl.LineLayerSpecification, 'id' | 'source'> | undefined>(() => {
96-
if (isNotDefined(tileConfig) || isNotDefined(sourceName)) {
96+
if (isNotDefined(tileConfig) || isNotDefined(sourceLayer)) {
9797
return undefined;
9898
}
9999

100100
return {
101101
type: 'line',
102-
'source-layer': sourceName,
102+
'source-layer': sourceLayer,
103103
paint: {
104104
'line-color': tileConfig.lineColor,
105105
'line-width': tileConfig.lineWidth,
106106
'line-opacity': tileConfig.lineOpacity,
107107
},
108108
};
109-
}, [tileConfig, sourceName]);
109+
}, [tileConfig, sourceLayer]);
110110

111111
const fillLayerOptions = useMemo<Omit<maplibregl.FillLayerSpecification, 'id' | 'source'> | undefined>(() => {
112-
if (isNotDefined(tileConfig) || isNotDefined(sourceName)) {
112+
if (isNotDefined(tileConfig) || isNotDefined(sourceLayer)) {
113113
return undefined;
114114
}
115115

116116
return {
117117
type: 'fill',
118-
'source-layer': sourceName,
118+
'source-layer': sourceLayer,
119119
paint: {
120120
'fill-color': tileConfig.fillColor,
121121
'fill-opacity': tileConfig.fillOpacity,
122122
},
123123
};
124-
}, [tileConfig, sourceName]);
124+
}, [tileConfig, sourceLayer]);
125125

126126
if (isNotDefined(sourceOptions)) {
127127
return null;
@@ -132,8 +132,8 @@ function VectorTileMapSource(props: Props) {
132132
}
133133

134134
const sourceKey = `overlay-source-${tileConfig.tileServer.name}`;
135-
const fillLayerKey = `overlay-fill-layer-${sourceName}`;
136-
const lineLayerKey = `overlay-line-layer-${sourceName}`;
135+
const fillLayerKey = `overlay-fill-layer-${sourceLayer}`;
136+
const lineLayerKey = `overlay-line-layer-${sourceLayer}`;
137137

138138
return (
139139
<MapSource

app/utils/query.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ fragment VectorTileServerPropertyFields on ProjectVectorTileServerConfig {
3333
name
3434
openFreeMap {
3535
credits
36-
sourceName
36+
sourceLayer
3737
}
3838
openStreetMap {
3939
credits
40-
sourceName
40+
sourceLayer
4141
}
4242
versatiles {
4343
credits
44-
sourceName
44+
sourceLayer
4545
}
4646
custom {
4747
credits
48-
sourceName
48+
sourceLayer
4949
url
5050
minZoom
5151
maxZoom

app/views/EditProject/UpdateProjectForm/CompletenessProjectSpecifics/OverlayTileServerPropertyInput/OverlayVectorTileConfigInput/VectorTilePreview/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function VectorTilePreview(props: Props) {
3636
zoomLevel,
3737
} = props;
3838

39-
const sourceName = useMemo(() => {
39+
const sourceLayer = useMemo(() => {
4040
if (isNotDefined(vectorTileConfig) || isNotDefined(vectorTileConfig.tileServer)) {
4141
return {};
4242
}
@@ -51,7 +51,7 @@ function VectorTilePreview(props: Props) {
5151
vectorTileServerNameToTileInputKey[name]
5252
];
5353

54-
return tileServer?.sourceName;
54+
return tileServer?.sourceLayer;
5555
}, [vectorTileConfig]);
5656

5757
return (
@@ -71,12 +71,12 @@ function VectorTilePreview(props: Props) {
7171
getLayerName('base-tile-source', 'base-tile-layer', true),
7272
getLayerName(
7373
`overlay-source-${vectorTileConfig?.tileServer?.name}`,
74-
`overlay-fill-layer-${sourceName}`,
74+
`overlay-fill-layer-${sourceLayer}`,
7575
true,
7676
),
7777
getLayerName(
7878
`overlay-source-${vectorTileConfig?.tileServer?.name}`,
79-
`overlay-line-layer-${sourceName}`,
79+
`overlay-line-layer-${sourceLayer}`,
8080
true,
8181
),
8282
]}

app/views/EditProject/UpdateProjectForm/CompletenessProjectSpecifics/OverlayTileServerPropertyInput/OverlayVectorTileConfigInput/VectorTileServerInput/index.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ function VectorTileServerInput(props: Props) {
9393
setFieldValue(
9494
{
9595
credits: tileServerMapping[newValue]?.credits,
96-
sourceName: tileServerMapping[newValue]?.layers?.[0],
96+
sourceLayer: tileServerMapping[newValue]?.layers?.[0],
9797
},
9898
vectorTileServerNameToTileInputKey[newValue],
9999
);
100100
}
101101
}, [setFieldValue, tileServerMapping]);
102102

103-
const sourceNameOptions = useMemo(() => {
103+
const sourceLayerOptions = useMemo(() => {
104104
if (isNotDefined(value?.name) || value.name === VectorTileServerNameEnum.Custom) {
105105
return [];
106106
}
@@ -141,11 +141,11 @@ function VectorTileServerInput(props: Props) {
141141
/>
142142
<SelectInput
143143
label="Source name"
144-
name="sourceName"
145-
value={value[fieldName]?.sourceName}
146-
error={getErrorObject(error?.[fieldName])?.sourceName}
144+
name="sourceLayer"
145+
value={value[fieldName]?.sourceLayer}
146+
error={getErrorObject(error?.[fieldName])?.sourceLayer}
147147
onChange={setCommonTileServerFieldValue}
148-
options={sourceNameOptions}
148+
options={sourceLayerOptions}
149149
keySelector={keySelector}
150150
labelSelector={labelSelector}
151151
/>
@@ -175,10 +175,10 @@ function VectorTileServerInput(props: Props) {
175175
disabled={disabled}
176176
/>
177177
<TextInput
178-
label="Source name"
179-
name="sourceName"
180-
value={value.custom?.sourceName}
181-
error={getErrorObject(error?.[fieldName])?.sourceName}
178+
label="Source layer"
179+
name="sourceLayer"
180+
value={value.custom?.sourceLayer}
181+
error={getErrorObject(error?.[fieldName])?.sourceLayer}
182182
onChange={setCustomTileServerFieldValue}
183183
/>
184184
<NumberInput

app/views/EditProject/UpdateProjectForm/CompletenessProjectSpecifics/OverlayTileServerPropertyInput/OverlayVectorTileConfigInput/VectorTileServerInput/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const vectorTileServerFormSchema: VectorTileServerFormSchema = {
8989
...defaultVectorTileServerFieldsSchema,
9090
[key]: {
9191
fields: (): ReturnType<CustomVectorTileServerConfigSchema['fields']> => ({
92-
sourceName: {
92+
sourceLayer: {
9393
required: true,
9494
},
9595
url: {
@@ -109,7 +109,7 @@ const vectorTileServerFormSchema: VectorTileServerFormSchema = {
109109
...defaultVectorTileServerFieldsSchema,
110110
[key]: {
111111
fields: (): ReturnType<CommonVectorTileServerConfigSchema['fields']> => ({
112-
sourceName: {
112+
sourceLayer: {
113113
required: true,
114114
},
115115
credits: {},

0 commit comments

Comments
 (0)