Merge commit '46171b4f24f2ddc3b9212b9ad6769925bcaceb03' into feature/site-features-and-mockup
# Conflicts: # .env.example # solution/backend/common/enums.py # solution/backend/requirements.txt # solution/backend/services/site_payload.py # solution/backend/services/snapshot.py # solution/backend/services/weather_notes.json # solution/shared/src/types/site-payload.ts # solution/site/src/layouts/editorial/Shell.tsx # solution/site/src/lib/use-live-weather.ts # solution/site/src/pages/HomePage.tsx # solution/site/src/sections/SiteFooter.tsx # solution/site/src/sections/WeatherSection.tsx # solution/site/src/sections/index.ts
This commit is contained in:
commit
b78486b845
74 files changed
+3266
-193
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import {SocialConnectionCard} from '@/features/social/SocialConnectionCard';
|
||||
import {SocialConnectionNotice} from '@/features/social/SocialConnectionNotice';
|
||||
import {useMemo, useState} from 'react';
|
||||
import {Link, useNavigate} from 'react-router';
|
||||
import {
|
||||
@@ -254,6 +256,9 @@ export function SitesPage() {
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<SocialConnectionNotice />
|
||||
{/* 연결은 사업장이 아니라 사람 단위다 — 목록 위에 한 자리만 둔다(SocialConnectionCard 주석). */}
|
||||
<SocialConnectionCard />
|
||||
{isLoading && (
|
||||
<div className="flex items-center justify-center py-20 text-muted-foreground">
|
||||
<Loader2 className="size-5 animate-spin" />
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
import {useParams, useSearchParams} from 'react-router';
|
||||
import {socialApi, postStatus, statusLabels, type SocialPost} from '@/features/social/api';
|
||||
import {Button} from '@/components/ui/button';
|
||||
|
||||
export default function SocialApprovalPage() {
|
||||
const {postId} = useParams();
|
||||
const [query] = useSearchParams();
|
||||
const token = query.get('t') ?? '';
|
||||
const [post, setPost] = useState<SocialPost | null>(null);
|
||||
const [message, setMessage] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [decided, setDecided] = useState(false);
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
void socialApi<SocialPost>(`/approval/${postId}?t=${encodeURIComponent(token)}`, undefined, true)
|
||||
.then((data) => {if (active) setPost(data);})
|
||||
.catch((e: Error) => {if (active) setMessage(e.message);});
|
||||
return () => {active = false;};
|
||||
}, [postId, token]);
|
||||
async function decide(approve: boolean) {
|
||||
setBusy(true);
|
||||
try {
|
||||
const result = await socialApi<{message: string}>(`/approval/${postId}/decision`, {t: token, approve}, true);
|
||||
setMessage(result.message); setDecided(true);
|
||||
} catch (e) {setMessage(e instanceof Error ? e.message : '처리하지 못했습니다.');}
|
||||
finally {setBusy(false);}
|
||||
}
|
||||
const pending = post && postStatus(post) === 'PENDING_APPROVAL' && !decided;
|
||||
return <main className="mx-auto max-w-xl space-y-6 px-5 py-12">
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
<h1 className="text-2xl font-bold">이 글을 Threads에 게재할까요?</h1>
|
||||
{post && <>
|
||||
<p>{post.account_bound ? <>게재 계정: <strong>@{post.account_handle}</strong></> : <>자동 게재 연결 전입니다. 지금은 내용만 확인하며, 계정 연결 후 다시 승인을 받습니다.</>}</p>
|
||||
<p className="whitespace-pre-wrap break-words rounded-xl border p-5">{post.body}</p>
|
||||
<a href={post.link_url} target="_blank" rel="noreferrer noopener" referrerPolicy="no-referrer" className="underline">홈페이지 확인하기</a>
|
||||
<p>게시글은 홈페이지에도 소식으로 남습니다. Threads에서 삭제해도 홈페이지의 소식은 자동 삭제되지 않습니다.</p>
|
||||
<p className="text-sm">{statusLabels[postStatus(post)]}{post.approval_expires_at && ` · ${new Date(post.approval_expires_at).toLocaleString('ko-KR', {timeZone: 'Asia/Seoul'})} (한국시간)까지`}</p>
|
||||
{pending && <div className="flex gap-3">
|
||||
<Button disabled={busy} onClick={() => void decide(true)}>{post.account_bound ? '예, 이 글을 게재할게요' : '내용을 확인했어요'}</Button>
|
||||
<Button variant="outline" disabled={busy} onClick={() => void decide(false)}>게재하지 않기</Button>
|
||||
</div>}
|
||||
</>}
|
||||
<p role="status" aria-live="polite">{message || (!post ? '소개글을 불러오는 중입니다.' : '')}</p>
|
||||
</main>;
|
||||
}
|
||||
Reference in new issue
Block a user