feat: 앱 오늘 피드를 웹과 맞춤 — 히어로 오늘/내일 전환·좋아요·댓글·보내기·점수 근거 창, 오늘의 각 카드(gak_post), 날씨각 카드(그림 슬라이드), 행사·TOP5 띠 없앰, 좋아요·댓글 로그인 없이 (GA hero_day_switch, like hero_post·gak_post)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
e8b8cc79b6
commit
01b5f917b9
16 files changed
+449
-156
No files matched your search
@@ -130,8 +130,6 @@ function CommentsSkel() {
|
||||
|
||||
function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; onNotice: (text: string) => void }) {
|
||||
const { region } = useRegion();
|
||||
const { loggedIn } = useAuth();
|
||||
const { open } = useSheet();
|
||||
const queryClient = useQueryClient();
|
||||
const [heart, ink3] = useCSSVariable(['--color-heart', '--color-ink3']).map(String);
|
||||
const [liked, setLiked] = useState(c.liked);
|
||||
@@ -142,8 +140,8 @@ function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; o
|
||||
const [removeFailed, setRemoveFailed] = useState(false);
|
||||
const [likeFailed, setLikeFailed] = useState(false);
|
||||
|
||||
// 좋아요는 로그인 없이 된다 (웹과 같이)
|
||||
const toggle = () => {
|
||||
if (!loggedIn) return open({ type: 'login' });
|
||||
if (like.isPending || unlike.isPending) return;
|
||||
const next = !liked;
|
||||
setLikeFailed(false);
|
||||
@@ -235,8 +233,7 @@ function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; o
|
||||
|
||||
export function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
const { region } = useRegion();
|
||||
const { open } = useSheet();
|
||||
const { loggedIn, me } = useAuth();
|
||||
const { me } = useAuth();
|
||||
const queryClient = useQueryClient();
|
||||
const list = useInfiniteQuery({
|
||||
...listCommentsInfiniteOptions({ path: { post_id: postId } }),
|
||||
@@ -264,7 +261,7 @@ export function CommentsSheet({ postId, draft }: { postId: number; draft?: strin
|
||||
if (!body || add.isPending) return;
|
||||
setAddFailed(false);
|
||||
add.mutate(
|
||||
{ path: { post_id: postId }, body: { body } },
|
||||
{ path: { post_id: postId }, body: { body, region: region.code } },
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
if (res.result?.desc === 'TERMS_REQUIRED') return setAskTerms(true);
|
||||
@@ -280,9 +277,8 @@ export function CommentsSheet({ postId, draft }: { postId: number; draft?: strin
|
||||
);
|
||||
};
|
||||
|
||||
// 약관에 동의해야 댓글을 쓸 수 있다. 동의하면 쓰던 댓글을 바로 올린다
|
||||
// 댓글은 로그인 없이 '○○구 익명'으로 쓴다. 로그인했으면 약관에 동의해야 쓸 수 있고, 동의하면 쓰던 댓글을 바로 올린다
|
||||
const submit = () => {
|
||||
if (!loggedIn) return open({ type: 'login', then: { type: 'comments', postId, draft: text } });
|
||||
if (me && !me.terms_agreed) return setAskTerms(true);
|
||||
send();
|
||||
};
|
||||
@@ -358,7 +354,7 @@ export function CommentsSheet({ postId, draft }: { postId: number; draft?: strin
|
||||
<View className="flex-1">
|
||||
<Field ref={inputRef} round value={text} onChangeText={setText} editable={!add.isPending} maxLength={60} placeholder={me ? `${me.nickname}(으)로 댓글 달기…` : '댓글 달기…'} accessibilityLabel="댓글" returnKeyType="send" onSubmitEditing={submit} />
|
||||
</View>
|
||||
<Pressable onPress={submit} disabled={add.isPending || (loggedIn && !text.trim())} className="disabled:opacity-40">
|
||||
<Pressable onPress={submit} disabled={add.isPending || !text.trim()} className="disabled:opacity-40">
|
||||
<Text className="font-extrabold text-rain">{add.isPending ? '올리는 중…' : '게시'}</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
|
||||
Reference in new issue
Block a user