Merge remote-tracking branch 'origin/main' into feat/weather-game
# Conflicts: # frontend/src/b/Sheets.tsx # frontend/src/b/sheetContext.ts
This commit is contained in:
commit
7d097a05de
99 files changed
+3230
-41
No files matched your search
@@ -36,6 +36,9 @@ import { useInstall, useInstallable } from './install'
|
||||
import { InstallSheet } from './installBanner'
|
||||
import { ARTICLE_CAT, SHEET_CLOSE_MS, SHEET_OPEN_MS } from './lib'
|
||||
import { MixSheet, MyGakSheet } from './myGak'
|
||||
import { TarotSheet } from './fortune'
|
||||
import { OotdSheet } from './todayIcons'
|
||||
import { LevelCard, LevelSheet, LevelUpSheet, useShareReward } from './level'
|
||||
import { ownPage, useRegion } from './regionContext'
|
||||
import { WeatherWhySheet } from './weatherWhy'
|
||||
import { useSky } from './skyContext'
|
||||
@@ -55,6 +58,7 @@ export function SheetProvider({ children }: { children: ReactNode }) {
|
||||
window.history.pushState({ ...window.history.state, sheet: true }, '')
|
||||
pushed.current = true
|
||||
}
|
||||
track('sheet_open', { sheet: s.type })
|
||||
setState(s)
|
||||
}, [])
|
||||
const close = useCallback(() => {
|
||||
@@ -86,7 +90,7 @@ export function SheetProvider({ children }: { children: ReactNode }) {
|
||||
)
|
||||
}
|
||||
|
||||
const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', share: '보내기', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', install: '홈 화면에 추가', weatherWhy: '날씨 점수는 이렇게 나와요', talk: '이야기', gameHelp: '구름 합치기 하는 법' } as const
|
||||
const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', share: '보내기', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', install: '홈 화면에 추가', weatherWhy: '날씨 점수는 이렇게 나와요', talk: '이야기', tarot: '오늘 타로', ootd: '오늘 코디', level: '내 레벨', levelUp: '레벨이 올랐어요', gameHelp: '구름 합치기 하는 법' } as const
|
||||
|
||||
/** 아래에서 올라오는 창: 네이티브 <dialog>라 ESC·포커스 가두기·포커스 되돌리기가 기본으로 된다 */
|
||||
function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void }) {
|
||||
@@ -173,6 +177,10 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void
|
||||
{shown.type === 'myGak' && <MyGakSheet gak={shown.gak} shot={shown.shot} onDone={onClose} />}
|
||||
{shown.type === 'install' && <InstallSheet />}
|
||||
{shown.type === 'weatherWhy' && <WeatherWhySheet d={shown.why} />}
|
||||
{shown.type === 'tarot' && <TarotSheet />}
|
||||
{shown.type === 'ootd' && <OotdSheet />}
|
||||
{shown.type === 'level' && <LevelSheet />}
|
||||
{shown.type === 'levelUp' && <LevelUpSheet level={shown.level} />}
|
||||
{shown.type === 'talk' && <TalkSheet talk={shown.talk} />}
|
||||
{shown.type === 'gameHelp' && <GameHelpSheet />}
|
||||
</div>
|
||||
@@ -585,6 +593,7 @@ const SIZE_KEYS = Object.keys(SHARE_SIZES) as ShareSize[]
|
||||
|
||||
function ShareSheet({ share }: { share: SharePayload }) {
|
||||
const { region } = useRegion()
|
||||
const reward = useShareReward()
|
||||
const { kind } = useSky()
|
||||
const [size, setSize] = useState<ShareSize>('story')
|
||||
const [images, setImages] = useState<Partial<Record<ShareSize, { blob: Blob; src: string }>>>({})
|
||||
@@ -631,6 +640,7 @@ function ShareSheet({ share }: { share: SharePayload }) {
|
||||
(r) => {
|
||||
setToast(r === 'saved' ? '이미지를 저장하고 링크를 보냈어요' : '링크를 보냈어요')
|
||||
track('share', { content_type: 'image', item_id: share.title, method: 'share_sheet', ratio: SHARE_SIZES[size].ratio })
|
||||
reward()
|
||||
},
|
||||
(e: unknown) => {
|
||||
console.error('[share] toss', e)
|
||||
@@ -651,6 +661,7 @@ function ShareSheet({ share }: { share: SharePayload }) {
|
||||
async () => {
|
||||
setToast((await copied) ? '보냈어요. 링크도 복사해 뒀어요' : '보냈어요')
|
||||
track('share', { content_type: 'image', item_id: share.title, method: 'share_sheet', ratio: SHARE_SIZES[size].ratio })
|
||||
reward()
|
||||
},
|
||||
(e: unknown) => {
|
||||
if (e instanceof DOMException && e.name === 'AbortError') return
|
||||
@@ -724,9 +735,10 @@ function CommentMenu({ c, postId, onNotice }: { c: CommentData; postId: number;
|
||||
const block = useMutation(blockAuthorMutation())
|
||||
const pending = report.isPending || block.isPending
|
||||
|
||||
const finish = (notice: string) => ({
|
||||
const finish = (notice: string, done: () => void) => ({
|
||||
onSuccess: (res: { result?: { success?: boolean } }) => {
|
||||
if (!res.result?.success) return setFailed(true)
|
||||
done()
|
||||
setStep('closed')
|
||||
onNotice(notice)
|
||||
queryClient.invalidateQueries({ predicate: isCommentList })
|
||||
@@ -760,14 +772,14 @@ function CommentMenu({ c, postId, onNotice }: { c: CommentData; postId: number;
|
||||
)}
|
||||
{step === 'report' &&
|
||||
REPORT_REASONS.map(([reason, label]) => (
|
||||
<button key={reason} type="button" disabled={pending} className={btn} onClick={() => report.mutate({ path: { comment_id: c.comment_id }, body: { reason } }, finish('신고했어요. 확인하고 조치할게요.'))}>
|
||||
<button key={reason} type="button" disabled={pending} className={btn} onClick={() => report.mutate({ path: { comment_id: c.comment_id }, body: { reason } }, finish('신고했어요. 확인하고 조치할게요.', () => track('report', { content_type: 'comment', reason })))}>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
{step === 'block' && (
|
||||
<>
|
||||
<span className="w-full text-[13px] font-bold text-(--ink)">{c.nickname}님 댓글을 더는 안 볼까요?</span>
|
||||
<button type="button" disabled={pending} className={cx(btn, 'bg-(--heart) text-white')} onClick={() => block.mutate({ path: { comment_id: c.comment_id } }, finish('차단했어요. 내 정보에서 풀 수 있어요.'))}>
|
||||
<button type="button" disabled={pending} className={cx(btn, 'bg-(--heart) text-white')} onClick={() => block.mutate({ path: { comment_id: c.comment_id } }, finish('차단했어요. 내 정보에서 풀 수 있어요.', () => track('block', { content_type: 'comment' })))}>
|
||||
차단하기
|
||||
</button>
|
||||
<button type="button" disabled={pending} className={btn} onClick={() => go('closed')}>
|
||||
@@ -814,6 +826,7 @@ function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; o
|
||||
if (res.result?.success) {
|
||||
setLiked(!!res.liked)
|
||||
if (res.like_count != null) setCount(res.like_count)
|
||||
if (next) track('like', { content_type: 'comment', item_id: c.comment_id })
|
||||
return
|
||||
}
|
||||
revert()
|
||||
@@ -915,6 +928,7 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
if (res.result?.desc === 'TERMS_REQUIRED') return setAskTerms(true)
|
||||
setAddFailed(!res.result?.success)
|
||||
if (!res.result?.success) return
|
||||
track('comment', { post_id: postId })
|
||||
setText('')
|
||||
queryClient.invalidateQueries({ queryKey: listCommentsInfiniteQueryKey({ path: { post_id: postId } }) })
|
||||
queryClient.invalidateQueries({ queryKey: getFeedQueryKey({ query: { region: region.code } }) })
|
||||
@@ -937,6 +951,7 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
if (!res.result?.success) return setAddFailed(true)
|
||||
track('terms_agree', {})
|
||||
queryClient.setQueryData(meQueryKey(), res)
|
||||
setAskTerms(false)
|
||||
send()
|
||||
@@ -1186,6 +1201,7 @@ function MeSheet({ onDone }: { onDone: () => void }) {
|
||||
<Avatar character={me.character} color={me.color} mood={me.mood} size={64} />
|
||||
<p className="m-0 text-center text-sm font-semibold text-(--ink2)">{me.provider === AuthProvider.TOSS ? '토스로 로그인했어요' : me.provider === AuthProvider.GOOGLE ? '구글 계정으로 로그인했어요' : `${me.login_id}(으)로 로그인했어요`}</p>
|
||||
</div>
|
||||
<LevelCard />
|
||||
{installable && (
|
||||
<button type="button" onClick={() => install('menu')} className="cursor-pointer rounded-2xl bg-[#fff4ec] py-2.5 font-jua text-[15.5px] text-(--orange)">
|
||||
📲 홈 화면에 추가
|
||||
|
||||
Reference in new issue
Block a user