diff --git a/.travis.yml b/.travis.yml index e18683c5..37c77dce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,6 +53,7 @@ jobs: echo 'Back directory not change' travis_terminate 0 fi + - cd server install: - yarn install script: diff --git a/client/package.json b/client/package.json index 49493920..01babe05 100644 --- a/client/package.json +++ b/client/package.json @@ -8,12 +8,14 @@ "!src/index.js" ] }, + "proxy": "http://api.vworld.kr", "dependencies": { "@fortawesome/fontawesome-svg-core": "^1.2.25", "@fortawesome/free-solid-svg-icons": "^5.11.2", "@fortawesome/react-fontawesome": "^0.1.7", "axios": "^0.19.0", "enzyme-to-json": "^3.4.3", + "load-js": "^3.0.3", "moment": "^2.24.0", "node-sass": "^4.13.0", "prop-types": "^15.7.2", diff --git a/client/src/components/match/MatchMap/index.jsx b/client/src/components/match/MatchMap/index.jsx index 73e68df3..59884d61 100644 --- a/client/src/components/match/MatchMap/index.jsx +++ b/client/src/components/match/MatchMap/index.jsx @@ -1,8 +1,152 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; +import loadJs from 'load-js'; +import axios from 'axios'; import './index.scss'; +const SEOUL_KOREAN = '서울'; +const SEOUL_DISTRICT_CNT = '25'; +const SEOUL_DISTRICT_REQUEST_URL = `/req/data?request=GetFeature&key=${process.env.REACT_APP_MAP_DISTRICT_KEY}&size=${SEOUL_DISTRICT_CNT}&data=LT_C_ADSIGG_INFO&attrfilter=full_nm:like:${SEOUL_KOREAN}&domain=${process.env.REACT_APP_DOMAIN}`; + +const NAVER_MAP_API_REQUEST_URL = `https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=${process.env.REACT_APP_NCP_CLIENT_ID}`; + const MatchMap = () => { - return
이거슨 맵입니다
; + const [seoulDistrictData, setSeoulDistrictData] = useState(); + const [naverMapData, setNaverMapData] = useState(); + + // data 요청 + useEffect(() => { + const fetchDatas = async () => { + await loadJs(NAVER_MAP_API_REQUEST_URL); + setNaverMapData(window.naver.maps); + const seoulDistrictResponse = await axios(SEOUL_DISTRICT_REQUEST_URL); + setSeoulDistrictData( + seoulDistrictResponse.data.response.result.featureCollection.features + ); + }; + fetchDatas(); + return () => { + setSeoulDistrictData(undefined); + setNaverMapData(undefined); + }; + }, []); + + return ( +
+ {naverMapData && seoulDistrictData ? ( + + ) : ( + 지도 로딩중!!!! + )} +
+ ); }; +const SEOUL = { + SOUTH_WEST: { + LAT: 37.426999, + LNG: 126.764166, + }, + NORTH_EAST: { + LAT: 37.703238, + LNG: 127.179192, + }, + CENTER: { + LAT: 37.553738, + LNG: 126.986409, + }, +}; + +const NaverMap = (props) => { + /* eslint react/prop-types: 0 */ + const { naverMap, districtData } = props; + const [seoulCoord, setSeoulCoord] = useState( + new naverMap.LatLngBounds( + new naverMap.LatLng(SEOUL.SOUTH_WEST.LAT, SEOUL.SOUTH_WEST.LNG), + new naverMap.LatLng(SEOUL.NORTH_EAST.LAT, SEOUL.NORTH_EAST.LNG) + ) + ); + const [map, setMap] = useState(); + + const mapOptions = { + useStyleMap: true, + zoom: 11, + minZoom: 11, + maxZoom: 16, + zoomControl: true, + zoomControlOptions: { + style: naverMap.ZoomControlStyle.SMALL, + }, + center: new naverMap.LatLng(SEOUL.CENTER.LAT, SEOUL.CENTER.LNG), + maxBounds: seoulCoord, + mapTypes: new naverMap.MapTypeRegistry({ + normal: naverMap.NaverStyleMapTypeOption.getVectorMap(), + label: naverMap.NaverStyleMapTypeOption.getNormalMap(), + }), + }; + + const createNaverMap = () => { + return new naverMap.Map('map', mapOptions); + }; + + const naverMapStyleConfigObj = { + fillColor: '#000000', + fillOpacity: 0, + strokeColor: '#272A51', + strokeWeight: 2, + strokeOpacity: 1, + clickable: true, + zIndex: 1, + }; + + useEffect(() => { + const maps = createNaverMap(); + naverMap.Event.addListener(maps, 'zoom_changed', (zoom) => { + const label = new naverMap.Layer('label', maps.mapTypes.label); + const normal = new naverMap.Layer('normal', maps.mapTypes.normal); + if (zoom >= 13) { + label.setMap(maps); + naverMapStyleConfigObj.clickable = false; + maps.data.setStyle(naverMapStyleConfigObj); + return; + } + normal.setMap(maps); + naverMapStyleConfigObj.clickable = true; + maps.data.setStyle(naverMapStyleConfigObj); + }); + + const seoulDistricts = districtData; + seoulDistricts.forEach((district) => { + maps.data.addGeoJson(district); + maps.data.setStyle(naverMapStyleConfigObj); + }); + + maps.data.addListener('mouseover', (e) => { + maps.data.overrideStyle(e.feature, { + fillOpacity: 0.6, + strokeOpacity: 0.6, + strokeWeight: 20, + strokeColor: '#71ACAD', + fillColor: '#71ACAD', + zIndex: 2, + }); + }); + + maps.data.addListener('mouseout', () => { + maps.data.revertStyle(); + }); + + maps.data.addListener('click', (e) => { + const selectedDistrict = e.feature.getBounds(); + if (selectedDistrict) { + maps.panToBounds(selectedDistrict); + } + }); + }, [map, seoulCoord]); + + return ( +
+
+
+ ); +} export default MatchMap; diff --git a/client/src/components/match/MatchMap/index.scss b/client/src/components/match/MatchMap/index.scss index 4cc365b0..cc8e519f 100644 --- a/client/src/components/match/MatchMap/index.scss +++ b/client/src/components/match/MatchMap/index.scss @@ -1,3 +1,8 @@ .match-map { - border: 1px dotted green; + .naver-map-container { + #map { + width: 100%; + height: 400px; + } + } } diff --git a/client/yarn.lock b/client/yarn.lock index 7d586a40..906cf4d9 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -2077,6 +2077,21 @@ axios@^0.19.0: follow-redirects "1.5.10" is-buffer "^2.0.2" +axios-mock-adapter@^1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/axios-mock-adapter/-/axios-mock-adapter-1.17.0.tgz#0dbee43c606d4aaba5a43d88d96d6661a7cc3c04" + integrity sha512-q3efmwJUOO4g+wsLNSk9Ps1UlJoF3fQ3FSEe4uEEhkRtu7SoiAVPj8R3Hc/WP55MBTVFzaDP9QkdJhdVhP8A1Q== + dependencies: + deep-equal "^1.0.1" + +axios@^0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8" + integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ== + dependencies: + follow-redirects "1.5.10" + is-buffer "^2.0.2" + axobject-query@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9" @@ -3397,7 +3412,11 @@ debug@=3.1.0: dependencies: ms "2.0.0" +<<<<<<< HEAD +debug@^3.0.0, debug@^3.2.5, debug@^3.2.6: +======= debug@^3.0.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6: +>>>>>>> dcfafae742010a5ec772a7f0b01d9693a9b99db5 version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -3845,6 +3864,39 @@ es-abstract@^1.12.0, es-abstract@^1.13.0, es-abstract@^1.15.0, es-abstract@^1.5. string.prototype.trimleft "^2.1.0" string.prototype.trimright "^2.1.0" +<<<<<<< HEAD +es-abstract@^1.13.0, es-abstract@^1.15.0: + version "1.16.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.2.tgz#4e874331645e9925edef141e74fc4bd144669d34" + integrity sha512-jYo/J8XU2emLXl3OLwfwtuFfuF2w6DYPs+xy9ZfVyPkDcrauu6LYrw/q2TyCtrbc/KUdCiC5e9UajRhgNkVopA== + dependencies: + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-inspect "^1.7.0" + object-keys "^1.1.1" + string.prototype.trimleft "^2.1.0" + string.prototype.trimright "^2.1.0" + +es-to-primitive@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" + integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== +======= +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== +>>>>>>> dcfafae742010a5ec772a7f0b01d9693a9b99db5 + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + +<<<<<<< HEAD es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" @@ -3854,10 +3906,16 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +es5-ext@^0.10.35, es5-ext@^0.10.50, es5-ext@^0.10.51: + version "0.10.51" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.51.tgz#ed2d7d9d48a12df86e0299287e93a09ff478842f" + integrity sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ== +======= es5-ext@^0.10.35, es5-ext@^0.10.50: version "0.10.53" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== +>>>>>>> dcfafae742010a5ec772a7f0b01d9693a9b99db5 dependencies: es6-iterator "~2.0.3" es6-symbol "~3.1.3" @@ -4798,6 +4856,14 @@ global-cache@^1.2.1: define-properties "^1.1.2" is-symbol "^1.0.1" +global-cache@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/global-cache/-/global-cache-1.2.1.tgz#39ca020d3dd7b3f0934c52b75363f8d53312c16d" + integrity sha512-EOeUaup5DgWKlCMhA9YFqNRIlZwoxt731jCh47WBV9fQqHgXhr3Fa55hfgIUqilIcPsfdNKN7LHjrNY+Km40KA== + dependencies: + define-properties "^1.1.2" + is-symbol "^1.0.1" + global-modules@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" @@ -4933,6 +4999,11 @@ has-symbols@^1.0.0, has-symbols@^1.0.1: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== +has-symbols@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -5682,10 +5753,24 @@ is-svg@^3.0.0: dependencies: html-comment-regex "^1.1.0" +<<<<<<< HEAD +is-symbol@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== + dependencies: + has-symbols "^1.0.1" + +is-symbol@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== +======= is-symbol@^1.0.1, is-symbol@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== +>>>>>>> dcfafae742010a5ec772a7f0b01d9693a9b99db5 dependencies: has-symbols "^1.0.1" @@ -5694,6 +5779,11 @@ is-touch-device@^1.0.1: resolved "https://registry.yarnpkg.com/is-touch-device/-/is-touch-device-1.0.1.tgz#9a2fd59f689e9a9bf6ae9a86924c4ba805a42eab" integrity sha512-LAYzo9kMT1b2p19L/1ATGt2XcSilnzNlyvq6c0pbPRVisLbAPpLqr53tIJS00kvrTkj0HtR8U7+u8X0yR8lPSw== +is-touch-device@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-touch-device/-/is-touch-device-1.0.1.tgz#9a2fd59f689e9a9bf6ae9a86924c4ba805a42eab" + integrity sha512-LAYzo9kMT1b2p19L/1ATGt2XcSilnzNlyvq6c0pbPRVisLbAPpLqr53tIJS00kvrTkj0HtR8U7+u8X0yR8lPSw== + is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -6445,6 +6535,11 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +load-js@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/load-js/-/load-js-3.0.3.tgz#9a5dd937de72fa789a0e696f7e917ecfe970de8a" + integrity sha512-y1Iqt5vikLPrI9xJHV3gK6TKDvGdJQPHjejJgP4BmS7wx4oo45+IMvnAT9jY8quL9NGtt0WlTuLq1pw7WuODYA== + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -7281,6 +7376,11 @@ object-inspect@^1.7.0: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== +object-inspect@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" + integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== + object-is@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6" @@ -8812,7 +8912,11 @@ react-error-overlay@^6.0.3: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.3.tgz#c378c4b0a21e88b2e159a3e62b2f531fd63bf60d" integrity sha512-bOUvMWFQVk5oz8Ded9Xb7WVdEi3QGLC8tH7HmYP0Fdp4Bn3qw0tRFmr5TW6mvahzvmrK4a6bqWGfCevBflP+Xw== +<<<<<<< HEAD +react-is@^16.6.0, react-is@^16.7.0, react-is@^16.9.0: +======= react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0: +>>>>>>> dcfafae742010a5ec772a7f0b01d9693a9b99db5 version "16.12.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== @@ -8842,6 +8946,31 @@ react-portal@^4.2.0: dependencies: prop-types "^15.5.8" +react-moment-proptypes@^1.6.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/react-moment-proptypes/-/react-moment-proptypes-1.7.0.tgz#89881479840a76c13574a86e3bb214c4ba564e7a" + integrity sha512-ZbOn/P4u469WEGAw5hgkS/E+g1YZqdves2BjYsLluJobzUZCtManhjHiZKjniBVT7MSHM6D/iKtRVzlXVv3ikA== + dependencies: + moment ">=1.6.0" + +react-outside-click-handler@^1.2.4: + version "1.3.0" + resolved "https://registry.yarnpkg.com/react-outside-click-handler/-/react-outside-click-handler-1.3.0.tgz#3831d541ac059deecd38ec5423f81e80ad60e115" + integrity sha512-Te/7zFU0oHpAnctl//pP3hEAeobfeHMyygHB8MnjP6sX5OR8KHT1G3jmLsV3U9RnIYo+Yn+peJYWu+D5tUS8qQ== + dependencies: + airbnb-prop-types "^2.15.0" + consolidated-events "^1.1.1 || ^2.0.0" + document.contains "^1.0.1" + object.values "^1.1.0" + prop-types "^15.7.2" + +react-portal@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/react-portal/-/react-portal-4.2.0.tgz#5400831cdb0ae64dccb8128121cf076089ab1afd" + integrity sha512-Zf+vGQ/VEAb5XAy+muKEn48yhdCNYPZaB1BWg1xc8sAZWD8pXTgPtQT4ihBdmWzsfCq8p8/kqf0GWydSBqc+Eg== + dependencies: + prop-types "^15.5.8" + react-router-dom@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.1.2.tgz#06701b834352f44d37fbb6311f870f84c76b9c18" diff --git a/server/.env.enc b/server/.env.enc deleted file mode 100644 index 8590253d..00000000 Binary files a/server/.env.enc and /dev/null differ diff --git a/server/test.txt b/server/test.txt deleted file mode 100644 index 0405909b..00000000 --- a/server/test.txt +++ /dev/null @@ -1 +0,0 @@ -pr test 입니다. \ No newline at end of file