chore: main 병합 — 로그인 없이 댓글·좋아요, 구글 로그인만, 동네 이야기·카드뉴스 등 (차단 표 user_block 하나로 합침, 익명 댓글도 신고 가능)
This commit is contained in:
commit
dba34675c8
408 files changed
+36377
-725
No files matched your search
@@ -11,14 +11,14 @@ import { useCSSVariable } from 'uniwind';
|
||||
import { CommentIcon, HEART, HeartIcon, SendIcon } from '@/components/post/icons';
|
||||
import { LikeBurst } from '@/components/post/like-burst';
|
||||
import { Dots, Pager } from '@/components/post/pager';
|
||||
import { slideBg, SlideView } from '@/components/post/slides';
|
||||
import { slideBg, SlideView, type Slide } from '@/components/post/slides';
|
||||
import { Ic, Skel } from '@/components/ui';
|
||||
import { useAuth } from '@/lib/auth';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
import { shareView } from '@/lib/share-image';
|
||||
import { SITE_URL } from '@/lib/site';
|
||||
|
||||
const ACCOUNTS: Record<PostType, readonly [string, string]> = {
|
||||
const ACCOUNTS: Partial<Record<PostType, readonly [string, string]>> = {
|
||||
[PostType.WEATHER]: ['오늘 날씨', 'sun'],
|
||||
[PostType.GAK]: ['오늘의 각', 'rabbit'],
|
||||
[PostType.SUNSET]: ['노을', 'sunset'],
|
||||
@@ -36,6 +36,11 @@ const ACCOUNTS: Record<PostType, readonly [string, string]> = {
|
||||
[PostType.UV]: ['자외선', 'glasses'],
|
||||
};
|
||||
|
||||
const isSlide = (s: PostData['slides'][number]): s is Slide => s.kind !== 'image';
|
||||
|
||||
/** 앱이 그릴 줄 아는 글만 (웹 전용 글 종류·이미지 슬라이드가 든 글은 뺀다) */
|
||||
export const isAppPost = (p: PostData) => p.post_type in ACCOUNTS && p.slides.every(isSlide);
|
||||
|
||||
type PostProps = { post: PostData };
|
||||
|
||||
/** 받아 둔 피드 데이터에도 좋아요를 반영한다. 안 하면 다른 탭에 다녀왔을 때 예전 값으로 다시 그려진다 */
|
||||
@@ -47,7 +52,7 @@ function patchFeed(queryClient: QueryClient, postId: number, patch: Partial<Post
|
||||
|
||||
/** 한 줄 카드 (흐린 날 노을처럼 큰 그림이 필요 없는 소식) */
|
||||
function LineCard({ post }: PostProps) {
|
||||
const [account, avatar] = ACCOUNTS[post.post_type];
|
||||
const [account, avatar] = ACCOUNTS[post.post_type] ?? ['날씨각', 'sun'];
|
||||
return (
|
||||
<View className="mx-3 mt-3.5 flex-row items-center gap-3 rounded-[22px] border-b-4 border-shade bg-card px-4 py-3" accessibilityLabel={post.title}>
|
||||
<Ic name={post.icon || avatar} size={40} />
|
||||
@@ -124,7 +129,7 @@ function FullCard({ post }: PostProps) {
|
||||
const [pop, setPop] = useState(0);
|
||||
const [likeFailed, setLikeFailed] = useState(0);
|
||||
const lastTap = useRef(0);
|
||||
const [account, avatar] = ACCOUNTS[post.post_type];
|
||||
const [account, avatar] = ACCOUNTS[post.post_type] ?? ['날씨각', 'sun'];
|
||||
const n = post.slides.length;
|
||||
const patch = (values: Partial<PostData>) => patchFeed(queryClient, post.post_id, values);
|
||||
const comments = () => open({ type: 'comments', postId: post.post_id });
|
||||
@@ -185,7 +190,7 @@ function FullCard({ post }: PostProps) {
|
||||
<View ref={shot} collapsable={false}>
|
||||
{width > 0 && (
|
||||
<Pager width={width} height={(width * 5) / 4} onIndex={setIndex}>
|
||||
{post.slides.map((s, i) => (
|
||||
{post.slides.filter(isSlide).map((s, i) => (
|
||||
<SlideView key={i} slide={s} bg={slideBg(post, s)} />
|
||||
))}
|
||||
</Pager>
|
||||
|
||||
Reference in new issue
Block a user