feat: 댓글 신고·차단·약관 동의(관리 스크립트 포함), 구글 로그인(서버·웹·안드로이드 앱), 앱 패키지 kr.o2o.nalssigak·versionCode 1000
This commit is contained in:
1 parent
fbebdcb796
commit
3f3a3ea039
35 files changed
+1723
-115
No files matched your search
@@ -1,13 +1,15 @@
|
||||
import { clearTokens } from '@nalssigak/shared/api/auth';
|
||||
import { meQueryKey, updateMeMutation, withdrawMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
|
||||
import { listBlockedOptions, listBlockedQueryKey, meQueryKey, unblockMutation, updateMeMutation, withdrawMutation } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
|
||||
import { AVATAR_COLORS, CHARACTERS, MOODS } from '@nalssigak/shared/lib';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Avatar, Ic } from '@/components/ui';
|
||||
import { useAuth } from '@/lib/auth';
|
||||
|
||||
import { isCommentList } from './comments';
|
||||
import { Body, Field, useSoft } from './parts';
|
||||
|
||||
/** 탈퇴: 한 번 더 묻고 지운다. 계정이 없어지니 이 기기 토큰도 지운다 */
|
||||
@@ -51,7 +53,49 @@ function Withdraw({ onDone }: { onDone: () => void }) {
|
||||
);
|
||||
}
|
||||
|
||||
/** 내 정보: 캐릭터·배경색·기분·닉네임·로그아웃·탈퇴 */
|
||||
/** 차단한 사람: 있을 때만 보이고, 풀면 그 사람 댓글이 다시 보인다 */
|
||||
function Blocked() {
|
||||
const s = useSoft();
|
||||
const queryClient = useQueryClient();
|
||||
const list = useQuery(listBlockedOptions());
|
||||
const unblock = useMutation(unblockMutation());
|
||||
const [failed, setFailed] = useState(false);
|
||||
const users = list.data?.users ?? [];
|
||||
if (!users.length) return null;
|
||||
const release = (user_id: string) => {
|
||||
setFailed(false);
|
||||
unblock.mutate(
|
||||
{ path: { user_id } },
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
if (!res.result?.success) return setFailed(true);
|
||||
queryClient.invalidateQueries({ queryKey: listBlockedQueryKey() });
|
||||
queryClient.invalidateQueries({ predicate: isCommentList });
|
||||
},
|
||||
onError: () => setFailed(true),
|
||||
},
|
||||
);
|
||||
};
|
||||
return (
|
||||
<View accessibilityLabel="차단한 사람">
|
||||
<Text className="mb-2 text-sm font-extrabold text-ink">차단한 사람</Text>
|
||||
<View className="gap-2">
|
||||
{users.map((u) => (
|
||||
<View key={u.user_id} className="flex-row items-center gap-2.5">
|
||||
<Avatar character={u.character} color={u.color} />
|
||||
<Text className="flex-1 text-sm font-bold text-ink">{u.nickname}</Text>
|
||||
<Pressable onPress={() => release(u.user_id)} disabled={unblock.isPending} className="rounded-[12px] px-3 py-2 disabled:opacity-50" style={{ backgroundColor: s.soft }}>
|
||||
<Text className="text-[13px] font-extrabold text-ink">풀기</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
{failed && <Text className="mt-1.5 text-[13px] font-bold text-heart">잠시 뒤에 다시 해 주세요.</Text>}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
/** 내 정보: 캐릭터·배경색·기분·닉네임·로그아웃·차단한 사람·탈퇴 */
|
||||
export function MeSheet({ onDone }: { onDone: () => void }) {
|
||||
const { me, logout } = useAuth();
|
||||
const s = useSoft();
|
||||
@@ -165,6 +209,7 @@ export function MeSheet({ onDone }: { onDone: () => void }) {
|
||||
>
|
||||
<Text className="text-center text-[15px] font-extrabold text-ink">로그아웃</Text>
|
||||
</Pressable>
|
||||
<Blocked />
|
||||
<Withdraw onDone={onDone} />
|
||||
</Body>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user