- 사람 글 큰 카드: 머리줄·4:5 본문(사진, 없으면 글을 크게)·좋아요·댓글·보내기 - 사람 글 댓글: 로그인한 사람만, comment 표에 talk_id, talk.comment_count (init.sql) - '오늘 내 글'·'동네 사람들'·주제별 묶음, '이번 주 가까운 행사' 띠 제거 - 행사 포스트 자리 최대 40개, 앞쪽 절반에 다 못 들어가면 끝까지 한 장씩 걸러 - GA: feed_item_view(talk·event 노출), talk_comment
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import type { MyGak } from './myGakState'
|
|
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 }
|
|
|
|
/** 댓글이 달린 곳: 운영 포스트 또는 사람 글 */
|
|
export type CommentTarget = { postId: number } | { talkId: number }
|
|
type CommentsState = { type: 'comments'; draft?: string } & CommentTarget
|
|
|
|
export type SheetState =
|
|
| { type: 'gak'; indexId: number }
|
|
| { type: 'article'; articleId: number }
|
|
| { type: 'share'; share: SharePayload }
|
|
| CommentsState
|
|
| { type: 'seasonWeek' }
|
|
| { type: 'login'; then?: CommentsState; why?: 'level' }
|
|
| { type: 'me' }
|
|
| { type: 'region' }
|
|
| { type: 'mix'; shared?: MyGak }
|
|
| { type: 'myGak'; gak: MyGak; shot?: HTMLElement | null }
|
|
| { type: 'install' }
|
|
| { type: 'weatherWhy'; why: WeatherWhyPayload }
|
|
| { type: 'tarot' }
|
|
| { type: 'level' }
|
|
| { type: 'levelUp'; level: number }
|
|
| { type: 'gameHelp' }
|
|
| 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
|
|
}
|