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:
1 parent
e8b8cc79b6
commit
01b5f917b9
16 files changed
+449
-156
No files matched your search
@@ -1,62 +1,18 @@
|
||||
import type { BandArticle, BandEvent, TopIndex } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { cardBg, MEDALS } from '@nalssigak/shared/lib';
|
||||
import type { BandArticle } from '@nalssigak/shared/api/client/types.gen';
|
||||
import { cardBg } from '@nalssigak/shared/lib';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { Link, type Href } from 'expo-router';
|
||||
import type { Href } from 'expo-router';
|
||||
import type { ReactNode } from 'react';
|
||||
import { Pressable, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
|
||||
import { Ic, Rail, Sec, Skel, Thumb } from '@/components/ui';
|
||||
import { Rail, Sec, Thumb } from '@/components/ui';
|
||||
import { CARD_BG, BAND_BG } from '@/lib/colors';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
const CARD = 'overflow-hidden rounded-[22px] border-b-[5px] border-shade bg-card';
|
||||
|
||||
/** 오늘의 각 순위: 동그라미 + 이름 + 점수. 지금 시간대가 아닌 각은 흐리게 */
|
||||
export function Stories({ items }: { items: TopIndex[] }) {
|
||||
const { open } = useSheet();
|
||||
return (
|
||||
<Rail>
|
||||
{items.map((g, i) => (
|
||||
<Pressable key={g.index_id} onPress={() => open({ type: 'gak', indexId: g.index_id })} accessibilityLabel={g.active ? `${g.rank}위 ${g.name} ${g.score}점` : `${g.name}, 지금 시간대 아님`} className={`w-[72px] items-center gap-1 ${g.active ? '' : 'opacity-55'}`}>
|
||||
<View className="size-[68px]">
|
||||
{!g.active || g.score < 50 ? (
|
||||
<View className="absolute inset-0 rounded-full bg-[#d6deea]" />
|
||||
) : (
|
||||
<LinearGradient colors={['#ff7a45', '#ffc86e', '#8fcaff']} start={{ x: 0, y: 0 }} end={{ x: 1, y: 1 }} style={{ position: 'absolute', inset: 0, borderRadius: 34 }} />
|
||||
)}
|
||||
<View className="m-[3px] flex-1 items-center justify-center rounded-full border-[3px] border-page bg-page">
|
||||
<Ic name={g.icon} size={42} />
|
||||
</View>
|
||||
{i < 3 && g.active && <Ic name={MEDALS[i]} size={25} style={{ position: 'absolute', right: -4, bottom: -4 }} />}
|
||||
</View>
|
||||
<Text numberOfLines={1} className="font-jua text-[13px] text-ink">
|
||||
{g.name}
|
||||
</Text>
|
||||
{g.active ? <Text className="font-bagel text-[12.5px] leading-[14px] text-orange">{g.score}</Text> : <Text className="text-[11px] leading-[14px] font-extrabold text-ink3">지금 아님</Text>}
|
||||
</Pressable>
|
||||
))}
|
||||
</Rail>
|
||||
);
|
||||
}
|
||||
|
||||
const SKELS = Array.from({ length: 6 }, (_, i) => i);
|
||||
|
||||
export function StoriesSkel() {
|
||||
return (
|
||||
<Rail>
|
||||
{SKELS.map((i) => (
|
||||
<View key={i} className="w-[72px] items-center gap-1.5">
|
||||
<View className="size-[68px] rounded-full bg-skel" />
|
||||
<Skel className="w-12" />
|
||||
<Skel className="w-6" />
|
||||
</View>
|
||||
))}
|
||||
</Rail>
|
||||
);
|
||||
}
|
||||
|
||||
function Band({ tone, title, sub, to, children }: { tone: 1 | 2 | 3; title: string; sub: string; to: Href; children: ReactNode }) {
|
||||
const { kind } = useSky();
|
||||
return (
|
||||
@@ -75,48 +31,6 @@ function useCardBg() {
|
||||
return CARD_BG[kind === 'night' ? 'night' : 'day'];
|
||||
}
|
||||
|
||||
export function EventsBand({ events }: { events: BandEvent[] }) {
|
||||
const bg = useCardBg();
|
||||
return (
|
||||
<Band tone={1} title="이번 주 가까운 행사" sub="30km 안 · 날씨까지 같이 보고 골라요" to="/week">
|
||||
<Rail>
|
||||
{events.map((e, i) => (
|
||||
<Link key={e.event_id} href="/week" asChild>
|
||||
<Pressable className={`w-[200px] ${CARD}`}>
|
||||
<Thumb image={e.image} icon={e.icon} iconSize={76} className="h-[116px]">
|
||||
<LinearGradient colors={bg[cardBg(e.icon, i)]} style={{ position: 'absolute', inset: 0, zIndex: -1 }} />
|
||||
<View className={`absolute top-2.5 left-2.5 rounded-full px-2 py-[3px] ${e.status_label === '진행 중' ? 'bg-[#1f9d62]' : 'bg-orange'}`}>
|
||||
<Text className="text-[11.5px] font-extrabold text-white">{e.status_label}</Text>
|
||||
</View>
|
||||
</Thumb>
|
||||
<Text className="px-3 pt-2.5 pb-3 font-jua text-[16.5px] leading-snug text-ink">{e.name}</Text>
|
||||
</Pressable>
|
||||
</Link>
|
||||
))}
|
||||
</Rail>
|
||||
</Band>
|
||||
);
|
||||
}
|
||||
|
||||
export function TopBand({ items, sub }: { items: TopIndex[]; sub: string }) {
|
||||
const { open } = useSheet();
|
||||
return (
|
||||
<Band tone={2} title="지금 뜨는 각 TOP 5" sub={sub} to="/gak">
|
||||
<Rail>
|
||||
{items.slice(0, 5).map((g, i) => (
|
||||
<Pressable key={g.index_id} onPress={() => open({ type: 'gak', indexId: g.index_id })} className="w-[138px] gap-1 rounded-[22px] border-b-[5px] border-shade bg-card p-3">
|
||||
{i < 3 ? <Ic name={MEDALS[i]} size={26} style={{ position: 'absolute', top: 8, left: 8 }} /> : <Text className="absolute top-2.5 left-3 font-jua text-ink3">{i + 1}위</Text>}
|
||||
<Ic name={g.icon} size={58} style={{ alignSelf: 'center' }} />
|
||||
<Text className="font-jua text-base text-ink">{g.name}</Text>
|
||||
<Text className="font-bagel text-[22px] leading-[24px] text-orange">{g.score}</Text>
|
||||
{g.summary && <Text className="text-xs font-semibold text-ink2">{g.summary}</Text>}
|
||||
</Pressable>
|
||||
))}
|
||||
</Rail>
|
||||
</Band>
|
||||
);
|
||||
}
|
||||
|
||||
export function SeasonBand({ news }: { news: BandArticle[] }) {
|
||||
const bg = useCardBg();
|
||||
const { open } = useSheet();
|
||||
|
||||
Reference in new issue
Block a user