From f025cd5d7348e16b35db2b79235e4f47111732c2 Mon Sep 17 00:00:00 2001 From: Sanghyeon Sim <5338095@gmail.com> Date: Sat, 2 Sep 2023 08:44:58 +0900 Subject: [PATCH] fix: make output clear --- source/Output.js | 6 +++--- source/Search.js | 6 +++++- source/SearchContainer.js | 1 - source/component/ListShop.js | 1 - source/component/ShopDetail.js | 6 ------ source/component/ShopPost.js | 13 ++++++++----- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source/Output.js b/source/Output.js index 5bbe855..e2f6d86 100644 --- a/source/Output.js +++ b/source/Output.js @@ -10,8 +10,8 @@ const Output = ({list}) => { const check = /[ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/; return ( - {list.map(item => ( - <> + {list.map((item, index) => ( + $ {item[1]} {item[1] === 'ls' ? ( @@ -21,7 +21,7 @@ const Output = ({list}) => { ) : ( {item[0][0]} )} - + ))} ); diff --git a/source/Search.js b/source/Search.js index 12e870d..a515d1d 100644 --- a/source/Search.js +++ b/source/Search.js @@ -75,8 +75,12 @@ const Search = ({setlist, setStation, setId, setStoreName, setSingleShop}) => { } if (search.startsWith('vi ')) { let storeId = search.slice(3, search.length); - setlist(list => [...list, [[], search]]); getSinglePlaceCheck(storeId).then(res => { + if (res.data['statusCode'] == 404) { + setlist(list => [...list, [["해당하는 가게가 없습니다."], search]]); + setId(0); + return; + } setSingleShop(res.data.body); getReviewCheck(storeId).then(res => { setSingleShop(data => ({...data, reviews: res.data.body})); diff --git a/source/SearchContainer.js b/source/SearchContainer.js index 4cc20cf..88d2c84 100644 --- a/source/SearchContainer.js +++ b/source/SearchContainer.js @@ -25,7 +25,6 @@ const SearchContainer = ({userId}) => { ) /* vi 창 들어기서 Id 값 다시 초기화 해줘야함.!*/ } - {/* {aaa ? : ''} */} {station ? ( // 타이핑된 역의 이름이 없을 경우, 입력 창 유지, 입력했을시, 맛집, 액티비티, 선택창 나옴. { {endMessage ? '더 이상 불러올 리스트가 없습니다' : ''} - Commands diff --git a/source/component/ShopDetail.js b/source/component/ShopDetail.js index eec2681..5dd60b9 100644 --- a/source/component/ShopDetail.js +++ b/source/component/ShopDetail.js @@ -25,15 +25,10 @@ const ShopDetail = ({id, setId, userId, singleShop}) => { setIsAddReview(true); } if (command === ':lm') { - // TODO : load more reviews setReviewlist([ ...reviewlist, ...singleShop.reviews.slice(reviewlist.length, reviewlist.length + 1), ]); - - if (reviewlist.length === singleShop.reviews.length) { - setEndMessage(true); - } } // handle invalid command setCommand(''); @@ -188,7 +183,6 @@ const ShopView = ({data, reviewlist, endMessage}) => { ))} - {endMessage ? '더 이상 리뷰가 없어욧!' : ''} {']'} diff --git a/source/component/ShopPost.js b/source/component/ShopPost.js index 022faa7..8a25348 100644 --- a/source/component/ShopPost.js +++ b/source/component/ShopPost.js @@ -264,11 +264,14 @@ const ShopPost = ({userId, category, setStoreName}) => { // 메뉴 추가 const addMenu = () => { - setMenuList([...menuList, {name: menuName, price: menuPrice}]); - setMenuName(''); // 입력 필드 초기화 - setMenuPrice(0); // 입력 필드 초기화 - setFocus(0); // 포커스 초기화 - }; + setMenuList([ + ...menuList, + {name: menuName.split('\\')[0].trim(), price: menuPrice}, + ]); + setMenuName(''); // 입력 필드 초기화 + setMenuPrice(0); // 입력 필드 초기화 + setFocus(0); // 포커스 초기화 + }; const searchKakaoShops = async () => { if (!shopTitle.length) {