Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

에러 리스트의 에러들을 해결 #184

Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"start": "NODE_ENV=development react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
Expand Down
1 change: 0 additions & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { combineReducers, createStore } from 'redux';

import map from './map/reducer';
import {
poiReducer as poi,
Expand Down
9 changes: 5 additions & 4 deletions src/store/style/manageCategories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ export const combineElement = ({
elements.forEach((element) => {
if (update[element]) {
switch (element) {
case ElementNameType.labelIcon:
combineStyle({
style: update[element] as StyleActionPayload,
defaultStyle: elementStyle[element] as StyleType,
case ElementNameType.labelIcon: {
update[element] = combineStyle({
style: elementStyle[element] as StyleActionPayload,
defaultStyle: update[element] as StyleType,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제가 조건문 추가하다가 실수가 있었나보네요~

});
break;
}
case ElementNameType.section:
case ElementNameType.labelText:
update[element] = combineSubElement({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/map-styling/road.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function roadStyling({
map,
layerNames: outsideLayerNames,
type: ColorType.fill,
color: '#ffffff',
color: style.color,
[key]: style[key as StyleKeyType],
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/rendering-data/defaultStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const defaultStyle: DefaultWholeStyle = {
country: {
section: {
fill: { color: 'transparent', weight: 0 },
stroke: { color: 'hsl(230, 8%, 51%)', weight: 0 },
stroke: { color: 'hsl(230, 8%, 51%)', weight: 7 },
},
labelText: {
fill: { color: 'hsl(0, 0%, 0%)', weight: 0 },
Expand All @@ -154,7 +154,7 @@ const defaultStyle: DefaultWholeStyle = {
state: {
section: {
fill: { color: 'transparent', weight: 0 },
stroke: { color: 'hsl(230, 14%, 77%)', weight: 0 },
stroke: { color: 'hsl(230, 14%, 77%)', weight: 7 },
},
labelText: {
fill: { color: 'hsl(0, 0%, 0%)', weight: 0 },
Expand Down Expand Up @@ -278,7 +278,7 @@ const defaultStyle: DefaultWholeStyle = {
subway: {
section: {
fill: { color: 'transparent', weight: 0 },
stroke: { color: 'hsl(192, 70%, 43%)', weight: 0 },
stroke: { color: 'hsl(192, 70%, 43%)', weight: 2 },
},
labelText: {
fill: { color: 'transparent', weight: 0 },
Expand Down
2 changes: 1 addition & 1 deletion src/utils/rendering-data/sidebarThemeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const data = [
},
{
src:
'https://i.pinimg.com/originals/8f/6d/97/8f6d971f3d086edaf6cee773991abb27.jpg',
'https://user-images.githubusercontent.com/26402298/102014565-f551c700-3d99-11eb-9817-f71e2dde1772.png',
name: '청사진',
theme: blueprint,
},
Expand Down
42 changes: 37 additions & 5 deletions src/utils/rendering-data/theme/blueprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,24 @@
"fill": { "color": "#405CB0", "saturation": 47, "lightness": 47 }
},
"labelText": {
"fill": { "color": "#405CB0", "saturation": 40, "lightness": 49 }
"fill": {
"visibility": "none",
"color": "#405CB0",
"saturation": 40,
"lightness": 49
}
}
},
"building": { "labelText": { "fill": { "visibility": "none" } } }
"building": {
"section": {
"stroke": {
"color": "#ffffff",
"weight": 2.5,
"saturation": 0,
"lightness": 100
}
}
}
},
"administrative": {
"all": {
Expand All @@ -24,13 +38,23 @@
"all": {
"section": {
"fill": { "color": "#405CB0", "saturation": 47, "lightness": 47 },
"stroke": { "color": "#fafafa", "weight": 0.5, "lightness": 98 }
"stroke": { "color": "#fafafa", "weight": 1.5, "lightness": 98 }
},
"labelText": {
"fill": { "color": "#f7f8fd", "saturation": 60, "lightness": 98 },
"fill": { "color": "#405cb0", "saturation": 47, "lightness": 47 },
"stroke": { "visibility": "none", "color": "#fafafa", "lightness": 98 }
},
"labelIcon": { "visibility": "none" }
},
"local": {
"section": {
"stroke": {
"color": "#ffffff",
"weight": 3.5,
"saturation": 0,
"lightness": 100
}
}
}
},
"transit": {
Expand All @@ -48,5 +72,13 @@
}
}
},
"water": { "all": { "section": { "fill": { "color": "#405CB0" } } } }
"water": {
"all": {
"section": { "fill": { "color": "#405CB0" } },
"labelText": {
"fill": { "color": "#405cb0", "saturation": 47, "lightness": 47 },
"stroke": { "color": "#ffffff", "lightness": 100 }
}
}
}
}
10 changes: 10 additions & 0 deletions src/utils/setFeatureStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function setFeatureStyle({
if (featureState[x].isChanged || !featureState[y].isChanged) return 1;
return -1;
});
const isInit =
subFeatures.findIndex(
(subFeature) => featureState[subFeature].isChanged
) === -1;

for (const subFeature of sortedFeatures) {
const elements = Object.keys(featureState[subFeature]) as ElementNameType[];
Expand All @@ -42,6 +46,7 @@ function setFeatureStyle({
subFeature,
element,
style: elementStyle as StyleType,
isInit,
});
break;
case ElementNameType.labelText:
Expand All @@ -58,6 +63,7 @@ function setFeatureStyle({
style: (elementStyle as SubElementType)[
subElement
] as StyleType,
isInit,
});
});
break;
Expand All @@ -71,6 +77,7 @@ function setFeatureStyle({

interface setElementStyleProps extends ActionPayload {
map: mapboxgl.Map;
isInit: boolean;
}

function setElementStyle({
Expand All @@ -80,9 +87,12 @@ function setElementStyle({
element,
subElement,
style,
isInit,
}: setElementStyleProps): void {
if (!style.isChanged && !isInit) return;
const keys = Object.keys(style) as StyleKeyType[];
keys.forEach((key) => {
if (key === 'lightness' || key === 'saturation') return;
mapStyling[feature]({
map,
subFeature,
Expand Down
5 changes: 4 additions & 1 deletion src/utils/urlParsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ export function jsonToURL({
mapCoordinate,
markers,
}: ExportType): string {
const url = 'http://map-styler.kro.kr/show?';
const url =
process.env.NODE_ENV === 'development'
? 'http://localhost:3000/show?='
: process.env.REACT_APP_DEPLOY_URL;
const styleQueryString = isNotEmptyObject(filteredStyle)
? `style=${encodeURIComponent(
jsonToURLGetStyleQueryString(filteredStyle as URLJsonType)
Expand Down