Files
o2o-weather/frontend/src/b/sheetContext.ts
T
minaChoi ffe6153148 feat: 내 각 아이콘·상세, 이야기 내 글·무한 스크롤, 공유 이미지 얇은 띠, 행사 주소 수집
- 내 각: 아이콘 고르기(my_gak.icon), 카드는 아이콘·점수·아쉬운 조건만, 눌러서 상세(시간대·조건별 점수), 공유는 공통 공유 창
- 이야기: 오늘 쓴 내 글 묶음, '내 글' 칩·탭, 무한 스크롤, 사진 카메라 버튼, 지우기 확인, ⋯ 메뉴 하트 옆, 글 시간 서버 계산(1일 전)
- 공유 이미지: 1:1·4:5 는 아래 얇은 띠 한 줄로 카드를 크게
- 행사: 수집 때 주소 저장(event.address), 행사 포스트에 장소·주소·기간
- 히어로 말풍선 '오늘 낮은 / 내일 낮은', 내일을 볼 때 배경도 따라감, 달 보름 순간이 낮이면 뜨는 시각으로
- 단풍 지도 피드 맨 위, 행사·계절 띠 포스트 틀 되돌림, 쇼츠 홈 버튼 가림·닫기 버튼, 하단 여백, 회색 글자 대비
- 토스 앱에선 쇼츠 플레이어를 하나만 띄움
2026-10-27 18:55:42 +09:00

35 lines
1.3 KiB
TypeScript

import type { MyGak } from './myGakState'
import type { TalkData } from '@nalssigak/shared/api/client/types.gen'
import type { WeatherWhyPayload } from './weatherWhy'
import { createContext, use } from 'react'
/** square: 1:1 비율일 때 slides 대신 찍을 틀 (없으면 slides). url: 같이 보낼 링크 (없으면 사이트 주소) */
export type SharePayload = { title: string; slides: HTMLElement[]; square?: HTMLElement[]; url?: string }
type CommentsState = { type: 'comments'; postId: number; draft?: string }
export type SheetState =
| { type: 'gak'; indexId: number }
| { type: 'article'; articleId: number }
| { type: 'share'; share: SharePayload }
| CommentsState
| { type: 'seasonWeek' }
| { type: 'login'; then?: CommentsState }
| { type: 'me' }
| { type: 'region' }
| { type: 'mix'; shared?: MyGak }
| { type: 'myGak'; gak: MyGak; shot?: HTMLElement | null }
| { type: 'install' }
| { type: 'weatherWhy'; why: WeatherWhyPayload }
| { type: 'talk'; talk: TalkData }
| null
export type SheetApi = { open: (s: Exclude<SheetState, null>) => void; close: () => void }
export const SheetContext = createContext<SheetApi | null>(null)
export function useSheet() {
const ctx = use(SheetContext)
if (!ctx) throw new Error('useSheet must be used inside SheetProvider')
return ctx
}