feat: 오늘 화면 히어로 아래 날씨각 유튜브 쇼츠 줄 — 첫 카드 소리 없이 자동재생, 누르면 전체 화면에서 위아래로 넘겨 보기. 목록은 /v1/shorts(API 키 있으면 채널 쇼츠, 없으면 설정한 영상 ID), 1시간 캐시
This commit is contained in:
1 parent
f9988855d3
commit
b718955927
15 files changed
+875
-6
No files matched your search
@@ -59,6 +59,9 @@
|
||||
| [ ] | 단풍 지도 '첫 단풍'은 절정 14일 전부터로 추정(발표에 시작일 없음). 예측 지점이 아닌 명소 32곳은 가장 가까운 예측 지점 날짜를 빌림(예: 남산공원·창덕궁 ← 수리산). 실제 관측과 다를 수 있음 | 사용자 결정 10/21 | `frontend/seo/foliage_2026.json` |
|
||||
| [ ] | 토스 미니앱 최신 버전 재등록 — 웹이 바뀌면 자동 반영 안 됨 | 10/21 회의 | |
|
||||
| [ ] | 유튜브 숏폼 자동화 진행 방안 협의 (김성경, 10/22) | 10/21 회의 | |
|
||||
| [ ] | 오늘 화면 쇼츠 줄 — YouTube Data API 키(`YOUTUBE_API_KEY`) 발급해 운영 .env 에 넣기. 없으면 `youtube_shorts`(영상 ID 3개 고정)만 나와 새 쇼츠가 자동으로 안 붙음 (https://console.cloud.google.com/apis/library/youtube.googleapis.com) | 채널 RSS가 404라 키 없이 채널 목록을 못 받음 | `backend/config/settings.py`, `backend/services/shorts_service.py` |
|
||||
| [ ] | **[결정 필요]** 쇼츠 줄 문구 '날씨각 쇼츠' 검토 | 화면 문구 규칙 | `frontend/src/b/Shorts.tsx` |
|
||||
| [ ] | 쇼츠 자동재생 아이폰 사파리 실기기 확인 — 소리 꺼도 자동재생을 막는다는 보고 있음 | 헤드리스 크롬에서만 확인 | `frontend/src/b/Shorts.tsx` |
|
||||
| [ ] | 인스타 운영 관리자 페이지(자동 게시 전 승인 메일) + 초기 이야기형 피드(각 100개·빨래각·소맥각·점수 산정법) | 10/21 회의 | |
|
||||
| [ ] | 레이어 공유 아이디어 — 사용자 사진 위에 날씨각 정보를 얹어 공유(캐시워크식), 앱 기능으로 | 10/21 회의 (황 본부장 의견, 대표 방향) | |
|
||||
| [ ] | iOS 개발자 계정 — 소장에게 기존 계정 확인, 어려우면 회사 계정 새로 만들기. 안드로이드 앱 계속 준비 | 10/21 회의 결정 | |
|
||||
|
||||
@@ -51,6 +51,11 @@ class Settings(BaseSettings):
|
||||
azure_blob_base_url: str = ""
|
||||
azure_blob_sas_token: str = ""
|
||||
|
||||
# 오늘 화면 쇼츠 줄. API 키가 있으면 채널의 쇼츠를 받고, 없으면 youtube_shorts(영상 ID, 쉼표로 구분, 최신순)를 보여 준다
|
||||
youtube_api_key: str = ""
|
||||
youtube_channel_id: str = "UCWdesmwvHFsnjMUWNcDaA9w"
|
||||
youtube_shorts: str = "kpp6WFEi4Nk,Wdv-e_DdQFY,WmbOEhi91IM"
|
||||
|
||||
# 구글 로그인 OAuth 클라이언트 ID (공개값). 비면 구글 로그인을 받지 않는다
|
||||
google_client_id: str = ""
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ from router.v1.reaction.reaction import router as reaction_router
|
||||
from router.v1.region.region import router as region_router
|
||||
from router.v1.season.season import router as season_router
|
||||
from router.v1.seo.seo import router as seo_router
|
||||
from router.v1.shorts.shorts import router as shorts_router
|
||||
from router.v1.sky.sky import router as sky_router
|
||||
from router.v1.talk.talk import router as talk_router
|
||||
from router.v1.watch.watch import router as watch_router
|
||||
@@ -53,6 +54,7 @@ app.include_router(image_router)
|
||||
app.include_router(seo_router)
|
||||
app.include_router(card_router)
|
||||
app.include_router(reel_router)
|
||||
app.include_router(shorts_router)
|
||||
|
||||
|
||||
class Res_Health(Res_WebPacketProtocol):
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,10 @@
|
||||
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
|
||||
|
||||
|
||||
class ShortItem(WebPacketProtocol):
|
||||
id: str # 유튜브 영상 ID
|
||||
title: str
|
||||
|
||||
|
||||
class Res_ShortList(Res_WebPacketProtocol):
|
||||
items: list[ShortItem] = []
|
||||
@@ -0,0 +1,16 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from common.enums import ErrorType
|
||||
from common.models.errors import error_info
|
||||
from router.v1.shorts.protocol import Res_ShortList, ShortItem
|
||||
from services.shorts_service import ShortsService
|
||||
|
||||
router = APIRouter(prefix="/v1/shorts", tags=["shorts"])
|
||||
|
||||
|
||||
@router.get("", response_model=Res_ShortList, response_model_exclude_none=True, summary="오늘 화면 쇼츠 줄: 날씨각 유튜브 채널의 쇼츠, 최신순")
|
||||
async def list_shorts(service: ShortsService = Depends()) -> Res_ShortList:
|
||||
err, items = await service.items()
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return Res_ShortList(result=error_info(err))
|
||||
return Res_ShortList(items=[ShortItem(**i) for i in items])
|
||||
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
import re
|
||||
from typing import Optional
|
||||
|
||||
import httpx
|
||||
|
||||
# YouTube Data API v3 (API 키). 채널 업로드 목록 → 영상 정보로 쇼츠만 고른다
|
||||
API_URL = "https://www.googleapis.com/youtube/v3"
|
||||
# 키 없이 영상 제목만 받을 때
|
||||
OEMBED_URL = "https://www.youtube.com/oembed"
|
||||
SHORT_MAX_SEC = 180 # 쇼츠는 3분 이하
|
||||
|
||||
_DURATION = re.compile(r"^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$")
|
||||
|
||||
|
||||
def seconds(iso: str) -> Optional[int]:
|
||||
"""ISO 8601 길이("PT1M5S") → 초. 형식이 다르면 None."""
|
||||
m = _DURATION.match(iso or "")
|
||||
if not m:
|
||||
return None
|
||||
h, mi, s = (int(g or 0) for g in m.groups())
|
||||
return h * 3600 + mi * 60 + s
|
||||
|
||||
|
||||
async def channel_shorts(client: httpx.AsyncClient, key: str, channel_id: str, limit: int) -> list[dict]:
|
||||
"""채널의 공개·퍼가기 허용 쇼츠 [{id, title, published}], 최신순."""
|
||||
res = await client.get(f"{API_URL}/channels", params={"part": "contentDetails", "id": channel_id, "key": key})
|
||||
res.raise_for_status()
|
||||
channels = res.json().get("items") or []
|
||||
if not channels:
|
||||
return []
|
||||
uploads = channels[0]["contentDetails"]["relatedPlaylists"]["uploads"]
|
||||
res = await client.get(f"{API_URL}/playlistItems", params={"part": "contentDetails", "playlistId": uploads, "maxResults": 50, "key": key})
|
||||
res.raise_for_status()
|
||||
ids = [i["contentDetails"]["videoId"] for i in res.json().get("items") or []]
|
||||
if not ids:
|
||||
return []
|
||||
res = await client.get(f"{API_URL}/videos", params={"part": "snippet,contentDetails,status", "id": ",".join(ids), "key": key})
|
||||
res.raise_for_status()
|
||||
found = []
|
||||
for v in res.json().get("items") or []:
|
||||
status, sec = v.get("status", {}), seconds(v["contentDetails"].get("duration", ""))
|
||||
if status.get("privacyStatus") != "public" or not status.get("embeddable") or sec is None or sec > SHORT_MAX_SEC:
|
||||
continue
|
||||
found.append({"id": v["id"], "title": v["snippet"]["title"], "published": v["snippet"]["publishedAt"]})
|
||||
found.sort(key=lambda x: x["published"], reverse=True)
|
||||
return found[:limit]
|
||||
|
||||
|
||||
async def video_title(client: httpx.AsyncClient, video_id: str) -> Optional[str]:
|
||||
"""영상 제목. 없거나 퍼가기가 막힌 영상이면 None."""
|
||||
res = await client.get(OEMBED_URL, params={"url": f"https://www.youtube.com/shorts/{video_id}", "format": "json"})
|
||||
if res.status_code in (401, 403, 404):
|
||||
return None
|
||||
res.raise_for_status()
|
||||
return res.json().get("title")
|
||||
@@ -0,0 +1,46 @@
|
||||
import asyncio
|
||||
import json
|
||||
|
||||
import httpx
|
||||
from redis.exceptions import RedisError
|
||||
|
||||
from common.cache.redis_client import REDIS
|
||||
from common.enums import ErrorType
|
||||
from common.logger import LOG
|
||||
from config.settings import settings
|
||||
from services.external import youtube
|
||||
|
||||
CACHE_KEY = "shorts:list"
|
||||
CACHE_SEC = 3600
|
||||
MAX_ITEMS = 10
|
||||
|
||||
|
||||
class ShortsService:
|
||||
async def items(self) -> tuple[ErrorType, list[dict]]:
|
||||
"""오늘 화면 쇼츠 줄 [{id, title}]. API 키가 있으면 채널에서, 없으면 설정의 영상 ID 목록으로."""
|
||||
try:
|
||||
cached = await REDIS.conn.get(CACHE_KEY)
|
||||
except RedisError as e:
|
||||
LOG.error(f"[shorts] cache get: {e}")
|
||||
cached = None
|
||||
if cached:
|
||||
return ErrorType.SUCCESS, json.loads(cached)
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
items = await self._fetch(client)
|
||||
except (httpx.HTTPError, KeyError, ValueError) as e:
|
||||
LOG.error(f"[shorts] fetch: {e}")
|
||||
return ErrorType.EXTERNAL_API_ERROR, []
|
||||
try:
|
||||
await REDIS.conn.set(CACHE_KEY, json.dumps(items, ensure_ascii=False), ex=CACHE_SEC)
|
||||
except RedisError as e:
|
||||
LOG.error(f"[shorts] cache set: {e}")
|
||||
return ErrorType.SUCCESS, items
|
||||
|
||||
async def _fetch(self, client: httpx.AsyncClient) -> list[dict]:
|
||||
if settings.youtube_api_key:
|
||||
found = await youtube.channel_shorts(client, settings.youtube_api_key, settings.youtube_channel_id, MAX_ITEMS)
|
||||
return [{"id": v["id"], "title": v["title"]} for v in found]
|
||||
ids = [i.strip() for i in settings.youtube_shorts.split(",") if i.strip()][:MAX_ITEMS]
|
||||
titles = await asyncio.gather(*(youtube.video_title(client, i) for i in ids))
|
||||
return [{"id": i, "title": t} for i, t in zip(ids, titles) if t]
|
||||
@@ -0,0 +1,54 @@
|
||||
import json
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from services.external.youtube import channel_shorts, seconds, video_title
|
||||
|
||||
|
||||
def test_seconds_parses_iso_duration():
|
||||
assert seconds("PT45S") == 45
|
||||
assert seconds("PT1M5S") == 65
|
||||
assert seconds("PT1H") == 3600
|
||||
assert seconds("P1D") is None
|
||||
|
||||
|
||||
def _api(videos: list[dict]) -> httpx.MockTransport:
|
||||
def handle(req: httpx.Request) -> httpx.Response:
|
||||
if req.url.path.endswith("/channels"):
|
||||
return httpx.Response(200, json={"items": [{"contentDetails": {"relatedPlaylists": {"uploads": "UUtest"}}}]})
|
||||
if req.url.path.endswith("/playlistItems"):
|
||||
assert req.url.params["playlistId"] == "UUtest"
|
||||
return httpx.Response(200, json={"items": [{"contentDetails": {"videoId": v["id"]}} for v in videos]})
|
||||
return httpx.Response(200, json={"items": videos})
|
||||
return httpx.MockTransport(handle)
|
||||
|
||||
|
||||
def _video(vid: str, duration: str, published: str, embeddable: bool = True, privacy: str = "public") -> dict:
|
||||
return {"id": vid, "snippet": {"title": f"제목 {vid}", "publishedAt": published}, "contentDetails": {"duration": duration},
|
||||
"status": {"embeddable": embeddable, "privacyStatus": privacy}}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_channel_shorts_keeps_public_embeddable_short_videos_newest_first():
|
||||
videos = [
|
||||
_video("old", "PT30S", "2026-10-20T00:00:00Z"),
|
||||
_video("new", "PT58S", "2026-10-26T00:00:00Z"),
|
||||
_video("long", "PT10M", "2026-10-25T00:00:00Z"),
|
||||
_video("noembed", "PT20S", "2026-10-24T00:00:00Z", embeddable=False),
|
||||
_video("private", "PT20S", "2026-10-23T00:00:00Z", privacy="unlisted"),
|
||||
]
|
||||
async with httpx.AsyncClient(transport=_api(videos)) as client:
|
||||
found = await channel_shorts(client, "key", "UCtest", 10)
|
||||
assert [v["id"] for v in found] == ["new", "old"]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_video_title_none_when_embedding_blocked():
|
||||
def handle(req: httpx.Request) -> httpx.Response:
|
||||
if "blocked" in req.url.params["url"]:
|
||||
return httpx.Response(401)
|
||||
return httpx.Response(200, content=json.dumps({"title": "오늘 자전거각"}))
|
||||
async with httpx.AsyncClient(transport=httpx.MockTransport(handle)) as client:
|
||||
assert await video_title(client, "ok") == "오늘 자전거각"
|
||||
assert await video_title(client, "blocked") is None
|
||||
@@ -3,8 +3,8 @@
|
||||
import { type DefaultError, type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
||||
|
||||
import { client } from '../client.gen';
|
||||
import { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, createCard, deleteComment, deleteMyGak, deleteTalk, getArticle, getCardImage, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, publishCard, refresh, rejectCard, reportTalk, savePost, scoreMyGak, signup, talkGroups, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from '../sdk.gen';
|
||||
import type { AddCommentData, AddCommentError, AddCommentResponse, AddMyGakData, AddMyGakError, AddMyGakResponse, AddTalkData, AddTalkError, AddTalkResponse, AuthConfigData, AuthConfigResponse, BlockTalkAuthorData, BlockTalkAuthorError, BlockTalkAuthorResponse, CreateCardData, CreateCardError, CreateCardResponse, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, GetArticleData, GetArticleError, GetArticleResponse, GetCardImageData, GetCardImageError, GetFeedData, GetFeedError, GetFeedResponse, GetImageData, GetImageError, GetIndexData, GetIndexError, GetIndexResponse, GetPostData, GetPostError, GetPostResponse, GetSeasonWeekData, GetSeasonWeekResponse, GetSkyData, GetSkyError, GetSkyRankingData, GetSkyRankingResponse, GetSkyResponse, GetTalkImageData, GetTalkImageError, GetTodayGuPageData, GetTodayGuPageError, GetTodayGuPageResponse, GetTodayPageData, GetTodayPageError, GetTodayPageResponse, GetTomorrowGuPageData, GetTomorrowGuPageError, GetTomorrowGuPageResponse, GetTomorrowPageData, GetTomorrowPageError, GetTomorrowPageResponse, GetWatchSummaryData, GetWatchSummaryError, GetWatchSummaryResponse, GetWeatherNowData, GetWeatherNowError, GetWeatherNowResponse, GetWeatherTodayData, GetWeatherTodayError, GetWeatherTodayResponse, GetWeekData, GetWeekError, GetWeekRankingData, GetWeekRankingResponse, GetWeekResponse, GoogleLoginData, GoogleLoginError, GoogleLoginResponse, HealthzHealthzGetData, HealthzHealthzGetResponse, LikeCommentData, LikeCommentError, LikeCommentResponse, LikePostData, LikePostError, LikePostResponse, LikeTalkData, LikeTalkError, LikeTalkResponse, ListArticlesData, ListArticlesError, ListArticlesResponse, ListCardsData, ListCardsError, ListCardsResponse, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, ListMyTalksData, ListMyTalksError, ListMyTalksResponse, ListPlacesData, ListPlacesError, ListPlacesResponse, ListPresetsData, ListPresetsResponse, ListRegionsData, ListRegionsError, ListRegionsResponse, ListSavedData, ListSavedError, ListSavedResponse, ListTalksData, ListTalksError, ListTalksResponse, LoginData, LoginError, LoginResponse, LogoutData, LogoutError, LogoutResponse, MeData, MeError, MeResponse, NearestRegionData, NearestRegionError, NearestRegionResponse, PublishCardData, PublishCardError, PublishCardResponse, RefreshData, RefreshError, RefreshResponse, RejectCardData, RejectCardError, RejectCardResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SignupData, SignupError, SignupResponse, TalkGroupsData, TalkGroupsError, TalkGroupsResponse, UnlikeCommentData, UnlikeCommentError, UnlikeCommentResponse, UnlikePostData, UnlikePostError, UnlikePostResponse, UnlikeTalkData, UnlikeTalkError, UnlikeTalkResponse, UnsavePostData, UnsavePostError, UnsavePostResponse, UpdateMeData, UpdateMeError, UpdateMeResponse, UploadTalkImageData, UploadTalkImageError, UploadTalkImageResponse } from '../types.gen';
|
||||
import { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, createCard, createReel, deleteComment, deleteMyGak, deleteTalk, getArticle, getCardImage, getFeed, getImage, getIndex, getPost, getReelCover, getReelVideo, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listReels, listRegions, listSaved, listShorts, listTalks, login, logout, me, nearestRegion, type Options, publishCard, publishInstagram, publishInstagram2, refresh, rejectCard, reportTalk, savePost, scoreMyGak, signup, talkGroups, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from '../sdk.gen';
|
||||
import type { AddCommentData, AddCommentError, AddCommentResponse, AddMyGakData, AddMyGakError, AddMyGakResponse, AddTalkData, AddTalkError, AddTalkResponse, AuthConfigData, AuthConfigResponse, BlockTalkAuthorData, BlockTalkAuthorError, BlockTalkAuthorResponse, CreateCardData, CreateCardError, CreateCardResponse, CreateReelData, CreateReelError, CreateReelResponse, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, GetArticleData, GetArticleError, GetArticleResponse, GetCardImageData, GetCardImageError, GetFeedData, GetFeedError, GetFeedResponse, GetImageData, GetImageError, GetIndexData, GetIndexError, GetIndexResponse, GetPostData, GetPostError, GetPostResponse, GetReelCoverData, GetReelCoverError, GetReelVideoData, GetReelVideoError, GetSeasonWeekData, GetSeasonWeekResponse, GetSkyData, GetSkyError, GetSkyRankingData, GetSkyRankingResponse, GetSkyResponse, GetTalkImageData, GetTalkImageError, GetTodayGuPageData, GetTodayGuPageError, GetTodayGuPageResponse, GetTodayPageData, GetTodayPageError, GetTodayPageResponse, GetTomorrowGuPageData, GetTomorrowGuPageError, GetTomorrowGuPageResponse, GetTomorrowPageData, GetTomorrowPageError, GetTomorrowPageResponse, GetWatchSummaryData, GetWatchSummaryError, GetWatchSummaryResponse, GetWeatherNowData, GetWeatherNowError, GetWeatherNowResponse, GetWeatherTodayData, GetWeatherTodayError, GetWeatherTodayResponse, GetWeekData, GetWeekError, GetWeekRankingData, GetWeekRankingResponse, GetWeekResponse, GoogleLoginData, GoogleLoginError, GoogleLoginResponse, HealthzHealthzGetData, HealthzHealthzGetResponse, LikeCommentData, LikeCommentError, LikeCommentResponse, LikePostData, LikePostError, LikePostResponse, LikeTalkData, LikeTalkError, LikeTalkResponse, ListArticlesData, ListArticlesError, ListArticlesResponse, ListCardsData, ListCardsError, ListCardsResponse, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, ListMyTalksData, ListMyTalksError, ListMyTalksResponse, ListPlacesData, ListPlacesError, ListPlacesResponse, ListPresetsData, ListPresetsResponse, ListReelsData, ListReelsError, ListReelsResponse, ListRegionsData, ListRegionsError, ListRegionsResponse, ListSavedData, ListSavedError, ListSavedResponse, ListShortsData, ListShortsResponse, ListTalksData, ListTalksError, ListTalksResponse, LoginData, LoginError, LoginResponse, LogoutData, LogoutError, LogoutResponse, MeData, MeError, MeResponse, NearestRegionData, NearestRegionError, NearestRegionResponse, PublishCardData, PublishCardError, PublishCardResponse, PublishInstagram2Data, PublishInstagram2Error, PublishInstagram2Response, PublishInstagramData, PublishInstagramError, PublishInstagramResponse, RefreshData, RefreshError, RefreshResponse, RejectCardData, RejectCardError, RejectCardResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SignupData, SignupError, SignupResponse, TalkGroupsData, TalkGroupsError, TalkGroupsResponse, UnlikeCommentData, UnlikeCommentError, UnlikeCommentResponse, UnlikePostData, UnlikePostError, UnlikePostResponse, UnlikeTalkData, UnlikeTalkError, UnlikeTalkResponse, UnsavePostData, UnsavePostError, UnsavePostResponse, UpdateMeData, UpdateMeError, UpdateMeResponse, UploadTalkImageData, UploadTalkImageError, UploadTalkImageResponse } from '../types.gen';
|
||||
|
||||
export type QueryKey<TOptions extends Options> = [
|
||||
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
||||
@@ -1259,6 +1259,23 @@ export const rejectCardMutation = (options?: Partial<Options<RejectCardData>>):
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* 카드뉴스를 인스타그램에 캐러셀로 올리기 (관리자). 같은 카드는 한 번만
|
||||
*/
|
||||
export const publishInstagramMutation = (options?: Partial<Options<PublishInstagramData>>): UseMutationOptions<PublishInstagramResponse, PublishInstagramError, Options<PublishInstagramData>> => {
|
||||
const mutationOptions: UseMutationOptions<PublishInstagramResponse, PublishInstagramError, Options<PublishInstagramData>> = {
|
||||
mutationFn: async (fnOptions) => {
|
||||
const { data } = await publishInstagram({
|
||||
...options,
|
||||
...fnOptions,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getCardImageQueryKey = (options: Options<GetCardImageData>) => createQueryKey('getCardImage', options);
|
||||
|
||||
/**
|
||||
@@ -1277,6 +1294,112 @@ export const getCardImageOptions = (options: Options<GetCardImageData>) => query
|
||||
queryKey: getCardImageQueryKey(options)
|
||||
});
|
||||
|
||||
export const listReelsQueryKey = (options?: Options<ListReelsData>) => createQueryKey('listReels', options);
|
||||
|
||||
/**
|
||||
* 릴스 목록 (관리자)
|
||||
*/
|
||||
export const listReelsOptions = (options?: Options<ListReelsData>) => queryOptions<ListReelsResponse, ListReelsError, ListReelsResponse, ReturnType<typeof listReelsQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await listReels({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listReelsQueryKey(options)
|
||||
});
|
||||
|
||||
/**
|
||||
* 릴스 mp4 저장 (관리자). 공개 주소가 생기고, 인스타엔 따로 올린다
|
||||
*/
|
||||
export const createReelMutation = (options?: Partial<Options<CreateReelData>>): UseMutationOptions<CreateReelResponse, CreateReelError, Options<CreateReelData>> => {
|
||||
const mutationOptions: UseMutationOptions<CreateReelResponse, CreateReelError, Options<CreateReelData>> = {
|
||||
mutationFn: async (fnOptions) => {
|
||||
const { data } = await createReel({
|
||||
...options,
|
||||
...fnOptions,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* 릴스를 인스타그램에 올리기 (관리자). 같은 릴스는 한 번만
|
||||
*/
|
||||
export const publishInstagram2Mutation = (options?: Partial<Options<PublishInstagram2Data>>): UseMutationOptions<PublishInstagram2Response, PublishInstagram2Error, Options<PublishInstagram2Data>> => {
|
||||
const mutationOptions: UseMutationOptions<PublishInstagram2Response, PublishInstagram2Error, Options<PublishInstagram2Data>> = {
|
||||
mutationFn: async (fnOptions) => {
|
||||
const { data } = await publishInstagram2({
|
||||
...options,
|
||||
...fnOptions,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getReelVideoQueryKey = (options: Options<GetReelVideoData>) => createQueryKey('getReelVideo', options);
|
||||
|
||||
/**
|
||||
* 릴스 영상 (인스타가 받아 가는 공개 주소, Range 지원)
|
||||
*/
|
||||
export const getReelVideoOptions = (options: Options<GetReelVideoData>) => queryOptions<unknown, GetReelVideoError, unknown, ReturnType<typeof getReelVideoQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getReelVideo({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getReelVideoQueryKey(options)
|
||||
});
|
||||
|
||||
export const getReelCoverQueryKey = (options: Options<GetReelCoverData>) => createQueryKey('getReelCover', options);
|
||||
|
||||
/**
|
||||
* 릴스 표지
|
||||
*/
|
||||
export const getReelCoverOptions = (options: Options<GetReelCoverData>) => queryOptions<unknown, GetReelCoverError, unknown, ReturnType<typeof getReelCoverQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getReelCover({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getReelCoverQueryKey(options)
|
||||
});
|
||||
|
||||
export const listShortsQueryKey = (options?: Options<ListShortsData>) => createQueryKey('listShorts', options);
|
||||
|
||||
/**
|
||||
* 오늘 화면 쇼츠 줄: 날씨각 유튜브 채널의 쇼츠, 최신순
|
||||
*/
|
||||
export const listShortsOptions = (options?: Options<ListShortsData>) => queryOptions<ListShortsResponse, DefaultError, ListShortsResponse, ReturnType<typeof listShortsQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await listShorts({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listShortsQueryKey(options)
|
||||
});
|
||||
|
||||
export const healthzHealthzGetQueryKey = (options?: Options<HealthzHealthzGetData>) => createQueryKey('healthzHealthzGet', options);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, createCard, deleteComment, deleteMyGak, deleteTalk, getArticle, getCardImage, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, publishCard, refresh, rejectCard, reportTalk, savePost, scoreMyGak, signup, talkGroups, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from './sdk.gen';
|
||||
export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AddMyGakData, type AddMyGakError, type AddMyGakErrors, type AddMyGakResponse, type AddMyGakResponses, type AddTalkData, type AddTalkError, type AddTalkErrors, type AddTalkResponse, type AddTalkResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, type AuthConfigData, type AuthConfigResponse, type AuthConfigResponses, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type BlockTalkAuthorData, type BlockTalkAuthorError, type BlockTalkAuthorErrors, type BlockTalkAuthorResponse, type BlockTalkAuthorResponses, type BodyUploadTalkImageV1TalkImagePost, type CardItem, CardStatus, type ClientOptions, type CommentData, type CommuteData, Confidence, type CreateCardData, type CreateCardError, type CreateCardErrors, type CreateCardResponse, type CreateCardResponses, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteMyGakData, type DeleteMyGakError, type DeleteMyGakErrors, type DeleteMyGakResponse, type DeleteMyGakResponses, type DeleteTalkData, type DeleteTalkError, type DeleteTalkErrors, type DeleteTalkResponse, type DeleteTalkResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetCardImageData, type GetCardImageError, type GetCardImageErrors, type GetCardImageResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetTalkImageData, type GetTalkImageError, type GetTalkImageErrors, type GetTalkImageResponses, type GetTodayGuPageData, type GetTodayGuPageError, type GetTodayGuPageErrors, type GetTodayGuPageResponse, type GetTodayGuPageResponses, type GetTodayPageData, type GetTodayPageError, type GetTodayPageErrors, type GetTodayPageResponse, type GetTodayPageResponses, type GetTomorrowGuPageData, type GetTomorrowGuPageError, type GetTomorrowGuPageErrors, type GetTomorrowGuPageResponse, type GetTomorrowGuPageResponses, type GetTomorrowPageData, type GetTomorrowPageError, type GetTomorrowPageErrors, type GetTomorrowPageResponse, type GetTomorrowPageResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type GoogleLoginData, type GoogleLoginError, type GoogleLoginErrors, type GoogleLoginResponse, type GoogleLoginResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HeroTomorrow, type HourCell, type HoursSlide, type HttpValidationError, type ImageSlide, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type LikeTalkData, type LikeTalkError, type LikeTalkErrors, type LikeTalkResponse, type LikeTalkResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCardsData, type ListCardsError, type ListCardsErrors, type ListCardsResponse, type ListCardsResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsResponse, type ListEventsResponses, type ListIndicesData, type ListIndicesError, type ListIndicesErrors, type ListIndicesResponse, type ListIndicesResponses, type ListMyGakData, type ListMyGakError, type ListMyGakErrors, type ListMyGakResponse, type ListMyGakResponses, type ListMyTalksData, type ListMyTalksError, type LiLine truncated
|
||||
export { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, createCard, createReel, deleteComment, deleteMyGak, deleteTalk, getArticle, getCardImage, getFeed, getImage, getIndex, getPost, getReelCover, getReelVideo, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listReels, listRegions, listSaved, listShorts, listTalks, login, logout, me, nearestRegion, type Options, publishCard, publishInstagram, publishInstagram2, refresh, rejectCard, reportTalk, savePost, scoreMyGak, signup, talkGroups, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage } from './sdk.gen';
|
||||
export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AddMyGakData, type AddMyGakError, type AddMyGakErrors, type AddMyGakResponse, type AddMyGakResponses, type AddTalkData, type AddTalkError, type AddTalkErrors, type AddTalkResponse, type AddTalkResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, type AuthConfigData, type AuthConfigResponse, type AuthConfigResponses, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type BlockTalkAuthorData, type BlockTalkAuthorError, type BlockTalkAuthorErrors, type BlockTalkAuthorResponse, type BlockTalkAuthorResponses, type BodyUploadTalkImageV1TalkImagePost, type CardItem, CardStatus, type ClientOptions, type CommentData, type CommuteData, Confidence, type CreateCardData, type CreateCardError, type CreateCardErrors, type CreateCardResponse, type CreateCardResponses, type CreateReelData, type CreateReelError, type CreateReelErrors, type CreateReelResponse, type CreateReelResponses, type Cut, type DayData, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteMyGakData, type DeleteMyGakError, type DeleteMyGakErrors, type DeleteMyGakResponse, type DeleteMyGakResponses, type DeleteTalkData, type DeleteTalkError, type DeleteTalkErrors, type DeleteTalkResponse, type DeleteTalkResponses, type ErrorInfo, type EventData, type Factor, type GakSlide, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetCardImageData, type GetCardImageError, type GetCardImageErrors, type GetCardImageResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetReelCoverData, type GetReelCoverError, type GetReelCoverErrors, type GetReelCoverResponses, type GetReelVideoData, type GetReelVideoError, type GetReelVideoErrors, type GetReelVideoResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetTalkImageData, type GetTalkImageError, type GetTalkImageErrors, type GetTalkImageResponses, type GetTodayGuPageData, type GetTodayGuPageError, type GetTodayGuPageErrors, type GetTodayGuPageResponse, type GetTodayGuPageResponses, type GetTodayPageData, type GetTodayPageError, type GetTodayPageErrors, type GetTodayPageResponse, type GetTodayPageResponses, type GetTomorrowGuPageData, type GetTomorrowGuPageError, type GetTomorrowGuPageErrors, type GetTomorrowGuPageResponse, type GetTomorrowGuPageResponses, type GetTomorrowPageData, type GetTomorrowPageError, type GetTomorrowPageErrors, type GetTomorrowPageResponse, type GetTomorrowPageResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponses, type GoogleLoginData, type GoogleLoginError, type GoogleLoginErrors, type GoogleLoginResponse, type GoogleLoginResponses, type HealthzHealthzGetData, type HealthzHealthzGetResponse, type HealthzHealthzGetResponses, type Hero, type HeroStat, type HeroTomorrow, type HourCell, type HoursSlide, type HttpValidationError, type ImageSlide, IndexCategory, type IndexSummary, type LikeCommentData, type LikeCommentError, type LikeCommentErrors, type LikeCommentResponse, type LikeCommentResponses, type LikePostData, type LikePostError, type LikePostErrors, type LikePostResponse, type LikePostResponses, type LikeTalkData, type LikeTalkError, type LikeTalkErrors, type LikeTalkResponse, type LikeTalkResponses, type ListArticlesData, type ListArticlesError, type ListArticlesErrors, type ListArticlesResponse, type ListArticlesResponses, type ListCardsData, type ListCardsError, type ListCardsErrors, type ListCardsResponse, type ListCardsResponses, type ListCommentsData, type ListCommentsError, type ListCommentsErrors, type ListCommentsResponse, type ListCommentsResponses, type ListEventsData, type ListEventsError, type ListEventsErrors, type ListEventsRespoLine truncated
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client';
|
||||
import { client } from './client.gen';
|
||||
import type { AddCommentData, AddCommentErrors, AddCommentResponses, AddMyGakData, AddMyGakErrors, AddMyGakResponses, AddTalkData, AddTalkErrors, AddTalkResponses, AuthConfigData, AuthConfigResponses, BlockTalkAuthorData, BlockTalkAuthorErrors, BlockTalkAuthorResponses, CreateCardData, CreateCardErrors, CreateCardResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, GetArticleData, GetArticleErrors, GetArticleResponses, GetCardImageData, GetCardImageErrors, GetCardImageResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetImageData, GetImageErrors, GetImageResponses, GetIndexData, GetIndexErrors, GetIndexResponses, GetPostData, GetPostErrors, GetPostResponses, GetSeasonWeekData, GetSeasonWeekResponses, GetSkyData, GetSkyErrors, GetSkyRankingData, GetSkyRankingResponses, GetSkyResponses, GetTalkImageData, GetTalkImageErrors, GetTalkImageResponses, GetTodayGuPageData, GetTodayGuPageErrors, GetTodayGuPageResponses, GetTodayPageData, GetTodayPageErrors, GetTodayPageResponses, GetTomorrowGuPageData, GetTomorrowGuPageErrors, GetTomorrowGuPageResponses, GetTomorrowPageData, GetTomorrowPageErrors, GetTomorrowPageResponses, GetWatchSummaryData, GetWatchSummaryErrors, GetWatchSummaryResponses, GetWeatherNowData, GetWeatherNowErrors, GetWeatherNowResponses, GetWeatherTodayData, GetWeatherTodayErrors, GetWeatherTodayResponses, GetWeekData, GetWeekErrors, GetWeekRankingData, GetWeekRankingResponses, GetWeekResponses, GoogleLoginData, GoogleLoginErrors, GoogleLoginResponses, HealthzHealthzGetData, HealthzHealthzGetResponses, LikeCommentData, LikeCommentErrors, LikeCommentResponses, LikePostData, LikePostErrors, LikePostResponses, LikeTalkData, LikeTalkErrors, LikeTalkResponses, ListArticlesData, ListArticlesErrors, ListArticlesResponses, ListCardsData, ListCardsErrors, ListCardsResponses, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, ListMyTalksData, ListMyTalksErrors, ListMyTalksResponses, ListPlacesData, ListPlacesErrors, ListPlacesResponses, ListPresetsData, ListPresetsResponses, ListRegionsData, ListRegionsErrors, ListRegionsResponses, ListSavedData, ListSavedErrors, ListSavedResponses, ListTalksData, ListTalksErrors, ListTalksResponses, LoginData, LoginErrors, LoginResponses, LogoutData, LogoutErrors, LogoutResponses, MeData, MeErrors, MeResponses, NearestRegionData, NearestRegionErrors, NearestRegionResponses, PublishCardData, PublishCardErrors, PublishCardResponses, RefreshData, RefreshErrors, RefreshResponses, RejectCardData, RejectCardErrors, RejectCardResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SignupData, SignupErrors, SignupResponses, TalkGroupsData, TalkGroupsErrors, TalkGroupsResponses, UnlikeCommentData, UnlikeCommentErrors, UnlikeCommentResponses, UnlikePostData, UnlikePostErrors, UnlikePostResponses, UnlikeTalkData, UnlikeTalkErrors, UnlikeTalkResponses, UnsavePostData, UnsavePostErrors, UnsavePostResponses, UpdateMeData, UpdateMeErrors, UpdateMeResponses, UploadTalkImageData, UploadTalkImageErrors, UploadTalkImageResponses } from './types.gen';
|
||||
import type { AddCommentData, AddCommentErrors, AddCommentResponses, AddMyGakData, AddMyGakErrors, AddMyGakResponses, AddTalkData, AddTalkErrors, AddTalkResponses, AuthConfigData, AuthConfigResponses, BlockTalkAuthorData, BlockTalkAuthorErrors, BlockTalkAuthorResponses, CreateCardData, CreateCardErrors, CreateCardResponses, CreateReelData, CreateReelErrors, CreateReelResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, GetArticleData, GetArticleErrors, GetArticleResponses, GetCardImageData, GetCardImageErrors, GetCardImageResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetImageData, GetImageErrors, GetImageResponses, GetIndexData, GetIndexErrors, GetIndexResponses, GetPostData, GetPostErrors, GetPostResponses, GetReelCoverData, GetReelCoverErrors, GetReelCoverResponses, GetReelVideoData, GetReelVideoErrors, GetReelVideoResponses, GetSeasonWeekData, GetSeasonWeekResponses, GetSkyData, GetSkyErrors, GetSkyRankingData, GetSkyRankingResponses, GetSkyResponses, GetTalkImageData, GetTalkImageErrors, GetTalkImageResponses, GetTodayGuPageData, GetTodayGuPageErrors, GetTodayGuPageResponses, GetTodayPageData, GetTodayPageErrors, GetTodayPageResponses, GetTomorrowGuPageData, GetTomorrowGuPageErrors, GetTomorrowGuPageResponses, GetTomorrowPageData, GetTomorrowPageErrors, GetTomorrowPageResponses, GetWatchSummaryData, GetWatchSummaryErrors, GetWatchSummaryResponses, GetWeatherNowData, GetWeatherNowErrors, GetWeatherNowResponses, GetWeatherTodayData, GetWeatherTodayErrors, GetWeatherTodayResponses, GetWeekData, GetWeekErrors, GetWeekRankingData, GetWeekRankingResponses, GetWeekResponses, GoogleLoginData, GoogleLoginErrors, GoogleLoginResponses, HealthzHealthzGetData, HealthzHealthzGetResponses, LikeCommentData, LikeCommentErrors, LikeCommentResponses, LikePostData, LikePostErrors, LikePostResponses, LikeTalkData, LikeTalkErrors, LikeTalkResponses, ListArticlesData, ListArticlesErrors, ListArticlesResponses, ListCardsData, ListCardsErrors, ListCardsResponses, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, ListMyTalksData, ListMyTalksErrors, ListMyTalksResponses, ListPlacesData, ListPlacesErrors, ListPlacesResponses, ListPresetsData, ListPresetsResponses, ListReelsData, ListReelsErrors, ListReelsResponses, ListRegionsData, ListRegionsErrors, ListRegionsResponses, ListSavedData, ListSavedErrors, ListSavedResponses, ListShortsData, ListShortsResponses, ListTalksData, ListTalksErrors, ListTalksResponses, LoginData, LoginErrors, LoginResponses, LogoutData, LogoutErrors, LogoutResponses, MeData, MeErrors, MeResponses, NearestRegionData, NearestRegionErrors, NearestRegionResponses, PublishCardData, PublishCardErrors, PublishCardResponses, PublishInstagram2Data, PublishInstagram2Errors, PublishInstagram2Responses, PublishInstagramData, PublishInstagramErrors, PublishInstagramResponses, RefreshData, RefreshErrors, RefreshResponses, RejectCardData, RejectCardErrors, RejectCardResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SignupData, SignupErrors, SignupResponses, TalkGroupsData, TalkGroupsErrors, TalkGroupsResponses, UnlikeCommentData, UnlikeCommentErrors, UnlikeCommentResponses, UnlikePostData, UnlikePostErrors, UnlikePostResponses, UnlikeTalkData, UnlikeTalkErrors, UnlikeTalkResponses, UnsavePostData, UnsavePostErrors, UnsavePostResponses, UpdateMeData, UpdateMeErrors, UpdateMeResponses, UploadTalkImageData, UploadTalkImageErrors, UploadTalkImageResponses } from './types.gen';
|
||||
|
||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
||||
/**
|
||||
@@ -408,11 +408,53 @@ export const publishCard = <ThrowOnError extends boolean = true>(options: Option
|
||||
*/
|
||||
export const rejectCard = <ThrowOnError extends boolean = true>(options: Options<RejectCardData, ThrowOnError>): RequestResult<RejectCardResponses, RejectCardErrors, ThrowOnError> => (options.client ?? client).post<RejectCardResponses, RejectCardErrors, ThrowOnError>({ url: '/v1/card/{card_id}/reject', ...options });
|
||||
|
||||
/**
|
||||
* 카드뉴스를 인스타그램에 캐러셀로 올리기 (관리자). 같은 카드는 한 번만
|
||||
*/
|
||||
export const publishInstagram = <ThrowOnError extends boolean = true>(options: Options<PublishInstagramData, ThrowOnError>): RequestResult<PublishInstagramResponses, PublishInstagramErrors, ThrowOnError> => (options.client ?? client).post<PublishInstagramResponses, PublishInstagramErrors, ThrowOnError>({ url: '/v1/card/{card_id}/instagram', ...options });
|
||||
|
||||
/**
|
||||
* 카드뉴스 이미지
|
||||
*/
|
||||
export const getCardImage = <ThrowOnError extends boolean = true>(options: Options<GetCardImageData, ThrowOnError>): RequestResult<GetCardImageResponses, GetCardImageErrors, ThrowOnError> => (options.client ?? client).get<GetCardImageResponses, GetCardImageErrors, ThrowOnError>({ url: '/v1/card/{card_id}/{seq}.jpg', ...options });
|
||||
|
||||
/**
|
||||
* 릴스 목록 (관리자)
|
||||
*/
|
||||
export const listReels = <ThrowOnError extends boolean = true>(options?: Options<ListReelsData, ThrowOnError>): RequestResult<ListReelsResponses, ListReelsErrors, ThrowOnError> => (options?.client ?? client).get<ListReelsResponses, ListReelsErrors, ThrowOnError>({ url: '/v1/reel', ...options });
|
||||
|
||||
/**
|
||||
* 릴스 mp4 저장 (관리자). 공개 주소가 생기고, 인스타엔 따로 올린다
|
||||
*/
|
||||
export const createReel = <ThrowOnError extends boolean = true>(options: Options<CreateReelData, ThrowOnError>): RequestResult<CreateReelResponses, CreateReelErrors, ThrowOnError> => (options.client ?? client).post<CreateReelResponses, CreateReelErrors, ThrowOnError>({
|
||||
url: '/v1/reel',
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...options.headers
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 릴스를 인스타그램에 올리기 (관리자). 같은 릴스는 한 번만
|
||||
*/
|
||||
export const publishInstagram2 = <ThrowOnError extends boolean = true>(options: Options<PublishInstagram2Data, ThrowOnError>): RequestResult<PublishInstagram2Responses, PublishInstagram2Errors, ThrowOnError> => (options.client ?? client).post<PublishInstagram2Responses, PublishInstagram2Errors, ThrowOnError>({ url: '/v1/reel/{reel_id}/instagram', ...options });
|
||||
|
||||
/**
|
||||
* 릴스 영상 (인스타가 받아 가는 공개 주소, Range 지원)
|
||||
*/
|
||||
export const getReelVideo = <ThrowOnError extends boolean = true>(options: Options<GetReelVideoData, ThrowOnError>): RequestResult<GetReelVideoResponses, GetReelVideoErrors, ThrowOnError> => (options.client ?? client).get<GetReelVideoResponses, GetReelVideoErrors, ThrowOnError>({ url: '/v1/reel/{reel_id}.mp4', ...options });
|
||||
|
||||
/**
|
||||
* 릴스 표지
|
||||
*/
|
||||
export const getReelCover = <ThrowOnError extends boolean = true>(options: Options<GetReelCoverData, ThrowOnError>): RequestResult<GetReelCoverResponses, GetReelCoverErrors, ThrowOnError> => (options.client ?? client).get<GetReelCoverResponses, GetReelCoverErrors, ThrowOnError>({ url: '/v1/reel/{reel_id}/cover.jpg', ...options });
|
||||
|
||||
/**
|
||||
* 오늘 화면 쇼츠 줄: 날씨각 유튜브 채널의 쇼츠, 최신순
|
||||
*/
|
||||
export const listShorts = <ThrowOnError extends boolean = true>(options?: Options<ListShortsData, ThrowOnError>): RequestResult<ListShortsResponses, unknown, ThrowOnError> => (options?.client ?? client).get<ListShortsResponses, unknown, ThrowOnError>({ url: '/v1/shorts', ...options });
|
||||
|
||||
/**
|
||||
* 헬스체크
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ClientOptions = {
|
||||
baseUrl: `${string}://${string}` | (string & {});
|
||||
baseUrl: 'http://localhost:9811' | (string & {});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -285,6 +285,10 @@ export type CardItem = {
|
||||
* Image Urls
|
||||
*/
|
||||
image_urls?: Array<string>;
|
||||
/**
|
||||
* Ig Media Id
|
||||
*/
|
||||
ig_media_id?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1485,6 +1489,36 @@ export type RankData = {
|
||||
situation_label?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* ReelItem
|
||||
*/
|
||||
export type ReelItem = {
|
||||
/**
|
||||
* Reel Id
|
||||
*/
|
||||
reel_id: number;
|
||||
/**
|
||||
* Title
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Created At
|
||||
*/
|
||||
created_at: string;
|
||||
/**
|
||||
* Video Url
|
||||
*/
|
||||
video_url: string;
|
||||
/**
|
||||
* Cover Url
|
||||
*/
|
||||
cover_url?: string | null;
|
||||
/**
|
||||
* Ig Media Id
|
||||
*/
|
||||
ig_media_id?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* RegionData
|
||||
*/
|
||||
@@ -1533,6 +1567,12 @@ export type ReqCardCreate = {
|
||||
* Caption
|
||||
*/
|
||||
caption?: string;
|
||||
/**
|
||||
* Hashtags
|
||||
*
|
||||
* 인스타 캡션 뒤에만 붙는 해시태그. 날씨각 피드에는 안 나간다
|
||||
*/
|
||||
hashtags?: string;
|
||||
/**
|
||||
* Texts
|
||||
*
|
||||
@@ -1624,6 +1664,40 @@ export type ReqMyGakScore = {
|
||||
rules: Array<MyGakRule>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Req_ReelCreate
|
||||
*/
|
||||
export type ReqReelCreate = {
|
||||
/**
|
||||
* Title
|
||||
*
|
||||
* 인스타 캡션 첫 줄
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Caption
|
||||
*/
|
||||
caption?: string;
|
||||
/**
|
||||
* Hashtags
|
||||
*
|
||||
* 인스타 캡션 뒤에 붙는 해시태그
|
||||
*/
|
||||
hashtags?: string;
|
||||
/**
|
||||
* Video
|
||||
*
|
||||
* mp4(H.264, 9:16), base64, 30MB 이하
|
||||
*/
|
||||
video: string;
|
||||
/**
|
||||
* Cover
|
||||
*
|
||||
* 표지 JPEG, base64 (없으면 인스타가 첫 장면을 쓴다)
|
||||
*/
|
||||
cover?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Req_Refresh
|
||||
*/
|
||||
@@ -1797,6 +1871,10 @@ export type ResCard = {
|
||||
* Image Urls
|
||||
*/
|
||||
image_urls?: Array<string>;
|
||||
/**
|
||||
* Ig Media Id
|
||||
*/
|
||||
ig_media_id?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2166,6 +2244,48 @@ export type ResPostSave = {
|
||||
saved?: boolean | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_Reel
|
||||
*/
|
||||
export type ResReel = {
|
||||
result?: ErrorInfo;
|
||||
/**
|
||||
* Msg
|
||||
*/
|
||||
msg?: string | null;
|
||||
/**
|
||||
* Reel Id
|
||||
*/
|
||||
reel_id?: number | null;
|
||||
/**
|
||||
* Video Url
|
||||
*/
|
||||
video_url?: string | null;
|
||||
/**
|
||||
* Cover Url
|
||||
*/
|
||||
cover_url?: string | null;
|
||||
/**
|
||||
* Ig Media Id
|
||||
*/
|
||||
ig_media_id?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_ReelList
|
||||
*/
|
||||
export type ResReelList = {
|
||||
result?: ErrorInfo;
|
||||
/**
|
||||
* Msg
|
||||
*/
|
||||
msg?: string | null;
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
items?: Array<ReelItem>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_Region
|
||||
*/
|
||||
@@ -2261,6 +2381,21 @@ export type ResSeasonWeek = {
|
||||
news?: Array<ArticleSummary>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_ShortList
|
||||
*/
|
||||
export type ResShortList = {
|
||||
result?: ErrorInfo;
|
||||
/**
|
||||
* Msg
|
||||
*/
|
||||
msg?: string | null;
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
items?: Array<ShortItem>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Res_Sky
|
||||
*/
|
||||
@@ -2674,6 +2809,20 @@ export type ScoreBand = {
|
||||
current: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* ShortItem
|
||||
*/
|
||||
export type ShortItem = {
|
||||
/**
|
||||
* Id
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Title
|
||||
*/
|
||||
title: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sky
|
||||
*/
|
||||
@@ -5719,6 +5868,42 @@ export type RejectCardResponses = {
|
||||
|
||||
export type RejectCardResponse = RejectCardResponses[keyof RejectCardResponses];
|
||||
|
||||
export type PublishInstagramData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* X-Admin-Key
|
||||
*/
|
||||
'x-admin-key'?: string | null;
|
||||
};
|
||||
path: {
|
||||
/**
|
||||
* Card Id
|
||||
*/
|
||||
card_id: number;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/card/{card_id}/instagram';
|
||||
};
|
||||
|
||||
export type PublishInstagramErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type PublishInstagramError = PublishInstagramErrors[keyof PublishInstagramErrors];
|
||||
|
||||
export type PublishInstagramResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResCard;
|
||||
};
|
||||
|
||||
export type PublishInstagramResponse = PublishInstagramResponses[keyof PublishInstagramResponses];
|
||||
|
||||
export type GetCardImageData = {
|
||||
body?: never;
|
||||
path: {
|
||||
@@ -5755,6 +5940,193 @@ export type GetCardImageResponses = {
|
||||
200: unknown;
|
||||
};
|
||||
|
||||
export type ListReelsData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* X-Admin-Key
|
||||
*/
|
||||
'x-admin-key'?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: {
|
||||
/**
|
||||
* Limit
|
||||
*/
|
||||
limit?: number;
|
||||
};
|
||||
url: '/v1/reel';
|
||||
};
|
||||
|
||||
export type ListReelsErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type ListReelsError = ListReelsErrors[keyof ListReelsErrors];
|
||||
|
||||
export type ListReelsResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResReelList;
|
||||
};
|
||||
|
||||
export type ListReelsResponse = ListReelsResponses[keyof ListReelsResponses];
|
||||
|
||||
export type CreateReelData = {
|
||||
body: ReqReelCreate;
|
||||
headers?: {
|
||||
/**
|
||||
* X-Admin-Key
|
||||
*/
|
||||
'x-admin-key'?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/v1/reel';
|
||||
};
|
||||
|
||||
export type CreateReelErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type CreateReelError = CreateReelErrors[keyof CreateReelErrors];
|
||||
|
||||
export type CreateReelResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResReel;
|
||||
};
|
||||
|
||||
export type CreateReelResponse = CreateReelResponses[keyof CreateReelResponses];
|
||||
|
||||
export type PublishInstagram2Data = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* X-Admin-Key
|
||||
*/
|
||||
'x-admin-key'?: string | null;
|
||||
};
|
||||
path: {
|
||||
/**
|
||||
* Reel Id
|
||||
*/
|
||||
reel_id: number;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/reel/{reel_id}/instagram';
|
||||
};
|
||||
|
||||
export type PublishInstagram2Errors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type PublishInstagram2Error = PublishInstagram2Errors[keyof PublishInstagram2Errors];
|
||||
|
||||
export type PublishInstagram2Responses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResReel;
|
||||
};
|
||||
|
||||
export type PublishInstagram2Response = PublishInstagram2Responses[keyof PublishInstagram2Responses];
|
||||
|
||||
export type GetReelVideoData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Reel Id
|
||||
*/
|
||||
reel_id: number;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/reel/{reel_id}.mp4';
|
||||
};
|
||||
|
||||
export type GetReelVideoErrors = {
|
||||
/**
|
||||
* Not Found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type GetReelVideoError = GetReelVideoErrors[keyof GetReelVideoErrors];
|
||||
|
||||
export type GetReelVideoResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: unknown;
|
||||
/**
|
||||
* Partial Content
|
||||
*/
|
||||
206: unknown;
|
||||
};
|
||||
|
||||
export type GetReelCoverData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Reel Id
|
||||
*/
|
||||
reel_id: number;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/reel/{reel_id}/cover.jpg';
|
||||
};
|
||||
|
||||
export type GetReelCoverErrors = {
|
||||
/**
|
||||
* Not Found
|
||||
*/
|
||||
404: unknown;
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type GetReelCoverError = GetReelCoverErrors[keyof GetReelCoverErrors];
|
||||
|
||||
export type GetReelCoverResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: unknown;
|
||||
};
|
||||
|
||||
export type ListShortsData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/v1/shorts';
|
||||
};
|
||||
|
||||
export type ListShortsResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResShortList;
|
||||
};
|
||||
|
||||
export type ListShortsResponse = ListShortsResponses[keyof ListShortsResponses];
|
||||
|
||||
export type HealthzHealthzGetData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { listShortsOptions } from '../api/client/@tanstack/react-query.gen'
|
||||
import type { ShortItem } from '../api/client'
|
||||
import { cx } from '../lib/utils'
|
||||
import { Rail, Sec, Skel, SkelRail, TAP44 } from './ui'
|
||||
|
||||
// 유튜브는 플레이어가 200×200 이상이어야 해서, 카드 안 미리보기는 200px 너비로 띄우고 줄여 보인다.
|
||||
// 위 로고·아래 제목 줄이 작은 카드에서 겹쳐 보이지 않게 가운데를 1.4배로 키워 위아래를 잘라 낸다
|
||||
const CARD_W = 120
|
||||
const PLAYER_W = 200
|
||||
const SCALE = (CARD_W / PLAYER_W) * 1.4
|
||||
|
||||
function embed(id: string, controls: boolean) {
|
||||
const q = new URLSearchParams({ autoplay: '1', mute: '1', playsinline: '1', loop: '1', playlist: id, controls: controls ? '1' : '0', rel: '0', modestbranding: '1' })
|
||||
return `https://www.youtube-nocookie.com/embed/${id}?${q}`
|
||||
}
|
||||
|
||||
/** 화면에 보이는 동안만 true */
|
||||
function useVisible<T extends Element>(threshold = 0.5) {
|
||||
const [el, ref] = useState<T | null>(null)
|
||||
const [visible, setVisible] = useState(false)
|
||||
useEffect(() => {
|
||||
if (!el) return
|
||||
const io = new IntersectionObserver(([e]) => setVisible(e.isIntersecting), { threshold })
|
||||
io.observe(el)
|
||||
return () => io.disconnect()
|
||||
}, [el, threshold])
|
||||
return [ref, visible] as const
|
||||
}
|
||||
|
||||
/** 오늘 화면 히어로 아래 쇼츠 줄: 첫 카드만 소리 없이 재생, 누르면 전체 화면에서 위아래로 넘겨 본다 */
|
||||
export function ShortsRail() {
|
||||
const q = useQuery(listShortsOptions())
|
||||
const items = q.data?.items ?? []
|
||||
const [ref, visible] = useVisible<HTMLElement>()
|
||||
const [openAt, setOpenAt] = useState<number | null>(null)
|
||||
|
||||
if (q.isPending) {
|
||||
return (
|
||||
<section aria-hidden="true">
|
||||
<Sec title="날씨각 쇼츠" />
|
||||
<SkelRail>
|
||||
{[0, 1, 2, 3].map((i) => (
|
||||
<Skel key={i} className="aspect-[9/16] w-[120px] rounded-xl" />
|
||||
))}
|
||||
</SkelRail>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
if (!items.length) return null
|
||||
|
||||
return (
|
||||
<section ref={ref} aria-label="날씨각 쇼츠">
|
||||
<Sec title="날씨각 쇼츠" />
|
||||
<Rail label="쇼츠 목록">
|
||||
{items.map((s, i) => (
|
||||
<ShortCard key={s.id} s={s} playing={i === 0 && visible && openAt == null} onOpen={() => setOpenAt(i)} />
|
||||
))}
|
||||
</Rail>
|
||||
{openAt != null && <ShortsViewer items={items} start={openAt} onClose={() => setOpenAt(null)} />}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
function ShortCard({ s, playing, onOpen }: { s: ShortItem; playing: boolean; onOpen: () => void }) {
|
||||
return (
|
||||
<button type="button" onClick={onOpen} aria-label={`${s.title} 보기`} className="relative aspect-[9/16] w-[120px] cursor-pointer overflow-hidden rounded-xl bg-[#1d2233] p-0 text-left text-white">
|
||||
<img src={`https://i.ytimg.com/vi/${s.id}/hqdefault.jpg`} alt="" loading="lazy" className="absolute inset-0 size-full object-cover" />
|
||||
{playing && (
|
||||
<iframe
|
||||
src={embed(s.id, false)}
|
||||
title={s.title}
|
||||
allow="autoplay; encrypted-media; picture-in-picture"
|
||||
tabIndex={-1}
|
||||
className="pointer-events-none absolute top-1/2 left-1/2 border-0"
|
||||
style={{ width: PLAYER_W, height: (PLAYER_W * 16) / 9, transform: `translate(-50%, -50%) scale(${SCALE})` }}
|
||||
/>
|
||||
)}
|
||||
<span className="absolute inset-0 bg-[linear-gradient(180deg,transparent_55%,rgba(0,0,0,.65))]" aria-hidden="true" />
|
||||
<span className="absolute inset-x-2 bottom-2 line-clamp-3 text-[12px] leading-[1.3] font-bold">{s.title}</span>
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
/** 전체 화면 재생 창: 네이티브 <dialog>라 ESC·포커스 가두기가 기본. 보이는 영상 하나만 띄운다 */
|
||||
function ShortsViewer({ items, start, onClose }: { items: ShortItem[]; start: number; onClose: () => void }) {
|
||||
const dialog = useRef<HTMLDialogElement>(null)
|
||||
const list = useRef<HTMLDivElement>(null)
|
||||
const [at, setAt] = useState(start)
|
||||
|
||||
useEffect(() => {
|
||||
const el = dialog.current
|
||||
if (!el) return
|
||||
el.showModal()
|
||||
list.current?.children[start]?.scrollIntoView({ block: 'start' })
|
||||
const root = document.documentElement
|
||||
const before = root.style.overflow
|
||||
root.style.overflow = 'hidden'
|
||||
return () => {
|
||||
root.style.overflow = before
|
||||
}
|
||||
}, [start])
|
||||
|
||||
useEffect(() => {
|
||||
const box = list.current
|
||||
if (!box) return
|
||||
const io = new IntersectionObserver(
|
||||
(entries) => {
|
||||
for (const e of entries) if (e.isIntersecting) setAt(Number((e.target as HTMLElement).dataset.i))
|
||||
},
|
||||
{ root: box, threshold: 0.6 },
|
||||
)
|
||||
for (const c of box.children) io.observe(c)
|
||||
return () => io.disconnect()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<dialog ref={dialog} aria-label="날씨각 쇼츠" onClose={onClose} className="fixed inset-0 m-0 size-full max-h-none max-w-none bg-black p-0 text-white">
|
||||
{/* 유튜브 플레이어 위쪽 로고·소리 버튼을 가리지 않게 닫기 줄을 따로 둔다 */}
|
||||
<div className="flex h-[calc(env(safe-area-inset-top,0px)+52px)] items-end px-3 pb-2">
|
||||
<button type="button" onClick={onClose} aria-label="닫기" className={cx('relative grid size-9 cursor-pointer place-items-center rounded-full bg-white/15 text-xl text-white', TAP44)}>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
<div ref={list} className="h-[calc(100dvh-env(safe-area-inset-top,0px)-52px)] snap-y snap-mandatory overflow-y-auto [scrollbar-width:none]">
|
||||
{items.map((s, i) => (
|
||||
<div key={s.id} data-i={i} className="relative grid h-full snap-start place-items-center">
|
||||
{i === at ? (
|
||||
<iframe src={embed(s.id, true)} title={s.title} allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowFullScreen className="aspect-[9/16] h-full max-w-full border-0" />
|
||||
) : (
|
||||
<img src={`https://i.ytimg.com/vi/${s.id}/hqdefault.jpg`} alt="" className="aspect-[9/16] h-full max-w-full object-cover opacity-60" />
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</dialog>
|
||||
)
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import { MyGakRow } from './myGak'
|
||||
import { fromShare } from './myGakState'
|
||||
import { PostCard, PostCardSkel, PostFrame } from './Post'
|
||||
import { usePinnedLike, type PinnedKey } from './pinnedLike'
|
||||
import { ShortsRail } from './Shorts'
|
||||
import { FeedComposer, NearTalks, TalkCard, TalkGroup } from './talk'
|
||||
import { topicName, useTalkGroups } from './talkState'
|
||||
import { useRegion } from './regionContext'
|
||||
@@ -639,6 +640,7 @@ export function TodayPage() {
|
||||
// 피드 칸은 전국 공통이라 지역이 바뀌어도 글 번호가 같다. 지역마다 새로 그려 넘긴 슬라이드·펼친 상태가 남지 않게 한다
|
||||
<section key={region.code} aria-label="오늘" aria-busy={load === 'loading'} className={cx('transition-opacity', feed.isPlaceholderData && 'opacity-60')}>
|
||||
<Hero hero={f?.hero} post={f?.hero_post} today={today.data} ranked={stories} all={f?.stories ?? []} feedLoad={load} todayLoad={loadOf(today)} />
|
||||
<ShortsRail />
|
||||
<FeedComposer onPosted={(t) => setMine((m) => [t, ...m])} />
|
||||
{mine.map((t) => (
|
||||
<TalkCard key={t.talk_id} t={t} onGone={() => setMine((m) => m.filter((x) => x.talk_id !== t.talk_id))} />
|
||||
|
||||
Reference in new issue
Block a user