Skip to content

Commit

Permalink
Merge pull request #274 from Strong-Potato/248-fix-vote-slide
Browse files Browse the repository at this point in the history
Fix: detail link
  • Loading branch information
Yamyam-code authored Jan 28, 2024
2 parents eaa1ecb + 157376c commit 4828bc5
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
10 changes: 10 additions & 0 deletions src/assets/homeIcons/search/favoriteNull.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions src/components/SearchFromHome/SearchList/SearchItem/SearchItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Link} from 'react-router-dom';
import {Link, useSearchParams} from 'react-router-dom';

import styles from './SearchItem.module.scss';

Expand All @@ -22,9 +22,18 @@ function SearchItem({forSearch, data, categoryChange}: PropsType) {
const location = areas.filter((area) => area.areaCode === data.location.areaCode)[0].name;
const category = translateCategoryToStr(data.contentTypeId);
const imgSrc = data.thumbnail ? data.thumbnail : nullImg;
const [searchPrams] = useSearchParams();
const tripId = searchPrams.get('placeID');
const journyId = searchPrams.get('tripDate')?.split(' ')[1];
const path = searchPrams.get('tripDate')?.split(' ')[0];
const detailLink =
path === 'trip'
? `/detail/${data.id} ${data.contentTypeId}?title=${data.title}&tripId=${tripId}&journyId=${journyId}`
: `/detail/${data.id} ${data.contentTypeId}?title=${data.title}`;
console.log(path);

return (
<Link to={`/detail/${data.id} ${data.contentTypeId}?title=${data.title}`} className={styles.container}>
<Link to={detailLink} className={styles.container}>
<div className={styles.itemBox}>
<img
src={imgSrc}
Expand Down
4 changes: 3 additions & 1 deletion src/components/SearchFromHome/SearchList/SearchList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ function SearchList({forSearch}: PropsType) {
<span>검색 결과가 없습니다.</span>
</div>
)}
{filterData && filterData?.length > 0 && !isEnd && <ObserveTarget inViewRef={inViewRef} />}
{filterData && filterData?.length > 0 && !isEnd && forSearch.category === 0 && (
<ObserveTarget inViewRef={inViewRef} />
)}
</ul>
{forSearch.placeID !== 'undefined' ? (
<AddToCandidateButton />
Expand Down
12 changes: 10 additions & 2 deletions src/components/WishItem/WishItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Link} from 'react-router-dom';
import {Link, useSearchParams} from 'react-router-dom';

import styles from './WishItem.module.scss';

Expand All @@ -25,9 +25,17 @@ function WishItem({filter, data, categoryChange}: PropsType) {
const location = areas.filter((area) => area.areaCode === data.location.areaCode)[0].name;
const category = translateCategoryToStr(data.contentTypeId);
const imgSrc = data.thumbnail ? data.thumbnail : nullImg;
const [searchPrams] = useSearchParams();
const tripId = searchPrams.get('placeID');
const journyId = searchPrams.get('tripDate')?.split(' ')[1];
const path = searchPrams.get('tripDate')?.split(' ')[0];
const detailLink =
path === 'trip'
? `/detail/${data.id} ${data.contentTypeId}?title=${data.title}&tripId=${tripId}&journyId=${journyId}`
: `/detail/${data.id} ${data.contentTypeId}?title=${data.title}`;

return (
<Link to={`/detail/${data.id} ${data.contentTypeId}?title=${data.title}`} className={styles.container}>
<Link to={detailLink} className={styles.container}>
<div className={styles.itemBox}>
<img
src={imgSrc}
Expand Down
6 changes: 0 additions & 6 deletions src/pages/SearchFromHome/SearchFromHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ function SearchFromHome() {
querystring.hot
) {
if (!querystring.placeID && !querystring.tripDate) {
console.log(1);

setForSearch({
keyword: querystring.keyword === '없음' ? '' : querystring.keyword,
category: parseInt(querystring.category),
Expand All @@ -58,8 +56,6 @@ function SearchFromHome() {
});
}
if (querystring.placeID && !querystring.tripDate) {
console.log(2);

setForSearch({
keyword: querystring.keyword === '없음' ? '' : querystring.keyword,
category: parseInt(querystring.category),
Expand All @@ -72,8 +68,6 @@ function SearchFromHome() {
});
}
if (querystring.placeID && querystring.tripDate) {
console.log(3);

setForSearch({
keyword: querystring.keyword === '없음' ? '' : querystring.keyword,
category: parseInt(querystring.category),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Wishes/Wishes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Tabs from '@/components/SearchFromHome/SearchList/Tabs/Tabs';
import WishesHeader from '@/components/WishItem/WishesHeader/WishesHeader';

import {getUserWishes} from '@/api/wishes';
import SearchNull from '@/assets/homeIcons/search/searchNull.svg?react';
import SearchNull from '@/assets/homeIcons/search/favoriteNull.svg?react';
import {translateLocation} from '@/utils/translateSearchData';

import WishItem from '../../components/WishItem/WishItem';
Expand Down

0 comments on commit 4828bc5

Please sign in to comment.