feat: 내 각 아이콘·상세, 이야기 내 글·무한 스크롤, 공유 이미지 얇은 띠, 행사 주소 수집
- 내 각: 아이콘 고르기(my_gak.icon), 카드는 아이콘·점수·아쉬운 조건만, 눌러서 상세(시간대·조건별 점수), 공유는 공통 공유 창 - 이야기: 오늘 쓴 내 글 묶음, '내 글' 칩·탭, 무한 스크롤, 사진 카메라 버튼, 지우기 확인, ⋯ 메뉴 하트 옆, 글 시간 서버 계산(1일 전) - 공유 이미지: 1:1·4:5 는 아래 얇은 띠 한 줄로 카드를 크게 - 행사: 수집 때 주소 저장(event.address), 행사 포스트에 장소·주소·기간 - 히어로 말풍선 '오늘 낮은 / 내일 낮은', 내일을 볼 때 배경도 따라감, 달 보름 순간이 낮이면 뜨는 시각으로 - 단풍 지도 피드 맨 위, 행사·계절 띠 포스트 틀 되돌림, 쇼츠 홈 버튼 가림·닫기 버튼, 하단 여백, 회색 글자 대비 - 토스 앱에선 쇼츠 플레이어를 하나만 띄움
This commit is contained in:
1 parent
3a249c509d
commit
ffe6153148
35 files changed
+566
-185
No files matched your search
+45
-26
@@ -15,11 +15,11 @@ import { API_BASE_URL } from '../api/setup'
|
||||
import { IS_TOSS } from '../lib/platform'
|
||||
import { cx } from '../lib/utils'
|
||||
import { useAuth } from './authContext'
|
||||
import { ago, kst } from '@nalssigak/shared/lib'
|
||||
import { kst } from '@nalssigak/shared/lib'
|
||||
import { useRegion } from './regionContext'
|
||||
import { topicName, TOPICS, useMyTalks } from './talkState'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { HeartIcon } from './svg'
|
||||
import { CameraIcon, HeartIcon } from './svg'
|
||||
import { Avatar, Rail, TAP44 } from './ui'
|
||||
|
||||
const BODY_MAX = 100
|
||||
@@ -171,8 +171,9 @@ function Composer({ onDone }: { onDone?: (t: TalkData) => void }) {
|
||||
</div>
|
||||
<input ref={fileRef} type="file" accept="image/*" onChange={pick} hidden />
|
||||
<div className="mt-1.5 flex items-center gap-2 text-xs font-bold text-(--ink3)">
|
||||
<button type="button" onClick={() => (loggedIn ? fileRef.current?.click() : open({ type: 'login' }))} disabled={busy} className="shrink-0 cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1.5 text-[13px] font-extrabold text-(--ink2) disabled:opacity-40">
|
||||
사진
|
||||
{/* 주제 칩과 헷갈리지 않게 글자 대신 카메라 아이콘 */}
|
||||
<button type="button" onClick={() => (loggedIn ? fileRef.current?.click() : open({ type: 'login' }))} disabled={busy} aria-label="사진 붙이기" className={cx('relative grid size-8 shrink-0 cursor-pointer place-items-center rounded-full bg-[#eef4fc] text-(--ink2) disabled:opacity-40', TAP44)}>
|
||||
<CameraIcon className="size-[18px]" />
|
||||
</button>
|
||||
<span className="min-w-0 truncate">{me ? `${me.nickname} · ${region.name.split(' ').at(-1)} · 지금 날씨가 함께 올라가요` : '로그인하면 쓸 수 있어요'}</span>
|
||||
<span className="ml-auto tabular-nums">
|
||||
@@ -198,7 +199,7 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
const refresh = useRefreshTalks()
|
||||
const [liked, setLiked] = useState(t.liked)
|
||||
const [count, setCount] = useState(t.like_count)
|
||||
const [menu, setMenu] = useState<'closed' | 'open' | 'report' | 'done'>('closed')
|
||||
const [menu, setMenu] = useState<'closed' | 'open' | 'confirm' | 'report' | 'done'>('closed')
|
||||
const like = useMutation(likeTalkMutation())
|
||||
const unlike = useMutation(unlikeTalkMutation())
|
||||
const remove = useMutation(deleteTalkMutation())
|
||||
@@ -240,7 +241,7 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
const src = t.image?.startsWith('/v1/') ? API_BASE_URL + t.image : (t.image ?? undefined)
|
||||
|
||||
return (
|
||||
<div className={cx('grid grid-cols-[34px_1fr_24px] gap-2.5 border-b border-(--line) py-2.5 last:border-b-0', compact ? 'h-full w-full items-stretch' : 'items-start')}>
|
||||
<div className={cx('grid grid-cols-[34px_1fr_auto] gap-2.5 border-b border-(--line) py-2.5 last:border-b-0', compact ? 'h-full w-full items-stretch' : 'items-start')}>
|
||||
<span className="self-start">
|
||||
<Avatar character={t.character} color={t.color} mood={t.mood} />
|
||||
</span>
|
||||
@@ -248,6 +249,7 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
<div className={cx('min-w-0', compact && 'flex flex-col')}>
|
||||
<small className={cx('block text-xs font-bold text-(--ink3)', compact && 'truncate')}>
|
||||
<b className="mr-1 font-extrabold text-(--ink)">{t.nickname}</b>
|
||||
{t.mine && <span className="mr-1 rounded-full bg-[#ffe8dc] px-1.5 py-px text-[11px] font-extrabold text-[#c2471b]">내 글</span>}
|
||||
{[t.region_name, slotWord(t.created_at), t.weather, t.topic && t.topic !== TalkTopic.LOCAL ? topicName(t.topic) : null].filter(Boolean).join(' · ')}
|
||||
</small>
|
||||
{/* 묶음 안 작은 카드는 글이 잘리니, 누르면 창에서 글 전체·큰 사진을 본다 */}
|
||||
@@ -261,22 +263,24 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
)}
|
||||
{t.image && !compact && <img src={src} alt="" loading="lazy" className="mt-2 aspect-[4/5] w-full rounded-2xl bg-[#eef4fc] object-cover" />}
|
||||
<small className={cx('block text-xs font-bold text-(--ink3)', compact ? 'mt-auto pt-1.5' : 'mt-0.5')}>
|
||||
{ago(t.created_at)} · 좋아요 {count}개
|
||||
{!IS_TOSS && (
|
||||
<>
|
||||
{' · '}
|
||||
<button type="button" onClick={() => setMenu(menu === 'closed' ? 'open' : 'closed')} aria-expanded={menu !== 'closed'} className="cursor-pointer font-bold text-(--ink3)">
|
||||
{t.mine ? '내 글' : '더보기'}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
{t.ago} · 좋아요 {count}개
|
||||
</small>
|
||||
{menu !== 'closed' && (
|
||||
<div className="mt-1.5 flex flex-wrap gap-1.5 text-[12.5px] font-extrabold" role="group" aria-label="글 메뉴">
|
||||
{menu === 'done' ? (
|
||||
<span className="text-[#1f9d62]">처리했어요</span>
|
||||
) : 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>
|
||||
<button type="button" onClick={() => setMenu('closed')} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
취소
|
||||
</button>
|
||||
</>
|
||||
) : t.mine ? (
|
||||
<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={() => setMenu('confirm')} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
지우기
|
||||
</button>
|
||||
) : menu === 'report' ? (
|
||||
@@ -303,25 +307,39 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<button type="button" onClick={toggle} aria-pressed={liked} aria-label="좋아요" className={cx('relative cursor-pointer self-start pt-1', TAP44)}>
|
||||
<HeartIcon className={cx('size-4 stroke-2', liked ? 'fill-(--heart) stroke-(--heart)' : 'fill-none stroke-(--ink3)')} />
|
||||
</button>
|
||||
{/* 글 메뉴(⋯)는 하트 옆 오른쪽 위에: 아래 줄 끝에 두면 말줄임표처럼 읽힌다 */}
|
||||
<span className="flex items-start gap-4 self-start">
|
||||
{!IS_TOSS && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMenu(menu === 'closed' ? 'open' : 'closed')}
|
||||
aria-expanded={menu !== 'closed'}
|
||||
aria-label="글 메뉴"
|
||||
className={cx('relative cursor-pointer pt-0.5 text-[15px] leading-none font-extrabold tracking-[1px] text-(--ink3)', TAP44)}
|
||||
>
|
||||
⋯
|
||||
</button>
|
||||
)}
|
||||
<button type="button" onClick={toggle} aria-pressed={liked} aria-label="좋아요" className={cx('relative cursor-pointer pt-1', TAP44)}>
|
||||
<HeartIcon className={cx('size-4 stroke-2', liked ? 'fill-(--heart) stroke-(--heart)' : 'fill-none stroke-(--ink3)')} />
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** 이야기 탭: 쓰기 칸과 전국 최신 글 (아래로 더 받기) */
|
||||
/** 피드 위 쓰는 칸. 늘 펼쳐 두고, 방금 올린 글은 바로 아래에 보인다 (피드 사이 글은 새로 받을 때 섞인다) */
|
||||
export function FeedComposer({ onPosted }: { onPosted: (t: TalkData) => void }) {
|
||||
/** 피드 위 쓰는 칸. 늘 펼쳐 두고, 오늘 쓴 내 글은 바로 아래 '오늘 내 글' 묶음에 보인다 */
|
||||
export function FeedComposer() {
|
||||
if (IS_TOSS) return null
|
||||
return (
|
||||
<div className="mt-3.5">
|
||||
<Composer onDone={onPosted} />
|
||||
<Composer />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** 묶음에서 누른 글 하나를 창으로: 글 전체·큰 사진·좋아요·더보기 */
|
||||
/** 묶음에서 누른 글 하나를 창으로: 글 전체·큰 사진·좋아요·글 메뉴 */
|
||||
export function TalkSheet({ talk }: { talk: TalkData }) {
|
||||
return (
|
||||
<div className="flex-1 overflow-auto overscroll-contain px-4 pb-[18px]">
|
||||
@@ -333,19 +351,20 @@ export function TalkSheet({ talk }: { talk: TalkData }) {
|
||||
/** 피드에 끼우는 글 한 장 */
|
||||
export function TalkCard({ t, onGone }: { t: TalkData; onGone?: () => void }) {
|
||||
return (
|
||||
<article className="mt-3.5 border-y border-(--line) bg-white px-3" aria-label={`${t.nickname}의 글`}>
|
||||
<article className="mx-3 mt-3 rounded-[20px] bg-white px-3 shadow-[inset_0_-4px_0_var(--shade)]" aria-label={`${t.nickname}의 글`}>
|
||||
<TalkRow key={`${t.talk_id}:${t.liked}:${t.like_count}`} t={t} onGone={onGone} />
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
||||
/** 오늘 피드의 사람 글 묶음: 옆으로 넘기는 카드, 끝에 그 주제 전체 보기 */
|
||||
export function TalkGroup({ title, topic, talks }: { title: string; topic?: number; talks: TalkData[] }) {
|
||||
/** href: 오른쪽 위 '전체 보기'가 여는 곳 (없으면 이야기 탭의 그 주제) */
|
||||
export function TalkGroup({ title, topic, talks, href }: { title: string; topic?: number; talks: TalkData[]; href?: string }) {
|
||||
return (
|
||||
<section aria-label={title} className="mt-3.5">
|
||||
<div className="flex items-end justify-between px-4">
|
||||
<h2 className="m-0 font-jua text-[19px] font-normal">{title}</h2>
|
||||
<Link to={topic ? `/talk?topic=${topic}` : '/talk'} className="text-[13px] font-bold text-(--ink2)">
|
||||
<Link to={href ?? (topic ? `/talk?topic=${topic}` : '/talk')} className="text-[13px] font-bold text-(--ink2)">
|
||||
전체 보기
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user