Skip to content

Commit

Permalink
๐Ÿ› Fix: ์ง€์—ญ ์ •๋ณด ๋ชจ๋‹ฌ์— ๊ธ€ํƒ€๋ž˜ "์ „์ฒด" ์กฐํšŒ ์ถ”๊ฐ€ (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
SoRaang committed Dec 6, 2024
1 parent 9ecf08a commit 91792f7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/api/threadApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const getThreadList = async () => {
const response = await axios({
method: 'get',
url: `${baseURL}/threads`,
withCredentials: true,
});

return response.data;
Expand Down
28 changes: 21 additions & 7 deletions src/components/layout/AreaInfoPanel.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { useQuery } from '@tanstack/react-query';
import Remix from '../common/Remix';
import EmptyList from '../common/EmptyList';
import dateFormat from '../../utils/dateFormat';
import { getThreadList } from '../../api/threadApi';
import tempTown from '../../datas/temp-area-information.json'; // ์ž„์‹œ ์ง€์—ญ ๋ฐ์ดํ„ฐ

const AreaThreadArticle = ({ articleObject }) => {
// ์ง€์—ญ ๊ธ€ํƒ€๋ž˜ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์•„์ดํ…œ (๋‚ด์žฅ ์ปดํฌ๋„ŒํŠธ)
return (
<li className="area-thread-item">
<div className="area-thread-item-image-wrapper">
{articleObject.images ? (
{articleObject.threadImages.length > 0 ? (
<img
src={articleObject.previewImage}
src={articleObject.threadImages[0].imageSrc}
alt="๊ธ€ํƒ€๋ž˜ ์ด๋ฏธ์ง€ ๋ฏธ๋ฆฌ๋ณด๊ธฐ"
/>
) : (
Expand All @@ -20,12 +22,17 @@ const AreaThreadArticle = ({ articleObject }) => {

<dl className="area-thread-item-descriptions">
<dt className="area-thread-item-title">
{articleObject.title}
{articleObject.threadTitle}
</dt>

<dd className="area-thread-item-daterange">
<span>{dateFormat(articleObject.dateBegin)}</span>~
<span>{dateFormat(articleObject.dateEnds)}</span>
<span>
{dateFormat(articleObject.threadAliveRange.begin)}
</span>
~
<span>
{dateFormat(articleObject.threadAliveRange.ends)}
</span>
</dd>
</dl>
</li>
Expand All @@ -41,6 +48,11 @@ const AreaInfoPanel = ({ isAreaInfoShowing, setPanel, currentLocation }) => {
return `${R} ${G} ${B}`;
};

const { isPending, error, data } = useQuery({
queryKey: ['repoData'],
queryFn: () => getThreadList(),
});

return (
<>
<button
Expand Down Expand Up @@ -129,8 +141,10 @@ const AreaInfoPanel = ({ isAreaInfoShowing, setPanel, currentLocation }) => {
</div>

<ul className="area-threads-list">
{tempTown.currentThreads.length > 0 ? (
tempTown.currentThreads.map((item, index) => {
{isPending ? (
<>๋กœ๋”ฉ์ค‘...</>
) : data ? (
data.map((item, index) => {
return (
<AreaThreadArticle
articleObject={item}
Expand Down
8 changes: 4 additions & 4 deletions src/datas/temp-db.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"id": 0,
"threadType": "places",
"threadTitle": "๊ธ€ํƒ€๋ž˜ ์ œ๋ชฉ",
"threadCoverImage": "https://www.naver.com",
"threadCoverImage": "https://picsum.photos/640/480",
"threadAliveRange": {
"isExpiring": true,
"begin": "2024-01-01",
Expand Down Expand Up @@ -121,7 +121,7 @@
"threadImages": [
{
"imageID": 0,
"imageURL": "https://www.naver.com",
"imageURL": "https://picsum.photos/640/480",
"originName": "image",
"originFileType": "jpg",
"imageWidth": 640,
Expand Down Expand Up @@ -198,7 +198,7 @@
"reviewImages": [
{
"imageID": 1,
"imageURL": "https://www.naver.com",
"imageURL": "https://picsum.photos/640/480",
"originName": "image",
"originFileType": "jpg",
"imageWidth": 640,
Expand All @@ -207,7 +207,7 @@
},
{
"imageID": 2,
"imageURL": "https://www.naver.com",
"imageURL": "https://picsum.photos/640/480",
"originName": "image",
"originFileType": "jpg",
"imageWidth": 640,
Expand Down
1 change: 0 additions & 1 deletion src/pages/CommunityPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const CommunityPage = () => {
});

const { isPending, error, data } = useQuery({
queryKey: ['repoData'],
queryFn: () => getThreadList(),
});

Expand Down

0 comments on commit 91792f7

Please sign in to comment.