feat: 앱 나머지 화면 이전 — 게시물 카드·시트·각/노을/주말/계절 탭·움직임
- 게시물 카드 슬라이드 7종, 좋아요·댓글, 텍스트 공유 - 시트 7종(RN Modal), 위 막대 지역·계절·로그인/아바타 - 각·노을·주말·행사·계절·상식 탭, 당겨서 새로고침 - 히어로 해·구름·비·눈 움직임, 스켈레톤 깜빡임, 첫 로딩 덮개, 하늘색 전환
This commit is contained in:
1 parent
28ff032160
commit
f71dd2cebb
33 files changed
+2786
-75
No files matched your search
@@ -3,37 +3,59 @@ import { kst, seasonOf } from '@nalssigak/shared/lib';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { usePathname } from 'expo-router';
|
||||
import { useState } from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useCSSVariable } from 'uniwind';
|
||||
|
||||
import { PinIcon } from '@/components/svg';
|
||||
import { Ic } from '@/components/ui';
|
||||
import { Avatar, Ic } from '@/components/ui';
|
||||
import { useAuth } from '@/lib/auth';
|
||||
import { useRegion } from '@/lib/region';
|
||||
import { useSheet } from '@/lib/sheet';
|
||||
import { useSky } from '@/lib/sky';
|
||||
|
||||
const TITLES: Record<string, string> = { '/sky': '노을', '/gak': '오늘의 각', '/week': '주말·행사', '/season': '계절·상식' };
|
||||
|
||||
/** 로고 옆 계절 칩: 계절 이름과 지금 절기 */
|
||||
/** 로고 옆 계절 칩: 계절 이름과 지금 절기. 누르면 이번 주 절기 창 */
|
||||
function SeasonChip() {
|
||||
const { open } = useSheet();
|
||||
const week = useQuery(getSeasonWeekOptions());
|
||||
const [month] = useState(() => kst(new Date()).mo);
|
||||
const [name, icon] = seasonOf(month);
|
||||
const term = week.data?.term_now?.name;
|
||||
return (
|
||||
<View className="shrink flex-row items-center gap-1 rounded-full bg-card/70 py-1 pr-2.5 pl-1.5">
|
||||
<Pressable onPress={() => open({ type: 'seasonWeek' })} accessibilityLabel={`지금 ${name}${term ? `, ${term}` : ''}. 이번 주 절기 보기`} className="shrink flex-row items-center gap-1 rounded-full bg-card/70 py-1 pr-2.5 pl-1.5">
|
||||
<Ic name={icon} size={18} />
|
||||
<Text numberOfLines={1} className="text-[13px] font-extrabold text-ink">
|
||||
<Text numberOfLines={1} className="shrink text-[13px] font-extrabold text-ink">
|
||||
{name}
|
||||
{term && <Text className="font-bold opacity-70"> · {term}</Text>}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
|
||||
/** 오른쪽 끝: 내 정보(아바타) 또는 로그인 버튼 */
|
||||
function Account() {
|
||||
const { open } = useSheet();
|
||||
const { me, mePending } = useAuth();
|
||||
if (mePending) return <View className="size-9 shrink-0 rounded-full bg-skel" />;
|
||||
if (me)
|
||||
return (
|
||||
<Pressable onPress={() => open({ type: 'me' })} accessibilityLabel={`내 정보, ${me.nickname}`} className="shrink-0 rounded-full" style={{ boxShadow: '0 6px 12px rgb(40 48 74 / 0.12)' }}>
|
||||
<Avatar character={me.character} color={me.color} mood={me.mood} size={36} />
|
||||
</Pressable>
|
||||
);
|
||||
return (
|
||||
<Pressable onPress={() => open({ type: 'login' })} className="shrink-0 rounded-full bg-ink-btn px-3 py-1.5">
|
||||
<Text className="text-[13px] font-extrabold text-white">로그인</Text>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
|
||||
export function TopBar() {
|
||||
const pathname = usePathname();
|
||||
const { region } = useRegion();
|
||||
const { open } = useSheet();
|
||||
const { kind } = useSky();
|
||||
const { top } = useSafeAreaInsets();
|
||||
const ink = String(useCSSVariable('--color-ink'));
|
||||
@@ -43,12 +65,13 @@ export function TopBar() {
|
||||
<View className="h-[54px] flex-row items-center gap-2 px-4">
|
||||
{title ? <Text className="font-jua text-[22px] text-ink">{title}</Text> : <Text className="font-jua text-[25px] text-orange">날씨각</Text>}
|
||||
<SeasonChip />
|
||||
<View className="ml-auto shrink-0 flex-row items-center gap-1 rounded-full border-b-4 border-shade bg-card px-3 pt-1 pb-1.5">
|
||||
<Pressable onPress={() => open({ type: 'region' })} accessibilityLabel={`위치 바꾸기, 지금 ${region.name}`} className="ml-auto shrink-0 flex-row items-center gap-1 rounded-full border-b-4 border-shade bg-card px-3 pt-1 pb-1.5">
|
||||
<PinIcon size={14} color={ink} />
|
||||
<Text numberOfLines={1} className="text-[13.5px] font-bold text-ink">
|
||||
{region.name.split(' ').at(-1)}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
<Account />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user