Merge remote-tracking branch 'origin/main' into feat/apps-in-toss
This commit is contained in:
commit
239a22ee06
139 files changed
+7645
-59
No files matched your search
+12
-6
@@ -20,6 +20,7 @@ import { topicName, TOPICS, useMyTalks } from './talkState'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { CameraIcon, HeartIcon } from './svg'
|
||||
import { Avatar, Rail, TAP44 } from './ui'
|
||||
import { track } from '../lib/analytics'
|
||||
|
||||
const BODY_MAX = 100
|
||||
const PHOTO_MAX = 10 * 1024 * 1024
|
||||
@@ -105,6 +106,7 @@ function Composer({ onDone }: { onDone?: (t: TalkData) => void }) {
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
if (!res.result?.success) return setError(WRITE_ERRORS[res.result?.desc ?? ''] ?? '글을 올리지 못했어요. 다시 해 주세요.')
|
||||
track('talk_post', { topic, with_image: !!image })
|
||||
setText('')
|
||||
setPhoto(null)
|
||||
setTopic(TalkTopic.LOCAL)
|
||||
@@ -215,7 +217,10 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
{ path: { talk_id: t.talk_id } },
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
if (res.result?.success && res.like_count != null) return setCount(res.like_count)
|
||||
if (res.result?.success && res.like_count != null) {
|
||||
if (next) track('like', { content_type: 'talk', item_id: t.talk_id })
|
||||
return setCount(res.like_count)
|
||||
}
|
||||
setLiked(!next)
|
||||
setCount(t.like_count)
|
||||
},
|
||||
@@ -228,14 +233,15 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
}
|
||||
|
||||
// 메뉴의 동작은 끝나면 목록을 다시 받아 숨긴 글·안 보기로 한 사람의 글이 빠지게 한다
|
||||
const after = {
|
||||
const after = (done?: () => void) => ({
|
||||
onSuccess: (res: { result?: { success?: boolean } }) => {
|
||||
if (!res.result?.success) return setFailed(true)
|
||||
done?.()
|
||||
setMenu('done')
|
||||
refresh()
|
||||
},
|
||||
onError: () => setFailed(true),
|
||||
}
|
||||
})
|
||||
const guard = (run: () => void) => (loggedIn ? run() : open({ type: 'login' }))
|
||||
const src = t.image?.startsWith('/v1/') ? API_BASE_URL + t.image : (t.image ?? undefined)
|
||||
|
||||
@@ -271,7 +277,7 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
) : t.mine && menu === 'confirm' ? (
|
||||
<>
|
||||
<span className="self-center text-(--ink2)">지울까요?</span>
|
||||
<button type="button" onClick={() => remove.mutate({ path: { talk_id: t.talk_id } }, { ...after, onSuccess: (res) => (after.onSuccess(res), res.result?.success && onGone?.()) })} disabled={remove.isPending} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
<button type="button" onClick={() => remove.mutate({ path: { talk_id: t.talk_id } }, after(() => onGone?.()))} disabled={remove.isPending} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
지우기
|
||||
</button>
|
||||
<button type="button" onClick={() => setMenu('closed')} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
@@ -284,13 +290,13 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
</button>
|
||||
) : menu === 'report' ? (
|
||||
REASONS.map(([reason, label]) => (
|
||||
<button key={reason} type="button" onClick={() => report.mutate({ path: { talk_id: t.talk_id }, body: { reason } }, after)} disabled={report.isPending} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
<button key={reason} type="button" onClick={() => report.mutate({ path: { talk_id: t.talk_id }, body: { reason } }, after(() => track('report', { content_type: 'talk', reason })))} disabled={report.isPending} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
{label}
|
||||
</button>
|
||||
))
|
||||
) : (
|
||||
<>
|
||||
<button type="button" onClick={() => guard(() => block.mutate({ path: { talk_id: t.talk_id } }, after))} disabled={block.isPending} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
<button type="button" onClick={() => guard(() => block.mutate({ path: { talk_id: t.talk_id } }, after(() => track('block', { content_type: 'talk' }))))} disabled={block.isPending} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
이 사람 글 안 보기
|
||||
</button>
|
||||
<button type="button" onClick={() => guard(() => setMenu('report'))} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
|
||||
Reference in new issue
Block a user