Skip to content

Commit

Permalink
fix: make output clear
Browse files Browse the repository at this point in the history
  • Loading branch information
halfmoon-mind committed Sep 1, 2023
1 parent e4f5b07 commit f025cd5
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions source/Output.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const Output = ({list}) => {
const check = /[ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/;
return (
<Box marginY={1} flexDirection="column">
{list.map(item => (
<>
{list.map((item, index) => (
<Box key={index} flexDirection="column">
<Text color={theme.purple}>$ {item[1]} </Text>
<Newline />
{item[1] === 'ls' ? (
Expand All @@ -21,7 +21,7 @@ const Output = ({list}) => {
) : (
<Text color={theme.red}>{item[0][0]}</Text>
)}
</>
</Box>
))}
</Box>
);
Expand Down
6 changes: 5 additions & 1 deletion source/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}));
Expand Down
1 change: 0 additions & 1 deletion source/SearchContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const SearchContainer = ({userId}) => {
<Output list={list} />
) /* vi 창 들어기서 Id 값 다시 초기화 해줘야함.!*/
}
{/* {aaa ? <ShopDetail /> : ''} */}
{station ? ( // 타이핑된 역의 이름이 없을 경우, 입력 창 유지, 입력했을시, 맛집, 액티비티, 선택창 나옴.
<StationDetailType
setType={setType}
Expand Down
1 change: 0 additions & 1 deletion source/component/ListShop.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const ListShop = ({shops, setShops, setType}) => {
<Text>{endMessage ? '더 이상 불러올 리스트가 없습니다' : ''}</Text>
<Newline />
<Box flexDirection="column">
<Spacer />
<Text color={theme.red}>
<Newline />
Commands
Expand Down
6 changes: 0 additions & 6 deletions source/component/ShopDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down Expand Up @@ -188,7 +183,6 @@ const ShopView = ({data, reviewlist, endMessage}) => {
))}
</Box>
<Box>
<Text>{endMessage ? '더 이상 리뷰가 없어욧!' : ''}</Text>
<Text>{']'}</Text>
</Box>
</Box>
Expand Down
13 changes: 8 additions & 5 deletions source/component/ShopPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f025cd5

Please sign in to comment.