feat: 앱 오늘 피드를 웹과 맞춤 — 히어로 오늘/내일 전환·좋아요·댓글·보내기·점수 근거 창, 오늘의 각 카드(gak_post), 날씨각 카드(그림 슬라이드), 행사·TOP5 띠 없앰, 좋아요·댓글 로그인 없이 (GA hero_day_switch, like hero_post·gak_post)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
skkimandClaude committed 2026-11-04 17:23:44 +09:00
1 parent e8b8cc79b6
commit 01b5f917b9
16 files changed
+449 -156

No files matched your search

@@ -0,0 +1,86 @@
import type { WeatherWhy } from '@nalssigak/shared/api/client/types.gen';
import { View } from 'react-native';
import { Text } from '@/components/text';
import { Body, useSoft } from './parts';
/** status: 히어로 상태 줄 그대로 (단계 이름, 실제 값) */
export type WeatherWhyPayload = { label: string; score: number; why: WeatherWhy[]; status?: { label: string; value: string; tone?: string; detail?: string | null }[] };
// 조건마다 같은 색을 막대 칸과 아래 줄 점에 같이 써서 이어 보이게 (웹 weatherWhy.tsx)
const COLOR: Record<string, string> = { 기온: '#ff7a45', 비: '#4f97e3', 햇볕: '#ffb02e', 바람: '#5fb8b0', 습도: '#8e8cf0', 미세먼지: '#b59a86' };
const colorOf = (label: string) => COLOR[label] ?? '#9aa3b8';
// 상태 줄 항목마다 단계를 나누는 기준 (backend/services/hero_stats.py 와 같은 값)
const RULE: Record<string, string> = {
습도: '30% 아래는 건조, 60% 넘으면 습함이에요',
불쾌지수: '68 아래는 쾌적, 75부터 불쾌예요',
자외선: '3 아래는 낮음, 6부터 높음이에요',
미세먼지: '에어코리아 기준 등급이에요',
};
/** 날씨 점수 근거: 비중만큼 나눈 막대(채운 만큼 얻은 점수)와 조건별 지금 값 */
export function WeatherWhySheet({ d }: { d: WeatherWhyPayload }) {
const s = useSoft();
return (
<Body>
<View className="flex-row items-baseline gap-2">
<Text className="font-bagel text-[44px] leading-[48px] text-ink">{d.score}</Text>
<Text className="font-jua text-[17px] text-ink2">{d.label} 날씨 점수</Text>
</View>
<View className="mt-3 h-7 flex-row gap-[3px] overflow-hidden rounded-[10px]" accessibilityRole="image" accessibilityLabel={d.why.map((w) => `${w.label} 비중 ${w.weight}% 중 ${w.score}점`).join(', ')}>
{d.why.map((w) => (
<View key={w.label} className="h-full" style={{ width: `${w.weight}%`, backgroundColor: s.bar }}>
<View className="absolute inset-y-0 left-0" style={{ width: `${w.score}%`, backgroundColor: colorOf(w.label) }} />
</View>
))}
</View>
<Text className="mt-1.5 text-[12.5px] font-semibold text-ink3">칸 넓이는 비중, 채운 만큼이 얻은 점수예요</Text>
<View className="mt-3 gap-1.5">
{d.why.map((w) => (
<View key={w.label} className="flex-row items-center gap-3 rounded-2xl px-3.5 py-2.5" style={{ backgroundColor: s.soft }}>
<View className="size-3 rounded-full" style={{ backgroundColor: colorOf(w.label) }} />
<View className="min-w-0 flex-1">
<Text className="font-jua text-[16px] leading-tight text-ink">
{w.label} <Text className="font-sans text-[12px] font-bold text-ink3">비중 {w.weight}%</Text>
</Text>
<Text className="text-[13px] font-semibold text-ink2">{w.note}</Text>
</View>
<Text className="font-jua text-[20px] text-ink">{w.score}</Text>
</View>
))}
</View>
{!!d.status?.length && (
<>
<Text className="mt-5 font-jua text-[17px] text-ink">지금 상태</Text>
<View className="mt-2 gap-1.5">
{d.status.map((x) => (
<View key={x.label} className="flex-row items-center gap-3 rounded-2xl px-3.5 py-2.5" style={{ backgroundColor: s.soft }}>
<View className="min-w-0 flex-1">
<Text className="font-jua text-[16px] leading-tight text-ink">{x.label}</Text>
{!!RULE[x.label] && <Text className="text-[12.5px] font-semibold text-ink3">{RULE[x.label]}</Text>}
</View>
<View className="items-end">
<Text className={`font-jua text-[18px] leading-tight ${x.tone === 'warn' ? 'text-[#d4552a]' : 'text-ink'}`}>
{x.value}
</Text>
{x.detail?.split(' · ').map((v) => (
<Text key={v} className="text-[12px] font-bold text-ink2">
{v}
</Text>
))}
</View>
</View>
))}
</View>
</>
)}
<Text className="mt-3 text-[13px] leading-relaxed font-semibold text-ink2">조건마다 점수를 매겨 비중대로 합쳐요. 유난히 아쉬운 조건이 있으면 조금 더 깎고, 모든 조건이 완벽할 때만 만점이 나와요.</Text>
</Body>
);
}