From 80b459e1e352f1770702cc3527a8795063ab64d2 Mon Sep 17 00:00:00 2001 From: Sanghyeon Sim <5338095@gmail.com> Date: Sat, 2 Sep 2023 10:24:12 +0900 Subject: [PATCH] chore: version 1.0.0 --- package-lock.json | 139 ++++++++++++++++++++++++++++----- package.json | 6 +- source/Search.js | 2 +- source/api/remote.js | 4 +- source/component/EachShop.js | 25 +++--- source/component/ShopDetail.js | 39 ++++----- source/component/ShopPost.js | 1 - 7 files changed, 153 insertions(+), 63 deletions(-) diff --git a/package-lock.json b/package-lock.json index 423f33d..f35f5f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,18 @@ { "name": "up-d4te", - "version": "0.0.13", + "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "up-d4te", - "version": "0.0.13", + "version": "1.0.0", "license": "MIT", "dependencies": { "axios": "1.4.0", "dotenv": "16.3.1", "ink": "4.1.0", + "ink-link": "^3.0.0", "ink-text-input": "5.0.1", "meow": "11.0.0", "mobx": "6.9.0", @@ -2898,8 +2899,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "peer": true, "engines": { "node": ">=8" } @@ -3120,6 +3119,24 @@ } } }, + "node_modules/ink-link": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ink-link/-/ink-link-3.0.0.tgz", + "integrity": "sha512-S8jbyJQhYluCYn+O2dZ9I+Ts0OfpuXmRVJ3qNU+L4XCQEE2k4Vb0dO1Wu/QsArEXabQK7Q/DLtZ1ozLVBNGypQ==", + "dependencies": { + "prop-types": "^15.8.1", + "terminal-link": "^3.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + }, + "peerDependencies": { + "ink": ">=4" + } + }, "node_modules/ink-testing-library": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ink-testing-library/-/ink-testing-library-3.0.0.tgz", @@ -4019,7 +4036,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -4637,7 +4653,6 @@ "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "dev": true, "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", @@ -4704,8 +4719,7 @@ "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/react-reconciler": { "version": "0.29.0", @@ -5412,8 +5426,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "peer": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -5421,6 +5433,18 @@ "node": ">=8" } }, + "node_modules/supports-hyperlinks": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -5442,6 +5466,46 @@ "node": ">=14.16" } }, + "node_modules/terminal-link": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-3.0.0.tgz", + "integrity": "sha512-flFL3m4wuixmf6IfhFJd1YPiLiMuxEc8uHRM1buzIeZPm22Au2pDqBJQgdo7n1WfPU1ONFGv7YDwpFBmHGF6lg==", + "dependencies": { + "ansi-escapes": "^5.0.0", + "supports-hyperlinks": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/terminal-link/node_modules/ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "dependencies": { + "type-fest": "^1.0.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/terminal-link/node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -7897,9 +7961,7 @@ "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "peer": true + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "has-property-descriptors": { "version": "1.0.0", @@ -8059,6 +8121,15 @@ } } }, + "ink-link": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ink-link/-/ink-link-3.0.0.tgz", + "integrity": "sha512-S8jbyJQhYluCYn+O2dZ9I+Ts0OfpuXmRVJ3qNU+L4XCQEE2k4Vb0dO1Wu/QsArEXabQK7Q/DLtZ1ozLVBNGypQ==", + "requires": { + "prop-types": "^15.8.1", + "terminal-link": "^3.0.0" + } + }, "ink-testing-library": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ink-testing-library/-/ink-testing-library-3.0.0.tgz", @@ -8678,8 +8749,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" }, "object-inspect": { "version": "1.12.3", @@ -9083,7 +9153,6 @@ "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "dev": true, "requires": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", @@ -9124,8 +9193,7 @@ "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "react-reconciler": { "version": "0.29.0", @@ -9616,12 +9684,19 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "peer": true, "requires": { "has-flag": "^4.0.0" } }, + "supports-hyperlinks": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "requires": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + } + }, "supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -9634,6 +9709,30 @@ "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", "dev": true }, + "terminal-link": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-3.0.0.tgz", + "integrity": "sha512-flFL3m4wuixmf6IfhFJd1YPiLiMuxEc8uHRM1buzIeZPm22Au2pDqBJQgdo7n1WfPU1ONFGv7YDwpFBmHGF6lg==", + "requires": { + "ansi-escapes": "^5.0.0", + "supports-hyperlinks": "^2.2.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "requires": { + "type-fest": "^1.0.2" + } + }, + "type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==" + } + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", diff --git a/package.json b/package.json index 8182f3e..2573ca5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "up-d4te", - "version": "0.0.15", + "version": "1.0.0", "description": "Recommend Dating Course in Korea with CLI", "author": { "name": "Sanghyeon Sim", @@ -40,8 +40,8 @@ "ink-text-input": "5.0.1", "meow": "11.0.0", "mobx": "6.9.0", - "react": "18.2.0", - "prettier": "3.0.1" + "prettier": "3.0.1", + "react": "18.2.0" }, "devDependencies": { "@babel/cli": "^7.21.0", diff --git a/source/Search.js b/source/Search.js index 916d314..9fede16 100644 --- a/source/Search.js +++ b/source/Search.js @@ -82,7 +82,7 @@ const Search = ({setlist, setStation, setId, setStoreName, setSingleShop}) => { return; } setSingleShop(res.data.body); - getReviewCheck(storeId).then(res => { + getReviewCheck(storeId, 1).then(res => { setSingleShop(data => ({...data, reviews: res.data.body})); setId(storeId); }); diff --git a/source/api/remote.js b/source/api/remote.js index b9eeb2a..26987e5 100644 --- a/source/api/remote.js +++ b/source/api/remote.js @@ -9,8 +9,8 @@ const getAllPlaceCheck = (page, station) => const getSinglePlaceCheck = placeId => UpdateAxios.get(`/place/${placeId}`); -const getReviewCheck = placeId => - UpdateAxios.get(`/review/place/${placeId}?page=1`); +const getReviewCheck = (placeId, page) => + UpdateAxios.get(`/review/place/${placeId}?page=${page}`); const postShop = ( userId, diff --git a/source/component/EachShop.js b/source/component/EachShop.js index f41b055..8314ab3 100644 --- a/source/component/EachShop.js +++ b/source/component/EachShop.js @@ -24,19 +24,22 @@ const EachShop = ({data, key, isEnd}) => { - "menu" : {'['} - + "menu" : {data.menu ? ( - data.menu.map((item, index, array) => ( - - {' '} - {'{'} "{item.menuName}" : {item.menuPrice} {'}'} - {index !== array.length - 1 ? ',' : ''} - - - )) + + {'['} + + {data.menu.map((item, index, array) => ( + + {' '} + {'{'} "{item.menuName}" : {item.menuPrice} {'}'} + {index !== array.length - 1 ? ',' : ''} + + + ))} + ) : ( - 메뉴가 없습니다. + '[' )} {']'}, diff --git a/source/component/ShopDetail.js b/source/component/ShopDetail.js index 5dd60b9..20e60be 100644 --- a/source/component/ShopDetail.js +++ b/source/component/ShopDetail.js @@ -3,13 +3,15 @@ import {Text, Newline, Box, useInput} from 'ink'; import TextInput from 'ink-text-input'; import theme from '../Theme.js'; import {postReview} from '../api/remote.js'; +import {getReviewCheck} from '../api/remote.js'; const ShopDetail = ({id, setId, userId, singleShop}) => { const [data, setData] = useState(singleShop); - const [reviewlist, setReviewlist] = useState(singleShop.reviews.slice(0, 3)); + const [page, setPage] = useState(1); + + const [reviewlist, setReviewlist] = useState(singleShop.reviews); const [command, setCommand] = useState(''); - const [endMessage, setEndMessage] = useState(false); const [isAddReview, setIsAddReview] = useState(false); const [content, setContent] = useState(''); @@ -21,14 +23,13 @@ const ShopDetail = ({id, setId, userId, singleShop}) => { return; } if (command === ':ar') { - // TODO : add review setIsAddReview(true); } if (command === ':lm') { - setReviewlist([ - ...reviewlist, - ...singleShop.reviews.slice(reviewlist.length, reviewlist.length + 1), - ]); + getReviewCheck(singleShop.id, page + 1).then(res => { + setReviewlist([...reviewlist, ...res.data.body]); + setPage(page + 1); + }); } // handle invalid command setCommand(''); @@ -45,18 +46,7 @@ const ShopDetail = ({id, setId, userId, singleShop}) => { }); const onReivewSubmit = () => { - // TODO : add review - postReview(userId, id, content, star); - // const updatedReviews = [ - // ...data.reviews, - // { - // userId: userId, - // content: content, - // star: star, - // }, - // ]; - // setData({...data, reviews: updatedReviews}); setReviewlist([ ...reviewlist, { @@ -74,11 +64,7 @@ const ShopDetail = ({id, setId, userId, singleShop}) => { <> {!isAddReview ? ( <> - + Commands :q - quit @@ -123,7 +109,7 @@ const ShopDetail = ({id, setId, userId, singleShop}) => { ); }; -const ShopView = ({data, reviewlist, endMessage}) => { +const ShopView = ({data, reviewlist}) => { const starRateString = '⭐'.repeat(Math.round(data.averageStar)); return ( @@ -137,7 +123,10 @@ const ShopView = ({data, reviewlist, endMessage}) => { "name" : "{data.name}", - "location" : "{data.location}", + "location" : "{data.location}", + + + "storeUrl" : "{data.url}", "nearStation" : "{data.station}", diff --git a/source/component/ShopPost.js b/source/component/ShopPost.js index f3714bc..d2b4b87 100644 --- a/source/component/ShopPost.js +++ b/source/component/ShopPost.js @@ -432,7 +432,6 @@ const ShopPost = ({userId, category, setStoreName}) => { ) : ( - //TODO : 수정 컴포넌트 새로 빼기 {menuList.map((menu, index) => (