feat: 피드를 시간대별 카드로 다시 짜고 하늘 배경·내 캐릭터 추가, 다른 시안 정리
- 피드: 그날 카드 12장을 03:00에 한 번에 만들고, 시간대(아침·낮·저녁·밤, 저녁은 일몰 2시간 전부터)마다 순서를 바꾸고 조건이 맞는 카드만 켠다. 새 카드 우산·특보, 내일 미리보기, 한 문장·시(예시 seed). 흐린 날 노을은 한 줄 카드.
- 캐시를 feed:{구}:{시간대}로 나누고 시간대 경계·일몰·예보 갱신 때 만료해 새 카드가 늦게 보이던 문제를 고친다.
- 히어로는 오늘 1위 각만 보여 준다.
- 각 점수·노을 점수를 7일 지나면 지운다.
- 화면 전체 하늘 배경(시간대별 색, 느린 일렁임, 밤 별)과 화면 끝까지 이어지는 위·아래 바.
- 상단바 로그인 버튼, 내 정보 창(캐릭터 6종·배경색 6종·오늘 기분 8종·닉네임·로그아웃), PATCH /v1/auth/me, 댓글·상단바에 캐릭터·배경색·기분 표시. users.character·color·mood 칸 추가.
- 카드 슬라이드와 가로 줄을 Embla 카로셀로 바꿔 PC에서도 마우스로 끌어 넘기고 화살표로 넘긴다.
- 좋아요·저장을 받아 둔 피드 데이터에도 반영해 다른 탭에 다녀와도 유지되게 고치고, 좋아요 때 하트가 터지는 애니메이션을 넣는다.
- 보내기에서 게시물을 인스타 스토리 크기(1080×1920) 이미지로 공유하거나 내려받는다 (modern-screenshot).
- 창이 열려 있는 동안 뒤 페이지 스크롤을 잠근다.
- 시안 B 확정: 시안 A 아이콘(public/a)과 쓰지 않는 전역 스타일·글꼴 삭제.
- 문서: 데이터 흐름 지도(backend/docs/data-flow-map.html), 확정 시안(docs/시안B_확정.html), 피드 기획 v2, 호출량·DB 크기 추정, data-pipeline 갱신. 보고 폴더와 예전 시안 html 삭제.
This commit is contained in:
1 parent
f8b47f064a
commit
a9ddbaab3c
93 files changed
+2322
-2751
No files matched your search
@@ -8,6 +8,7 @@ import { cardBg, fall, kindOfHour, kst, MEDALS, sidoOf, WEEKDAYS, type TimeKind
|
||||
import { PostCard } from './Post'
|
||||
import { useRegion } from './regionContext'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { useSky } from './skyContext'
|
||||
import { Ic, Rail, Sec, StateBox } from './ui'
|
||||
import { deg, skyText, slotAt } from './weatherText'
|
||||
|
||||
@@ -17,7 +18,7 @@ const MODES: [Mode, string][] = [
|
||||
['now', '지금 시간'],
|
||||
['morning', '아침'],
|
||||
['day', '낮'],
|
||||
['sunset', '노을'],
|
||||
['sunset', '저녁'],
|
||||
['night', '밤'],
|
||||
]
|
||||
|
||||
@@ -25,16 +26,12 @@ const MODES: [Mode, string][] = [
|
||||
const PREVIEW: Record<TimeKind, { label: string; clock: string; hour: number }> = {
|
||||
morning: { label: '아침', clock: '07:40', hour: 7 },
|
||||
day: { label: '낮', clock: '13:20', hour: 13 },
|
||||
sunset: { label: '노을', clock: '18:25', hour: 18 },
|
||||
sunset: { label: '저녁', clock: '18:25', hour: 18 },
|
||||
night: { label: '밤', clock: '22:10', hour: 22 },
|
||||
}
|
||||
|
||||
const STARS = Array.from({ length: 26 }, (_, i) => ({ left: `${(i * 37) % 100}%`, top: `${(i * 53) % 60}%`, opacity: 0.4 + ((i * 7) % 6) / 10 }))
|
||||
const ORB_POS = [
|
||||
{ left: '66%', top: '6px', d: '.5s', f: '4.4s' },
|
||||
{ left: '0%', top: '34px', d: '.7s', f: '5.1s' },
|
||||
{ left: '4%', top: '184px', d: '.9s', f: '4.7s' },
|
||||
]
|
||||
const ORB_POS = { left: '66%', top: '6px', d: '.5s', f: '4.4s' }
|
||||
|
||||
function useNow(ms = 20000) {
|
||||
const [now, setNow] = useState(() => new Date())
|
||||
@@ -52,13 +49,18 @@ function Hero({ hero, today }: HeroProps) {
|
||||
const [mode, setMode] = useState<Mode>('now')
|
||||
const clock = useNow()
|
||||
const t = kst(clock)
|
||||
const kind = mode === 'now' ? (hero?.sky_mode ?? kindOfHour(t.h)) : mode
|
||||
const kind = mode === 'now' ? (hero?.sky_mode ?? kindOfHour(t.h, t.mo, t.mi)) : mode
|
||||
const { setServerKind, setPreview } = useSky()
|
||||
// 화면 전체 하늘 배경도 같은 시간대로 맞춘다
|
||||
useEffect(() => setServerKind(hero?.sky_mode ?? null), [hero?.sky_mode, setServerKind])
|
||||
useEffect(() => setPreview(mode === 'now' ? null : mode), [mode, setPreview])
|
||||
useEffect(() => () => setPreview(null), [setPreview])
|
||||
const slots = today?.slots ?? []
|
||||
const slot = slots.length ? slotAt(slots, mode === 'now' ? t.h : PREVIEW[mode].hour) : undefined
|
||||
// 지금은 /v1/feed hero 값을, 미리보기는 그 시각의 예보 칸을 쓴다
|
||||
const temp = mode === 'now' && hero ? hero.temp_c : slot?.temp_c
|
||||
const feels = mode === 'now' && hero ? hero.feels_c : slot?.feels_c
|
||||
const top3 = hero?.top3 ?? []
|
||||
const top1 = hero?.top1
|
||||
const who = kind === 'night' ? 'bear' : 'rabbit'
|
||||
|
||||
return (
|
||||
@@ -112,24 +114,23 @@ function Hero({ hero, today }: HeroProps) {
|
||||
</span>
|
||||
</div>
|
||||
<span className="b-cloud b-fall top-[188px] left-[54%] h-10 w-[118px]" style={fall('.25s', '6.4s')} aria-hidden="true" />
|
||||
{top3.map((g, i) => (
|
||||
{top1 && (
|
||||
<button
|
||||
key={g.index_id}
|
||||
type="button"
|
||||
onClick={() => open({ type: 'gak', indexId: g.index_id })}
|
||||
aria-label={`${i + 1}위 ${g.name} ${g.score}점, 계산 근거 보기`}
|
||||
onClick={() => open({ type: 'gak', indexId: top1.index_id })}
|
||||
aria-label={`1위 ${top1.name} ${top1.score}점, 계산 근거 보기`}
|
||||
className="b-fall absolute z-[2] flex w-24 cursor-pointer flex-col items-center"
|
||||
style={{ left: ORB_POS[i].left, top: ORB_POS[i].top, ...fall(ORB_POS[i].d, ORB_POS[i].f) }}
|
||||
style={{ left: ORB_POS.left, top: ORB_POS.top, ...fall(ORB_POS.d, ORB_POS.f) }}
|
||||
>
|
||||
<span className={cx('relative', i === 0 ? 'w-[78px]' : 'w-[60px]')}>
|
||||
<Ic name={g.icon} className="w-full drop-shadow-[0_10px_12px_rgb(40_48_74/0.16)]" />
|
||||
<Ic name={MEDALS[i]} className="absolute -top-2 -left-3.5 w-[30px]" />
|
||||
<span className="relative w-[78px]">
|
||||
<Ic name={top1.icon} className="w-full drop-shadow-[0_10px_12px_rgb(40_48_74/0.16)]" />
|
||||
<Ic name={MEDALS[0]} className="absolute -top-2 -left-3.5 w-[30px]" />
|
||||
</span>
|
||||
<span className="b-orb-label font-jua text-sm whitespace-nowrap">
|
||||
{i + 1}위 {g.name} <em className="font-bagel text-(--orange) not-italic">{g.score}</em>
|
||||
1위 {top1.name} <em className="font-bagel text-(--orange) not-italic">{top1.score}</em>
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
)}
|
||||
</div>
|
||||
{hero?.bubble && (
|
||||
<div className="relative z-[3] flex items-end gap-2">
|
||||
@@ -257,7 +258,7 @@ export function TodayPage() {
|
||||
<div>
|
||||
{posts.map((p, i) => (
|
||||
<Fragment key={p.post_id}>
|
||||
<PostCard key={`${p.post_id}-${p.liked}-${p.saved}-${p.like_count}`} post={p} />
|
||||
<PostCard post={p} />
|
||||
{bandAt.find(([at]) => at === i + 1)?.[1]}
|
||||
</Fragment>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user