chore: main 병합 — 로그인 없이 댓글·좋아요, 구글 로그인만, 동네 이야기·카드뉴스 등 (차단 표 user_block 하나로 합침, 익명 댓글도 신고 가능)

This commit is contained in:
minaChoi committed 2026-10-26 10:00:40 +09:00
commit dba34675c8
408 files changed
+36377 -725

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import { useQuery } from '@tanstack/react-query';
import { Fragment, type ReactNode } from 'react';
import { RefreshControl, ScrollView } from 'react-native';
import { PostCard, PostCardSkel } from '@/components/post/post-card';
import { isAppPost, PostCard, PostCardSkel } from '@/components/post/post-card';
import { Hero } from '@/components/today/hero';
import { EventsBand, SeasonBand, Stories, StoriesSkel, TopBand } from '@/components/today/rails';
import { Sec, StateBox } from '@/components/ui';
@@ -18,7 +18,7 @@ export default function TodayScreen() {
const today = useQuery(getWeatherTodayOptions({ query: { region: region.code } }));
const { preview } = useSky();
const f = feed.data;
const posts = f?.posts ?? [];
const posts = (f?.posts ?? []).filter(isAppPost);
const stories = atSlot(f?.stories ?? [], preview);
const sloted = preview != null && stories !== f?.stories;
const bands = f?.bands;
+10 -5
View File
@@ -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>
+1 -6
View File
@@ -41,12 +41,7 @@ export function GoogleButton({ onResult, onFail }: { onResult: (res: ResAuth) =>
<Pressable onPress={press} disabled={pending} className="rounded-full border-[1.5px] border-line bg-white p-3 disabled:opacity-60" accessibilityRole="button">
<Text className="text-center text-[15px] font-extrabold text-[#28304a]">{pending ? '구글로 로그인 중…' : '구글로 계속하기'}</Text>
</Pressable>
{broken && <Text className="text-center text-[13px] font-bold text-ink3">구글 로그인을 하지 못했어요. 아이디로 로그인해 주세요.</Text>}
<View className="flex-row items-center gap-2">
<View className="h-px flex-1 bg-line" />
<Text className="text-[12.5px] font-bold text-ink3">또는 아이디로</Text>
<View className="h-px flex-1 bg-line" />
</View>
{broken && <Text className="text-center text-[13px] font-bold text-ink3">구글 로그인을 하지 못했어요. 잠시 뒤에 다시 해 주세요.</Text>}
</View>
);
}
+11 -51
View File
@@ -1,43 +1,22 @@
import { setTokens } from '@nalssigak/shared/api/auth';
import { loginMutation, signupMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
import type { ResAuth } from '@nalssigak/shared/api/client/types.gen';
import { useMutation } from '@tanstack/react-query';
import { useState } from 'react';
import { Pressable, View } from 'react-native';
import { Text } from '@/components/text';
import { Pressable } from 'react-native';
import { Text } from '@/components/text';
import { useAuth } from '@/lib/auth';
import { GoogleButton } from './google';
import { MeSheet } from './me';
import { Body, ErrorLine, Field, useSoft } from './parts';
const AUTH_ERRORS: Record<string, string> = {
AUTH_FAILED: '아이디나 비밀번호가 맞지 않아요.',
AUTH_DUPLICATE_ID: '이미 쓰고 있는 아이디예요.',
INVALID_INPUT: '아이디는 영어 소문자·숫자·_ 4~20자, 비밀번호는 8~64자, 닉네임은 2~12자로 써 주세요.',
};
const MODES = [
['login', '로그인'],
['signup', '처음이에요'],
] as const;
import { Body, ErrorLine } from './parts';
export function LoginSheet({ onDone, onLoggedIn }: { onDone: () => void; onLoggedIn: () => void }) {
const { me } = useAuth();
const s = useSoft();
const [mode, setMode] = useState<'login' | 'signup'>('login');
const [loginId, setLoginId] = useState('');
const [password, setPassword] = useState('');
const [nickname, setNickname] = useState('');
const [error, setError] = useState('');
const login = useMutation(loginMutation());
const signup = useMutation(signupMutation());
const pending = login.isPending || signup.isPending;
const done = (res: ResAuth) => {
if (!res.result?.success || !res.access_token) {
setError(AUTH_ERRORS[res.result?.desc ?? ''] ?? '잠시 뒤에 다시 해 주세요.');
setError('구글로 로그인하지 못했어요. 다시 해 주세요.');
return;
}
setTokens(res.access_token, res.refresh_token ?? null);
@@ -45,38 +24,19 @@ export function LoginSheet({ onDone, onLoggedIn }: { onDone: () => void; onLogge
};
const fail = () => setError('서버에 닿지 못했어요. 잠시 뒤에 다시 해 주세요.');
// 웹 폼의 required·minLength 를 그대로 앞에서 확인한다
const submit = () => {
setError('');
const id = loginId.trim();
if (id.length < 4 || !password || (mode === 'signup' && (password.length < 8 || nickname.trim().length < 2))) {
setError(AUTH_ERRORS.INVALID_INPUT);
return;
}
if (mode === 'login') login.mutate({ body: { login_id: id, password } }, { onSuccess: done, onError: fail });
else signup.mutate({ body: { login_id: id, password, nickname: nickname.trim() } }, { onSuccess: done, onError: fail });
};
if (me) return <MeSheet onDone={onDone} />;
return (
<Body className="gap-2.5">
<Text className="text-center text-sm font-semibold text-ink2">좋아요·댓글은 로그인한 뒤에 할 수 있어요.</Text>
<GoogleButton onResult={done} onFail={fail} />
<View className="flex-row gap-1 rounded-full p-1" style={{ backgroundColor: s.soft }} accessibilityLabel="로그인 또는 가입">
{MODES.map(([m, l]) => (
<Pressable key={m} accessibilityState={{ selected: mode === m }} onPress={() => setMode(m)} className={`flex-1 rounded-full py-2 ${mode === m ? 'bg-ink-btn' : ''}`}>
<Text className={`text-center text-sm font-extrabold ${mode === m ? 'text-white' : 'text-ink2'}`}>{l}</Text>
</Pressable>
))}
</View>
<Field value={loginId} onChangeText={setLoginId} autoCapitalize="none" autoCorrect={false} autoComplete="username" textContentType="username" maxLength={20} placeholder="아이디" accessibilityLabel="아이디" />
<Field value={password} onChangeText={setPassword} secureTextEntry autoComplete={mode === 'login' ? 'current-password' : 'new-password'} textContentType={mode === 'login' ? 'password' : 'newPassword'} maxLength={64} placeholder={mode === 'signup' ? '비밀번호 (8자 이상)' : '비밀번호'} accessibilityLabel="비밀번호" onSubmitEditing={mode === 'login' ? submit : undefined} />
{mode === 'signup' && <Field value={nickname} onChangeText={setNickname} maxLength={12} placeholder="닉네임 (2~12자)" accessibilityLabel="닉네임" onSubmitEditing={submit} />}
<GoogleButton
onResult={(res) => {
setError('');
done(res);
}}
onFail={fail}
/>
<ErrorLine text={error} />
<Pressable onPress={submit} disabled={pending} className="rounded-[14px] border-b-[5px] border-orange-deep bg-orange p-[13px] disabled:opacity-60">
<Text className="text-center font-jua text-[17px] text-white">{mode === 'login' ? (pending ? '로그인 중…' : '로그인') : pending ? '가입하는 중…' : '가입하고 시작하기'}</Text>
</Pressable>
<Pressable onPress={onDone} className="rounded-[14px] p-[13px]">
<Text className="text-center text-[15px] font-extrabold text-ink2">나중에 할게요</Text>
</Pressable>