feat: 앱도 웹과 같이 — 히어로·달 포스트를 오늘 밤 실제 달 모양으로(저녁엔 노을빛, 어두운 달이면 흰 점수), 캐릭터 댓글에 '날씨각' 표시·신고 메뉴 없음
This commit is contained in:
1 parent
197fafdc02
commit
a87f245547
4 files changed
+132
-11
No files matched your search
@@ -5,11 +5,12 @@ import type { SlideBg } from '@nalssigak/shared/lib/types';
|
||||
import { deg } from '@nalssigak/shared/lib/weatherText';
|
||||
import { Image } from 'expo-image';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useState, type ReactNode } from 'react';
|
||||
import { Pressable, StyleSheet, View } from 'react-native';
|
||||
import { Text } from '@/components/text';
|
||||
import Svg, { Polygon } from 'react-native-svg';
|
||||
|
||||
import { MoonArt } from '@/components/moon';
|
||||
import { Credit, Ic, Rows, Thumb } from '@/components/ui';
|
||||
import { CARD_BG } from '@/lib/colors';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
@@ -54,7 +55,7 @@ export function slideBg(post: PostData, slide: Slide): SlideBg {
|
||||
if (slide.kind === 'week') return 'mint';
|
||||
if (slide.kind === 'plan') return slide.eyebrow.startsWith('일') ? 'peach' : 'butter';
|
||||
if (slide.kind === 'gak') return GAK_BG[post.post_id % GAK_BG.length];
|
||||
if (post.post_type === PostType.EVENT) return 'night';
|
||||
if (post.post_type === PostType.EVENT || post.post_type === PostType.MOON) return 'night';
|
||||
if (post.post_type === PostType.TIP) return 'sky';
|
||||
if (post.post_type === PostType.AIR) return slide.icon === 'vent' ? 'mint' : 'lilac';
|
||||
if (post.post_type === PostType.DAY_TRIP) return slide.image ? 'night' : 'mint';
|
||||
@@ -86,6 +87,28 @@ function Pic({ name, widthPct = 42 }: { name: string; widthPct?: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
// 달 포스트 밤하늘 별: [left %, top %, 크기]
|
||||
const STARS: [number, number, number][] = [
|
||||
[8, 34, 2], [18, 52, 1.5], [30, 40, 2.5], [44, 30, 1.5], [52, 58, 2], [62, 22, 1.5], [90, 18, 2], [94, 44, 1.5], [12, 70, 1.5], [38, 66, 2], [76, 74, 1.5], [86, 64, 2], [24, 12, 1.5], [70, 10, 2.5],
|
||||
];
|
||||
|
||||
/** 달 포스트 그림: 아이콘 대신 오늘 밤 실제 모양의 달과 별 */
|
||||
function MoonPic({ pct, waxing }: { pct: number; waxing: boolean }) {
|
||||
const [w, setW] = useState(0);
|
||||
return (
|
||||
<View pointerEvents="none" style={StyleSheet.absoluteFill} onLayout={(e) => setW(e.nativeEvent.layout.width)}>
|
||||
{STARS.map(([x, y, s]) => (
|
||||
<View key={`${x},${y}`} className="absolute rounded-full bg-white opacity-80" style={{ left: `${x}%`, top: `${y}%`, width: s, height: s }} />
|
||||
))}
|
||||
{w > 0 && (
|
||||
<View className="absolute top-[22%] right-0">
|
||||
<MoonArt pct={pct} waxing={waxing} size={w * 0.6} />
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
|
||||
const { open } = useSheet();
|
||||
const { kind } = useSky();
|
||||
@@ -246,13 +269,14 @@ export function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
|
||||
);
|
||||
return (
|
||||
<Base colors={colors}>
|
||||
{slide.moon_pct != null && <MoonPic pct={slide.moon_pct} waxing={!!slide.moon_waxing} />}
|
||||
<Eyebrow light={light} className={light ? 'opacity-85' : undefined}>
|
||||
{slide.eyebrow}
|
||||
</Eyebrow>
|
||||
<Big light={light} className="z-[1]">
|
||||
{slide.line}
|
||||
</Big>
|
||||
<Pic name={slide.icon} widthPct={36} />
|
||||
{slide.moon_pct == null && <Pic name={slide.icon} widthPct={36} />}
|
||||
<Rows rows={slide.rows ?? []} dark={light} />
|
||||
</Base>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user