feat: 단풍 지도·이번 주 행사 띠·계절 이야기 띠에 좋아요·댓글(서버 포스트 자리 18·19·20), 히어로 아래 글자 칸 높이를 미리 잡아 오늘의 각부터 피드가 밀려 내려가던 문제 수정
This commit is contained in:
1 parent
eb84a72c2f
commit
03e54ad552
9 files changed
+60
-25
No files matched your search
@@ -21,7 +21,7 @@ import { InstallBanner } from './installBanner'
|
||||
import { MyGakRow } from './myGak'
|
||||
import { fromShare } from './myGakState'
|
||||
import { PostCard, PostCardSkel, PostFrame } from './Post'
|
||||
import { usePinnedLike } from './pinnedLike'
|
||||
import { usePinnedLike, type PinnedKey } from './pinnedLike'
|
||||
import { FeedComposer, TalkCard } from './talk'
|
||||
import { useFeedTalks } from './talkState'
|
||||
import { useRegion } from './regionContext'
|
||||
@@ -399,7 +399,8 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="relative z-[3] text-center">
|
||||
{/* 다 불러온 높이(한 줄 말·날씨 한 줄·상태 두 줄)를 미리 잡아 둔다: 늦게 채워지며 아래 피드가 밀려 내려가지 않게 */}
|
||||
<div className="relative z-[3] min-h-[103px] text-center">
|
||||
{top1 ? (
|
||||
<button
|
||||
type="button"
|
||||
@@ -521,18 +522,21 @@ function PostsSkel() {
|
||||
)
|
||||
}
|
||||
|
||||
function Band({ tone, title, sub, to, children }: { tone: 1 | 2 | 3; title: string; sub: string; to: string; children: ReactNode }) {
|
||||
/** 띠도 포스트 틀에 담아 좋아요·댓글·보내기를 단다 (post 는 서버의 띠 자리) */
|
||||
function Band({ tone, title, sub, to, avatar, post, pinKey, children }: { tone: 1 | 2 | 3; title: string; sub: string; to: string; avatar: string; post?: PostReaction | null; pinKey: PinnedKey; children: ReactNode }) {
|
||||
return (
|
||||
<section className={cx('mt-3.5 pt-4 pb-3.5', `b-band-${tone}`)} aria-label={title}>
|
||||
<Sec title={title} sub={sub} more={{ to }} className="pt-0" />
|
||||
{children}
|
||||
</section>
|
||||
<PostFrame title={title} account={title} avatar={avatar} pinned={{ key: pinKey, post }}>
|
||||
<section className={cx('pt-4 pb-3.5', `b-band-${tone}`)} aria-label={title}>
|
||||
<Sec title={title} sub={sub} more={{ to }} className="pt-0" />
|
||||
{children}
|
||||
</section>
|
||||
</PostFrame>
|
||||
)
|
||||
}
|
||||
|
||||
function EventsBand({ events }: { events: BandEvent[] }) {
|
||||
function EventsBand({ events, post }: { events: BandEvent[]; post?: PostReaction | null }) {
|
||||
return (
|
||||
<Band tone={1} title="이번 주 가까운 행사" sub="30km 안 · 날씨까지 같이 보고 골라요" to="/week">
|
||||
<Band tone={1} title="이번 주 가까운 행사" sub="30km 안 · 날씨까지 같이 보고 골라요" to="/week" avatar="fireworks" post={post} pinKey="events_post">
|
||||
<Rail>
|
||||
{events.map((e, i) => (
|
||||
<Link key={e.event_id} to="/week" className="w-[200px] overflow-hidden rounded-[22px] bg-white shadow-[inset_0_-5px_0_var(--shade),0_8px_16px_rgb(40_48_74/0.06)]">
|
||||
@@ -549,10 +553,10 @@ function EventsBand({ events }: { events: BandEvent[] }) {
|
||||
)
|
||||
}
|
||||
|
||||
function SeasonBand({ news }: { news: BandArticle[] }) {
|
||||
function SeasonBand({ news, post }: { news: BandArticle[]; post?: PostReaction | null }) {
|
||||
const { open } = useSheet()
|
||||
return (
|
||||
<Band tone={3} title="이번 주 계절 이야기" sub="예년 이맘때의 소식" to="/season">
|
||||
<Band tone={3} title="이번 주 계절 이야기" sub="예년 이맘때의 소식" to="/season" avatar="fallen_leaf" post={post} pinKey="season_post">
|
||||
<Rail>
|
||||
{news.map((a) => (
|
||||
<button key={a.article_id} type="button" onClick={() => open({ type: 'article', articleId: a.article_id })} className="w-[200px] cursor-pointer overflow-hidden rounded-[22px] bg-white text-left shadow-[inset_0_-5px_0_var(--shade),0_8px_16px_rgb(40_48_74/0.06)]">
|
||||
@@ -615,8 +619,8 @@ export function TodayPage() {
|
||||
|
||||
// 디자인대로 3·6·9번째 글 뒤에 띠를 넣고, 글이 모자라면 남은 띠는 맨 뒤에 붙인다
|
||||
const bandAt: [number, ReactNode][] = [
|
||||
[3, bands?.events?.length ? <EventsBand key="events" events={bands.events} /> : null],
|
||||
[9, bands?.season?.length ? <SeasonBand key="season" news={bands.season} /> : null],
|
||||
[3, bands?.events?.length ? <EventsBand key="events" events={bands.events} post={f?.events_post} /> : null],
|
||||
[9, bands?.season?.length ? <SeasonBand key="season" news={bands.season} post={f?.season_post} /> : null],
|
||||
]
|
||||
|
||||
return (
|
||||
@@ -646,7 +650,7 @@ export function TodayPage() {
|
||||
{posts.map((p, i) => (
|
||||
<Fragment key={p.post_id}>
|
||||
<PostCard post={p} />
|
||||
{i === 1 && <FoliageCard />}
|
||||
{i === 1 && <FoliageCard post={f?.foliage_post} />}
|
||||
{i > 0 && i % TALK_EVERY === 0 && talks[i / TALK_EVERY - 1] && <TalkCard t={talks[i / TALK_EVERY - 1]} />}
|
||||
{bandAt.find(([at]) => at === i + 1)?.[1]}
|
||||
</Fragment>
|
||||
|
||||
Reference in new issue
Block a user