-
Notifications
You must be signed in to change notification settings - Fork 1
Feat(client): Card meta data 반영 & 카테고리 params 동기화 #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
32fbe3e
d909622
bd88630
c0726ee
8cf47d4
4233f23
7a57d91
d76e565
07c0eb5
8b8385b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { BookmarkArticle } from '@pages/myBookmark/types/api'; | ||
| import { Card } from '@pinback/design-system/ui'; | ||
| import { useGetPageMeta } from '@shared/apis/queries'; | ||
| import React from 'react'; | ||
|
|
||
| interface FetchCardProps { | ||
| article: BookmarkArticle; | ||
| onClick: () => void; | ||
| onOptionsClick?: (e: React.MouseEvent<HTMLButtonElement>) => void; | ||
| } | ||
|
|
||
| const FetchCard = ({ article, onClick, onOptionsClick }: FetchCardProps) => { | ||
| const { data: meta, isPending, isError: error } = useGetPageMeta(article.url); | ||
|
|
||
| if (isPending) { | ||
| return ( | ||
| <div className="bg-gray200 h-[35.6rem] w-[24.8rem] animate-pulse rounded-[1.2rem]" /> | ||
| ); | ||
| } | ||
|
|
||
| const displayTitle = !error && meta.title ? meta.title : '제목 없음'; | ||
| const displayImageUrl = !error ? meta.image : undefined; | ||
|
|
||
| return ( | ||
| <Card | ||
| type="bookmark" | ||
| title={displayTitle} | ||
| imageUrl={displayImageUrl} | ||
| content={article.memo} | ||
| category={article.category.categoryName} | ||
| date={new Date(article.createdAt).toLocaleDateString('ko-KR')} | ||
| onClick={onClick} | ||
| onOptionsClick={onOptionsClick} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default FetchCard; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { ArticleWithCategory } from '@pages/remind/types/api'; | ||
| import { Card } from '@pinback/design-system/ui'; | ||
| import { useGetPageMeta } from '@shared/apis/queries'; | ||
| import React from 'react'; | ||
|
|
||
| interface FetchCardProps { | ||
| article: ArticleWithCategory; | ||
| onClick: () => void; | ||
| onOptionsClick?: (e: React.MouseEvent<HTMLButtonElement>) => void; | ||
| } | ||
|
|
||
| const FetchCard = ({ article, onClick, onOptionsClick }: FetchCardProps) => { | ||
| const { data: meta, isPending, isError: error } = useGetPageMeta(article.url); | ||
|
|
||
| if (isPending) { | ||
| return ( | ||
| <div className="bg-gray200 h-[35.6rem] w-[24.8rem] animate-pulse rounded-[1.2rem]" /> | ||
| ); | ||
| } | ||
|
|
||
| const displayTitle = !error && meta.title ? meta.title : '제목 없음'; | ||
| const displayImageUrl = !error ? meta.image : undefined; | ||
|
|
||
| return ( | ||
| <Card | ||
| type="remind" | ||
| title={displayTitle} | ||
| imageUrl={displayImageUrl} | ||
| content={article.memo} | ||
| timeRemaining={article.remindAt} | ||
| category={article.category.categoryName} | ||
| onClick={onClick} | ||
| onOptionsClick={onOptionsClick} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default FetchCard; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,12 +76,13 @@ const proxyServices = [ | |
| `https://corsproxy.io/?${encodeURIComponent(targetUrl)}`, | ||
| extractHtml: (response: AxiosResponse) => response.data, | ||
| }, | ||
| { | ||
| name: 'AllOrigins', | ||
| buildUrl: (targetUrl: string) => | ||
| `https://api.allorigins.win/get?url=${encodeURIComponent(targetUrl)}`, | ||
| extractHtml: (response: AxiosResponse) => response.data?.contents, | ||
| }, | ||
| // TODO: 2개까지 보낼 필요 없어서 일단 주석처리 | ||
| // { | ||
| // name: 'AllOrigins', | ||
| // buildUrl: (targetUrl: string) => | ||
| // `https://api.allorigins.win/get?url=${encodeURIComponent(targetUrl)}`, | ||
| // extractHtml: (response: AxiosResponse) => response.data?.contents, | ||
| // }, | ||
|
Comment on lines
+79
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain프록시 서비스 간소화를 검증해 주세요. AllOrigins 프록시를 제거하고 CORSProxy.io만 남겨둔 변경사항입니다. 단일 프록시 의존성으로 인한 장애 가능성을 고려해야 합니다. 다음 스크립트를 실행하여 CORSProxy.io 서비스의 안정성과 가용성을 확인해주세요: 🏁 Script executed: #!/bin/bash
# CORSProxy.io 서비스 가용성과 응답 시간 테스트
echo "Testing CORSProxy.io availability and response time..."
# 테스트용 URL들
TEST_URLS=("https://example.com" "https://github.com" "https://stackoverflow.com")
for url in "${TEST_URLS[@]}"; do
echo "Testing: $url"
# CORSProxy.io를 통한 요청 테스트
proxy_url="https://corsproxy.io/?$(echo "$url" | sed 's/:/%3A/g; s/\//%2F/g')"
# 응답 시간과 상태 코드 확인
response=$(curl -s -w "%{http_code}|%{time_total}" -o /dev/null "$proxy_url" --max-time 15)
if [ $? -eq 0 ]; then
status_code=$(echo "$response" | cut -d'|' -f1)
time_total=$(echo "$response" | cut -d'|' -f2)
echo " Status: $status_code, Time: ${time_total}s"
else
echo " Request failed or timed out"
fi
echo ""
doneLength of output: 242 CORSProxy.io가 테스트에서 403 응답 — AllOrigins 제거는 위험합니다. 스크립트 결과: example.com / github.com / stackoverflow.com 모두 CORSProxy.io를 통해 403을 반환했습니다. 현 구성으로는 OG 데이터 수집 실패 가능성이 높습니다.
🤖 Prompt for AI Agents |
||
| ]; | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
🧩 Analysis chain
useGetArticleDetail이 mutation으로 사용되고 있음
useGetArticleDetail이 데이터를 가져오는 용도임에도 불구하고useMutation으로 구현되어 있습니다. 이는 일반적인 패턴이 아니며,useQuery를 사용하는 것이 더 적절합니다.현재 구현을 확인하기 위해 다음 스크립트를 실행합니다:
useQuery를 사용하도록 리팩토링하는 것을 권장합니다:🏁 Script executed:
Length of output: 776
useGetArticleDetail: useMutation → useQuery로 리팩토링 필요
apps/client/src/shared/apis/queries.ts의 useGetArticleDetail이 조회 훅임에도 useMutation으로 구현되어 있습니다 — 조회(GET)는 useQuery가 적절하므로 훅을 useQuery로 교체하고 호출부(apps/client/src/pages/remind/Remind.tsx:33-34)도 함께 수정하세요.
제안 구현 예시:
영향 호출 예시 변경:
🤖 Prompt for AI Agents