feat: 10/21 회의 반영 — 공유 링크·로그인 없이 댓글·구글 로그인만, 히어로·오늘의 각 좋아요·댓글, 히어로 오늘/내일 스위치, 단풍 지도 65곳·3단계
- 공유: 이미지와 함께 고정 URL을 넘기고 링크도 클립보드에 복사 - 로그인 창은 구글만, 댓글은 로그인 없이 '동네 익명'(링크·전화번호 막기, IP당 하루 20개, 같은 IP만 지우기) - 히어로·오늘의 각 카드에 좋아요·댓글 (PostType HERO·TODAY_GAK) - 히어로 오늘/내일 스위치: 내일 구간별 날씨 점수·기온·최저최고·습도·1위 각, /v1/weather/today?day=tomorrow - 단풍 지도: 단풍 그림 지도, 단풍 전·첫 단풍·절정, 단풍잎·은행잎, 명소 65곳(산림청 예측 + 가까운 지점 날짜) - 하단 탭 바 불투명 (홈 바 자리로 글이 비치지 않게) - 사람 글 동네 우선 정렬·내 글 목록, 내 각 '있는 각에서 불러오기' - 댓글 표 user_id NULL 허용·ip_hash·region_name (운영 DB ALTER 필요)
This commit is contained in:
1 parent
14f24d1ab0
commit
93e041bb91
46 files changed
+1820
-337
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 45 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
+471
-28
@@ -1,218 +1,661 @@
|
||||
{
|
||||
"source": "산림청·국립수목원·국립산림과학원 「2026년 한반도 단풍절정 예측지도」(2026.9.22 보도자료, 단풍나무류 지도)",
|
||||
"source": "산림청·국립수목원·국립산림과학원 「2026년 한반도 단풍절정 예측지도」(2026.9.22 보도자료, 단풍나무류·은행나무 지도)",
|
||||
"source_url": "https://www.korea.kr/briefing/pressReleaseView.do?newsId=156782827",
|
||||
"map_image_url": "https://www.korea.kr/common/download.do?fileId=198558074&tblKey=GMN",
|
||||
"basis": "단풍나무류 잎의 50% 이상이 물든 때(지도 기준: 단풍나무류 단풍 50% 이상). 산별 시작일은 발표에 없어 start는 null",
|
||||
"basis": "절정: 그 수종 잎의 50% 이상이 물든 때. 첫 단풍: 발표에 시작일이 없어 절정 14일 전부터로 추정. 예측 지점이 아닌 명소는 basis에 적은 가장 가까운 예측 지점 날짜를 씀",
|
||||
"license": "공공누리 제1유형(출처표시) — 정책브리핑 게재본은 '텍스트에 한하여' 1유형, 사진·이미지는 저작권자 허락 필요(지도 이미지 자체 재사용은 확인 필요)",
|
||||
"coord_source": "한국관광공사 TourAPI(KorService2 searchKeyword2) 관광지 좌표 mapy/mapx; 산마다 쓴 지점명은 coord_point(정상이 아닌 국립공원·탐방 지점일 수 있음)",
|
||||
"coord_source": "한국관광공사 TourAPI(KorService2 searchKeyword2) 좌표; 소리봉(포천)은 광릉숲길 좌표로 근사(가까운 지점 계산용, 지도엔 안 나옴)",
|
||||
"updated": "2026-10-21",
|
||||
"mountains": [
|
||||
"spots": [
|
||||
{
|
||||
"name": "설악산",
|
||||
"kind": "maple",
|
||||
"region": "강원 속초·양양·인제",
|
||||
"lat": 38.119,
|
||||
"lon": 128.465,
|
||||
"start": null,
|
||||
"peak": "2026-10-20",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "설악산 대청봉"
|
||||
},
|
||||
{
|
||||
"name": "점봉산",
|
||||
"kind": "maple",
|
||||
"region": "강원 인제·양양",
|
||||
"lat": 38.036,
|
||||
"lon": 128.471,
|
||||
"start": null,
|
||||
"peak": "2026-10-21",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "점봉산 곰배령"
|
||||
},
|
||||
{
|
||||
"name": "광덕산",
|
||||
"kind": "maple",
|
||||
"region": "강원 화천·경기 포천",
|
||||
"lat": 38.115,
|
||||
"lon": 127.439,
|
||||
"start": null,
|
||||
"peak": "2026-10-22",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "광덕산(화천)"
|
||||
},
|
||||
{
|
||||
"name": "화악산",
|
||||
"kind": "maple",
|
||||
"region": "강원 화천·경기 가평",
|
||||
"lat": 38.048,
|
||||
"lon": 127.522,
|
||||
"start": null,
|
||||
"peak": "2026-10-20",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "화악산"
|
||||
},
|
||||
{
|
||||
"name": "축령산",
|
||||
"kind": "maple",
|
||||
"region": "경기 남양주·가평",
|
||||
"lat": 37.753,
|
||||
"lon": 127.309,
|
||||
"start": null,
|
||||
"peak": "2026-10-26",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "축령산"
|
||||
},
|
||||
{
|
||||
"name": "용문산",
|
||||
"kind": "maple",
|
||||
"region": "경기 양평",
|
||||
"lat": 37.551,
|
||||
"lon": 127.569,
|
||||
"start": null,
|
||||
"peak": "2026-10-23",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "용문산"
|
||||
},
|
||||
{
|
||||
"name": "수리산",
|
||||
"kind": "maple",
|
||||
"region": "경기 군포·안양·안산",
|
||||
"lat": 37.348,
|
||||
"lon": 126.901,
|
||||
"start": null,
|
||||
"peak": "2026-11-02",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "수리산도립공원"
|
||||
},
|
||||
{
|
||||
"name": "가야산(충남)",
|
||||
"kind": "maple",
|
||||
"region": "충남 서산·예산",
|
||||
"lat": 36.704,
|
||||
"lon": 126.609,
|
||||
"start": null,
|
||||
"peak": "2026-10-31",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "가야산(서산)"
|
||||
},
|
||||
{
|
||||
"name": "소백산",
|
||||
"kind": "maple",
|
||||
"region": "충북 단양·경북 영주",
|
||||
"lat": 36.935,
|
||||
"lon": 128.457,
|
||||
"start": null,
|
||||
"peak": "2026-10-20",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "소백산 천문대"
|
||||
},
|
||||
{
|
||||
"name": "속리산",
|
||||
"kind": "maple",
|
||||
"region": "충북 보은·경북 상주",
|
||||
"lat": 36.517,
|
||||
"lon": 127.817,
|
||||
"start": null,
|
||||
"peak": "2026-10-28",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "속리산국립공원(충북)"
|
||||
},
|
||||
{
|
||||
"name": "계룡산",
|
||||
"kind": "maple",
|
||||
"region": "충남 공주·계룡, 대전",
|
||||
"lat": 36.357,
|
||||
"lon": 127.232,
|
||||
"start": null,
|
||||
"peak": "2026-11-01",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "계룡산국립공원"
|
||||
},
|
||||
{
|
||||
"name": "주왕산",
|
||||
"kind": "maple",
|
||||
"region": "경북 청송",
|
||||
"lat": 36.394,
|
||||
"lon": 129.142,
|
||||
"start": null,
|
||||
"peak": "2026-10-26",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "주왕산국립공원"
|
||||
},
|
||||
{
|
||||
"name": "팔공산",
|
||||
"kind": "maple",
|
||||
"region": "대구·경북",
|
||||
"lat": 35.99,
|
||||
"lon": 128.696,
|
||||
"start": null,
|
||||
"peak": "2026-10-30",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "팔공산국립공원(동화사지구)"
|
||||
},
|
||||
{
|
||||
"name": "가야산(경북)",
|
||||
"kind": "maple",
|
||||
"region": "경북 성주·경남 합천",
|
||||
"lat": 35.8,
|
||||
"lon": 128.142,
|
||||
"start": null,
|
||||
"peak": "2026-10-28",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "가야산국립공원(백운동 지구)"
|
||||
},
|
||||
{
|
||||
"name": "금원산",
|
||||
"kind": "maple",
|
||||
"region": "경남 거창",
|
||||
"lat": 35.731,
|
||||
"lon": 127.761,
|
||||
"start": null,
|
||||
"peak": "2026-10-25",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "금원산"
|
||||
},
|
||||
{
|
||||
"name": "지리산",
|
||||
"kind": "maple",
|
||||
"region": "경남·전남·전북",
|
||||
"lat": 35.304,
|
||||
"lon": 127.749,
|
||||
"start": null,
|
||||
"peak": "2026-10-27",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "지리산 천왕봉"
|
||||
},
|
||||
{
|
||||
"name": "변산반도",
|
||||
"kind": "maple",
|
||||
"region": "전북 부안",
|
||||
"lat": 35.642,
|
||||
"lon": 126.58,
|
||||
"start": null,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "변산반도국립공원"
|
||||
},
|
||||
{
|
||||
"name": "내장산",
|
||||
"kind": "maple",
|
||||
"region": "전북 정읍·전남 장성",
|
||||
"lat": 35.471,
|
||||
"lon": 126.867,
|
||||
"start": null,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "내장산국립공원"
|
||||
},
|
||||
{
|
||||
"name": "월출산",
|
||||
"kind": "maple",
|
||||
"region": "전남 영암·강진",
|
||||
"lat": 34.775,
|
||||
"lon": 126.722,
|
||||
"start": null,
|
||||
"peak": "2026-11-09",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "월출산국립공원"
|
||||
},
|
||||
{
|
||||
"name": "두륜산",
|
||||
"kind": "maple",
|
||||
"region": "전남 해남",
|
||||
"lat": 34.49,
|
||||
"lon": 126.616,
|
||||
"start": null,
|
||||
"peak": "2026-11-11",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "두륜산도립공원"
|
||||
},
|
||||
{
|
||||
"name": "상왕봉",
|
||||
"kind": "maple",
|
||||
"region": "전남 완도",
|
||||
"lat": 34.348,
|
||||
"lon": 126.693,
|
||||
"start": null,
|
||||
"peak": "2026-11-11",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "상왕산"
|
||||
},
|
||||
{
|
||||
"name": "교래곶자왈",
|
||||
"kind": "maple",
|
||||
"region": "제주 제주시 조천",
|
||||
"lat": 33.442,
|
||||
"lon": 126.667,
|
||||
"start": null,
|
||||
"peak": "2026-11-02",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "제주 교래자연휴양림"
|
||||
},
|
||||
{
|
||||
"name": "한라산(1100도로)",
|
||||
"kind": "maple",
|
||||
"region": "제주",
|
||||
"lat": 33.358,
|
||||
"lon": 126.463,
|
||||
"start": null,
|
||||
"peak": "2026-11-06",
|
||||
"basis": "산림청 예측(단풍나무류)",
|
||||
"coord_point": "1100고지습지"
|
||||
},
|
||||
{
|
||||
"name": "국립수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "경기 포천",
|
||||
"lat": 37.75954,
|
||||
"lon": 127.16892,
|
||||
"peak": "2026-10-31",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "국립수목원"
|
||||
},
|
||||
{
|
||||
"name": "물향기수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "경기 오산",
|
||||
"lat": 37.16737,
|
||||
"lon": 127.0622,
|
||||
"peak": "2026-11-06",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "물향기수목원"
|
||||
},
|
||||
{
|
||||
"name": "강원도립화목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "강원 춘천",
|
||||
"lat": 37.92264,
|
||||
"lon": 127.72516,
|
||||
"peak": "2026-10-27",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "강원도립화목원"
|
||||
},
|
||||
{
|
||||
"name": "미동산수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "충북 청주",
|
||||
"lat": 36.62743,
|
||||
"lon": 127.66884,
|
||||
"peak": "2026-10-29",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "미동산수목원"
|
||||
},
|
||||
{
|
||||
"name": "금강수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "세종",
|
||||
"lat": 36.4377,
|
||||
"lon": 127.23274,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "금강수목원"
|
||||
},
|
||||
{
|
||||
"name": "대구수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "대구 달서",
|
||||
"lat": 35.80265,
|
||||
"lon": 128.52063,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "대구수목원"
|
||||
},
|
||||
{
|
||||
"name": "대아수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "전북 완주",
|
||||
"lat": 35.97624,
|
||||
"lon": 127.30039,
|
||||
"peak": "2026-11-02",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "대아수목원"
|
||||
},
|
||||
{
|
||||
"name": "경남수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "경남 진주",
|
||||
"lat": 35.1572,
|
||||
"lon": 128.29574,
|
||||
"peak": "2026-11-05",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "경남수목원"
|
||||
},
|
||||
{
|
||||
"name": "완도수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "전남 완도",
|
||||
"lat": 34.36065,
|
||||
"lon": 126.66353,
|
||||
"peak": "2026-11-12",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "완도수목원"
|
||||
},
|
||||
{
|
||||
"name": "한라수목원",
|
||||
"kind": "ginkgo",
|
||||
"region": "제주 제주",
|
||||
"lat": 33.46959,
|
||||
"lon": 126.49324,
|
||||
"peak": "2026-11-16",
|
||||
"basis": "산림청 예측(은행나무)",
|
||||
"coord_point": "한라수목원"
|
||||
},
|
||||
{
|
||||
"name": "북한산",
|
||||
"kind": "maple",
|
||||
"region": "서울 강북",
|
||||
"lat": 37.65831,
|
||||
"lon": 126.99095,
|
||||
"peak": "2026-10-26",
|
||||
"basis": "가장 가까운 산림청 예측 지점(축령산, 단풍나무류) 날짜",
|
||||
"coord_point": "북한산 백운대(우이동)"
|
||||
},
|
||||
{
|
||||
"name": "도봉산",
|
||||
"kind": "maple",
|
||||
"region": "서울 도봉",
|
||||
"lat": 37.69945,
|
||||
"lon": 127.01578,
|
||||
"peak": "2026-10-26",
|
||||
"basis": "가장 가까운 산림청 예측 지점(축령산, 단풍나무류) 날짜",
|
||||
"coord_point": "도봉산"
|
||||
},
|
||||
{
|
||||
"name": "남산공원",
|
||||
"kind": "maple",
|
||||
"region": "서울 중구",
|
||||
"lat": 37.55563,
|
||||
"lon": 126.99222,
|
||||
"peak": "2026-11-02",
|
||||
"basis": "가장 가까운 산림청 예측 지점(수리산, 단풍나무류) 날짜",
|
||||
"coord_point": "남산공원(서울)"
|
||||
},
|
||||
{
|
||||
"name": "창덕궁",
|
||||
"kind": "maple",
|
||||
"region": "서울 종로",
|
||||
"lat": 37.5777,
|
||||
"lon": 126.99024,
|
||||
"peak": "2026-11-02",
|
||||
"basis": "가장 가까운 산림청 예측 지점(수리산, 단풍나무류) 날짜",
|
||||
"coord_point": "창덕궁 낙선재"
|
||||
},
|
||||
{
|
||||
"name": "화담숲",
|
||||
"kind": "maple",
|
||||
"region": "경기 광주",
|
||||
"lat": 37.34076,
|
||||
"lon": 127.28942,
|
||||
"peak": "2026-10-23",
|
||||
"basis": "가장 가까운 산림청 예측 지점(용문산, 단풍나무류) 날짜",
|
||||
"coord_point": "화담숲"
|
||||
},
|
||||
{
|
||||
"name": "오대산",
|
||||
"kind": "maple",
|
||||
"region": "강원 평창",
|
||||
"lat": 37.78652,
|
||||
"lon": 128.56441,
|
||||
"peak": "2026-10-21",
|
||||
"basis": "가장 가까운 산림청 예측 지점(점봉산, 단풍나무류) 날짜",
|
||||
"coord_point": "상원사(오대산)"
|
||||
},
|
||||
{
|
||||
"name": "치악산",
|
||||
"kind": "maple",
|
||||
"region": "강원 원주",
|
||||
"lat": 37.408,
|
||||
"lon": 128.0455,
|
||||
"peak": "2026-10-23",
|
||||
"basis": "가장 가까운 산림청 예측 지점(용문산, 단풍나무류) 날짜",
|
||||
"coord_point": "치악산 구룡자동차야영장"
|
||||
},
|
||||
{
|
||||
"name": "덕유산",
|
||||
"kind": "maple",
|
||||
"region": "전북 무주",
|
||||
"lat": 35.89192,
|
||||
"lon": 127.74295,
|
||||
"peak": "2026-10-25",
|
||||
"basis": "가장 가까운 산림청 예측 지점(금원산, 단풍나무류) 날짜",
|
||||
"coord_point": "덕유산 향적봉"
|
||||
},
|
||||
{
|
||||
"name": "대둔산",
|
||||
"kind": "maple",
|
||||
"region": "충남 논산·전북 완주",
|
||||
"lat": 36.14381,
|
||||
"lon": 127.30481,
|
||||
"peak": "2026-11-01",
|
||||
"basis": "가장 가까운 산림청 예측 지점(계룡산, 단풍나무류) 날짜",
|
||||
"coord_point": "대둔산 도립공원 수락캠핑장"
|
||||
},
|
||||
{
|
||||
"name": "마이산",
|
||||
"kind": "maple",
|
||||
"region": "전북 진안",
|
||||
"lat": 35.75846,
|
||||
"lon": 127.41119,
|
||||
"peak": "2026-10-25",
|
||||
"basis": "가장 가까운 산림청 예측 지점(금원산, 단풍나무류) 날짜",
|
||||
"coord_point": "마이산 탑사"
|
||||
},
|
||||
{
|
||||
"name": "강천산",
|
||||
"kind": "maple",
|
||||
"region": "전북 순창",
|
||||
"lat": 35.40879,
|
||||
"lon": 127.0675,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "가장 가까운 산림청 예측 지점(내장산, 단풍나무류) 날짜",
|
||||
"coord_point": "강천산 군립공원"
|
||||
},
|
||||
{
|
||||
"name": "선운산",
|
||||
"kind": "maple",
|
||||
"region": "전북 고창",
|
||||
"lat": 35.49769,
|
||||
"lon": 126.57953,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "가장 가까운 산림청 예측 지점(변산반도, 단풍나무류) 날짜",
|
||||
"coord_point": "도솔계곡(선운산)"
|
||||
},
|
||||
{
|
||||
"name": "백양사",
|
||||
"kind": "maple",
|
||||
"region": "전남 장성",
|
||||
"lat": 35.43966,
|
||||
"lon": 126.88372,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "가장 가까운 산림청 예측 지점(내장산, 단풍나무류) 날짜",
|
||||
"coord_point": "백양사"
|
||||
},
|
||||
{
|
||||
"name": "무등산",
|
||||
"kind": "maple",
|
||||
"region": "광주 동구",
|
||||
"lat": 35.13148,
|
||||
"lon": 126.981,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "가장 가까운 산림청 예측 지점(내장산, 단풍나무류) 날짜",
|
||||
"coord_point": "덕산너덜(무등산)"
|
||||
},
|
||||
{
|
||||
"name": "청량산",
|
||||
"kind": "maple",
|
||||
"region": "경북 봉화",
|
||||
"lat": 36.78866,
|
||||
"lon": 128.89501,
|
||||
"peak": "2026-10-20",
|
||||
"basis": "가장 가까운 산림청 예측 지점(소백산, 단풍나무류) 날짜",
|
||||
"coord_point": "청량산도립공원"
|
||||
},
|
||||
{
|
||||
"name": "가지산",
|
||||
"kind": "maple",
|
||||
"region": "경남 밀양·울산 울주",
|
||||
"lat": 35.58033,
|
||||
"lon": 128.98046,
|
||||
"peak": "2026-10-30",
|
||||
"basis": "가장 가까운 산림청 예측 지점(팔공산, 단풍나무류) 날짜",
|
||||
"coord_point": "가지산도립공원(밀양)"
|
||||
},
|
||||
{
|
||||
"name": "반계리 은행나무",
|
||||
"kind": "ginkgo",
|
||||
"region": "강원 원주",
|
||||
"lat": 37.29388,
|
||||
"lon": 127.78795,
|
||||
"peak": "2026-10-29",
|
||||
"basis": "가장 가까운 산림청 예측 지점(용문산, 은행나무) 날짜",
|
||||
"coord_point": "반계리 은행나무"
|
||||
},
|
||||
{
|
||||
"name": "남이섬",
|
||||
"kind": "ginkgo",
|
||||
"region": "강원 춘천",
|
||||
"lat": 37.79627,
|
||||
"lon": 127.52549,
|
||||
"peak": "2026-10-25",
|
||||
"basis": "가장 가까운 산림청 예측 지점(축령산, 은행나무) 날짜",
|
||||
"coord_point": "남이섬"
|
||||
},
|
||||
{
|
||||
"name": "서울숲",
|
||||
"kind": "ginkgo",
|
||||
"region": "서울 성동",
|
||||
"lat": 37.54307,
|
||||
"lon": 127.0418,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "가장 가까운 산림청 예측 지점(수리산, 은행나무) 날짜",
|
||||
"coord_point": "서울숲"
|
||||
},
|
||||
{
|
||||
"name": "덕수궁 돌담길",
|
||||
"kind": "ginkgo",
|
||||
"region": "서울 중구",
|
||||
"lat": 37.56608,
|
||||
"lon": 126.97489,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "가장 가까운 산림청 예측 지점(수리산, 은행나무) 날짜",
|
||||
"coord_point": "덕수궁 돌담길"
|
||||
},
|
||||
{
|
||||
"name": "성균관 명륜당",
|
||||
"kind": "ginkgo",
|
||||
"region": "서울 종로",
|
||||
"lat": 37.5861,
|
||||
"lon": 126.9957,
|
||||
"peak": "2026-10-31",
|
||||
"basis": "가장 가까운 산림청 예측 지점(국립수목원, 은행나무) 날짜",
|
||||
"coord_point": "성균관 명륜당"
|
||||
},
|
||||
{
|
||||
"name": "용문사 은행나무",
|
||||
"kind": "ginkgo",
|
||||
"region": "경기 양평",
|
||||
"lat": 37.55022,
|
||||
"lon": 127.57169,
|
||||
"peak": "2026-10-29",
|
||||
"basis": "가장 가까운 산림청 예측 지점(용문산, 은행나무) 날짜",
|
||||
"coord_point": "용문사 은행나무"
|
||||
},
|
||||
{
|
||||
"name": "곡교천 은행나무길",
|
||||
"kind": "ginkgo",
|
||||
"region": "충남 아산",
|
||||
"lat": 36.79955,
|
||||
"lon": 127.01683,
|
||||
"peak": "2026-10-26",
|
||||
"basis": "가장 가까운 산림청 예측 지점(가야산(충남), 은행나무) 날짜",
|
||||
"coord_point": "곡교천 은행나무길"
|
||||
},
|
||||
{
|
||||
"name": "현충사",
|
||||
"kind": "ginkgo",
|
||||
"region": "충남 아산",
|
||||
"lat": 36.80655,
|
||||
"lon": 127.0312,
|
||||
"peak": "2026-10-26",
|
||||
"basis": "가장 가까운 산림청 예측 지점(가야산(충남), 은행나무) 날짜",
|
||||
"coord_point": "현충사"
|
||||
},
|
||||
{
|
||||
"name": "문광저수지",
|
||||
"kind": "ginkgo",
|
||||
"region": "충북 괴산",
|
||||
"lat": 36.76832,
|
||||
"lon": 127.75077,
|
||||
"peak": "2026-10-29",
|
||||
"basis": "가장 가까운 산림청 예측 지점(미동산수목원, 은행나무) 날짜",
|
||||
"coord_point": "문광저수지"
|
||||
},
|
||||
{
|
||||
"name": "홍천 은행나무숲",
|
||||
"kind": "ginkgo",
|
||||
"region": "강원 홍천",
|
||||
"lat": 37.83213,
|
||||
"lon": 128.47071,
|
||||
"peak": "2026-10-27",
|
||||
"basis": "가장 가까운 산림청 예측 지점(강원도립화목원, 은행나무) 날짜",
|
||||
"coord_point": "홍천 은행나무숲"
|
||||
},
|
||||
{
|
||||
"name": "운곡서원",
|
||||
"kind": "ginkgo",
|
||||
"region": "경북 경주",
|
||||
"lat": 35.941,
|
||||
"lon": 129.30208,
|
||||
"peak": "2026-10-29",
|
||||
"basis": "가장 가까운 산림청 예측 지점(주왕산, 은행나무) 날짜",
|
||||
"coord_point": "운곡서원"
|
||||
},
|
||||
{
|
||||
"name": "도리마을 은행나무숲",
|
||||
"kind": "ginkgo",
|
||||
"region": "경북 경주",
|
||||
"lat": 35.9185,
|
||||
"lon": 129.0908,
|
||||
"peak": "2026-11-04",
|
||||
"basis": "가장 가까운 산림청 예측 지점(대구수목원, 은행나무) 날짜",
|
||||
"coord_point": "도리마을 은행나무숲"
|
||||
},
|
||||
{
|
||||
"name": "청라 은행마을",
|
||||
"kind": "ginkgo",
|
||||
"region": "충남 보령",
|
||||
"lat": 36.42721,
|
||||
"lon": 126.6756,
|
||||
"peak": "2026-10-26",
|
||||
"basis": "가장 가까운 산림청 예측 지점(가야산(충남), 은행나무) 날짜",
|
||||
"coord_point": "청라 은행마을"
|
||||
},
|
||||
{
|
||||
"name": "전주향교",
|
||||
"kind": "ginkgo",
|
||||
"region": "전북 전주",
|
||||
"lat": 35.81295,
|
||||
"lon": 127.15654,
|
||||
"peak": "2026-11-02",
|
||||
"basis": "가장 가까운 산림청 예측 지점(대아수목원, 은행나무) 날짜",
|
||||
"coord_point": "전주향교"
|
||||
},
|
||||
{
|
||||
"name": "부석사",
|
||||
"kind": "ginkgo",
|
||||
"region": "경북 영주",
|
||||
"lat": 36.9984,
|
||||
"lon": 128.6871,
|
||||
"peak": "2026-10-29",
|
||||
"basis": "가장 가까운 산림청 예측 지점(주왕산, 은행나무) 날짜",
|
||||
"coord_point": "부석사"
|
||||
},
|
||||
{
|
||||
"name": "보석사",
|
||||
"kind": "ginkgo",
|
||||
"region": "충남 금산",
|
||||
"lat": 36.05436,
|
||||
"lon": 127.47587,
|
||||
"peak": "2026-11-02",
|
||||
"basis": "가장 가까운 산림청 예측 지점(대아수목원, 은행나무) 날짜",
|
||||
"coord_point": "보석사"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listPlaces, listPresets, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, scoreMyGak, signup, 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, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, GetArticleData, GetArticleError, GetArticleResponse, 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, 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, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, 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, RefreshData, RefreshError, RefreshResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SignupData, SignupError, SignupResponse, 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, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, scoreMyGak, signup, 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, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, GetArticleData, GetArticleError, GetArticleResponse, 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, 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, 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, RefreshData, RefreshError, RefreshResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SignupData, SignupError, SignupResponse, 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'> & {
|
||||
@@ -78,7 +78,7 @@ export const nearestRegionOptions = (options: Options<NearestRegionData>) => que
|
||||
export const getWeatherTodayQueryKey = (options: Options<GetWeatherTodayData>) => createQueryKey('getWeatherToday', options);
|
||||
|
||||
/**
|
||||
* 오늘 3시간 칸 날씨
|
||||
* 오늘(또는 내일) 3시간 칸 날씨
|
||||
*/
|
||||
export const getWeatherTodayOptions = (options: Options<GetWeatherTodayData>) => queryOptions<GetWeatherTodayResponse, GetWeatherTodayError, GetWeatherTodayResponse, ReturnType<typeof getWeatherTodayQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
@@ -677,7 +677,7 @@ export const listCommentsInfiniteOptions = (options: Options<ListCommentsData>)
|
||||
};
|
||||
|
||||
/**
|
||||
* 댓글 쓰기 (60자)
|
||||
* 댓글 쓰기 (60자, 로그인 없으면 '동네 익명'으로 IP 당 하루 20개)
|
||||
*/
|
||||
export const addCommentMutation = (options?: Partial<Options<AddCommentData>>): UseMutationOptions<AddCommentResponse, AddCommentError, Options<AddCommentData>> => {
|
||||
const mutationOptions: UseMutationOptions<AddCommentResponse, AddCommentError, Options<AddCommentData>> = {
|
||||
@@ -694,7 +694,7 @@ export const addCommentMutation = (options?: Partial<Options<AddCommentData>>):
|
||||
};
|
||||
|
||||
/**
|
||||
* 내 댓글 지우기
|
||||
* 내 댓글 지우기 (로그인 없이 쓴 댓글은 같은 IP 에서)
|
||||
*/
|
||||
export const deleteCommentMutation = (options?: Partial<Options<DeleteCommentData>>): UseMutationOptions<DeleteCommentResponse, DeleteCommentError, Options<DeleteCommentData>> => {
|
||||
const mutationOptions: UseMutationOptions<DeleteCommentResponse, DeleteCommentError, Options<DeleteCommentData>> = {
|
||||
@@ -834,7 +834,7 @@ export const deleteMyGakMutation = (options?: Partial<Options<DeleteMyGakData>>)
|
||||
export const listTalksQueryKey = (options?: Options<ListTalksData>) => createQueryKey('listTalks', options);
|
||||
|
||||
/**
|
||||
* 동네 이야기 (전국, 최신순, 로그인 없이 보기)
|
||||
* 동네 이야기 (전국 최신순, 보는 동네와 같은 시도 글은 앞으로, 같은 사람 글은 띄움, 로그인 없이 보기)
|
||||
*/
|
||||
export const listTalksOptions = (options?: Options<ListTalksData>) => queryOptions<ListTalksResponse, ListTalksError, ListTalksResponse, ReturnType<typeof listTalksQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
@@ -852,10 +852,10 @@ export const listTalksOptions = (options?: Options<ListTalksData>) => queryOptio
|
||||
export const listTalksInfiniteQueryKey = (options?: Options<ListTalksData>): QueryKey<Options<ListTalksData>> => createQueryKey('listTalks', options, true);
|
||||
|
||||
/**
|
||||
* 동네 이야기 (전국, 최신순, 로그인 없이 보기)
|
||||
* 동네 이야기 (전국 최신순, 보는 동네와 같은 시도 글은 앞으로, 같은 사람 글은 띄움, 로그인 없이 보기)
|
||||
*/
|
||||
export const listTalksInfiniteOptions = (options?: Options<ListTalksData>) => {
|
||||
const opts = infiniteQueryOptions<ListTalksResponse, ListTalksError, InfiniteData<ListTalksResponse>, QueryKey<Options<ListTalksData>>, number | null | Pick<QueryKey<Options<ListTalksData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||
const opts = infiniteQueryOptions<ListTalksResponse, ListTalksError, InfiniteData<ListTalksResponse>, QueryKey<Options<ListTalksData>>, string | null | Pick<QueryKey<Options<ListTalksData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||
// @ts-ignore
|
||||
{
|
||||
queryFn: async ({ pageParam, queryKey, signal }) => {
|
||||
@@ -879,6 +879,54 @@ export const listTalksInfiniteOptions = (options?: Options<ListTalksData>) => {
|
||||
return opts as Omit<typeof opts, 'initialData'>;
|
||||
};
|
||||
|
||||
export const listMyTalksQueryKey = (options?: Options<ListMyTalksData>) => createQueryKey('listMyTalks', options);
|
||||
|
||||
/**
|
||||
* 내가 쓴 글 (최신순)
|
||||
*/
|
||||
export const listMyTalksOptions = (options?: Options<ListMyTalksData>) => queryOptions<ListMyTalksResponse, ListMyTalksError, ListMyTalksResponse, ReturnType<typeof listMyTalksQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await listMyTalks({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listMyTalksQueryKey(options)
|
||||
});
|
||||
|
||||
export const listMyTalksInfiniteQueryKey = (options?: Options<ListMyTalksData>): QueryKey<Options<ListMyTalksData>> => createQueryKey('listMyTalks', options, true);
|
||||
|
||||
/**
|
||||
* 내가 쓴 글 (최신순)
|
||||
*/
|
||||
export const listMyTalksInfiniteOptions = (options?: Options<ListMyTalksData>) => {
|
||||
const opts = infiniteQueryOptions<ListMyTalksResponse, ListMyTalksError, InfiniteData<ListMyTalksResponse>, QueryKey<Options<ListMyTalksData>>, string | null | Pick<QueryKey<Options<ListMyTalksData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||
// @ts-ignore
|
||||
{
|
||||
queryFn: async ({ pageParam, queryKey, signal }) => {
|
||||
// @ts-ignore
|
||||
const page: Pick<QueryKey<Options<ListMyTalksData>>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === 'object' ? pageParam : {
|
||||
query: {
|
||||
cursor: pageParam
|
||||
}
|
||||
};
|
||||
const params = createInfiniteParams(queryKey, page);
|
||||
const { data } = await listMyTalks({
|
||||
...options,
|
||||
...params,
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listMyTalksInfiniteQueryKey(options)
|
||||
});
|
||||
return opts as Omit<typeof opts, 'initialData'>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 동네 이야기 쓰기 (링크·전화번호 불가, 하루 5개)
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listPlaces, listPresets, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, scoreMyGak, signup, 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 ClientOptions, type CommentData, type CommuteData, Confidence, 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 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 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 HourCell, type HoursSlide, type HttpValidationError, 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 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 ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListPresetsData, type ListPresetsResponse, type ListPresetsResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type ListTalksData, type ListTalksError, type ListTalksErrors, type ListTalksResponse, type ListTalksResponses, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponses, type LogoutData, type LogoutError, type LogoutErrors, type LogoutResponse, type LogoutResponses, type Me, tyLine truncated
|
||||
export { addComment, addMyGak, addTalk, authConfig, blockTalkAuthor, deleteComment, deleteMyGak, deleteTalk, getArticle, getFeed, getImage, getIndex, getPost, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, likeComment, likePost, likeTalk, listArticles, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listRegions, listSaved, listTalks, login, logout, me, nearestRegion, type Options, refresh, reportTalk, savePost, scoreMyGak, signup, 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 ClientOptions, type CommentData, type CommuteData, Confidence, 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 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 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, 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 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 ListMyTalksErrors, type ListMyTalksResponse, type ListMyTalksResponses, type ListPlacesData, type ListPlacesError, type ListPlacesErrors, type ListPlacesResponse, type ListPlacesResponses, type ListPresetsData, type ListPresetsResponse, type ListPresetsResponses, type ListRegionsData, type ListRegionsError, type ListRegionsErrors, type ListRegionsResponse, type ListRegionsResponses, type ListSavedData, type ListSavedError, type ListSavedErrors, type ListSavedResponse, type ListSavedResponses, type ListTalksData, type ListTalksError, type ListTalksErrors, type ListTalksResponse, type ListTalksResponses, type LoginData, type LoginError, type LoginErrors, type LogLine 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, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, GetArticleData, GetArticleErrors, GetArticleResponses, 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, 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, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, 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, RefreshData, RefreshErrors, RefreshResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SignupData, SignupErrors, SignupResponses, 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, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, GetArticleData, GetArticleErrors, GetArticleResponses, 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, 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, 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, RefreshData, RefreshErrors, RefreshResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SignupData, SignupErrors, SignupResponses, 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> & {
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ export const listRegions = <ThrowOnError extends boolean = true>(options?: Optio
|
||||
export const nearestRegion = <ThrowOnError extends boolean = true>(options: Options<NearestRegionData, ThrowOnError>): RequestResult<NearestRegionResponses, NearestRegionErrors, ThrowOnError> => (options.client ?? client).get<NearestRegionResponses, NearestRegionErrors, ThrowOnError>({ url: '/v1/region/nearest', ...options });
|
||||
|
||||
/**
|
||||
* 오늘 3시간 칸 날씨
|
||||
* 오늘(또는 내일) 3시간 칸 날씨
|
||||
*/
|
||||
export const getWeatherToday = <ThrowOnError extends boolean = true>(options: Options<GetWeatherTodayData, ThrowOnError>): RequestResult<GetWeatherTodayResponses, GetWeatherTodayErrors, ThrowOnError> => (options.client ?? client).get<GetWeatherTodayResponses, GetWeatherTodayErrors, ThrowOnError>({ url: '/v1/weather/today', ...options });
|
||||
|
||||
@@ -209,7 +209,7 @@ export const listSaved = <ThrowOnError extends boolean = true>(options?: Options
|
||||
export const listComments = <ThrowOnError extends boolean = true>(options: Options<ListCommentsData, ThrowOnError>): RequestResult<ListCommentsResponses, ListCommentsErrors, ThrowOnError> => (options.client ?? client).get<ListCommentsResponses, ListCommentsErrors, ThrowOnError>({ url: '/v1/reaction/post/{post_id}/comment/list', ...options });
|
||||
|
||||
/**
|
||||
* 댓글 쓰기 (60자)
|
||||
* 댓글 쓰기 (60자, 로그인 없으면 '동네 익명'으로 IP 당 하루 20개)
|
||||
*/
|
||||
export const addComment = <ThrowOnError extends boolean = true>(options: Options<AddCommentData, ThrowOnError>): RequestResult<AddCommentResponses, AddCommentErrors, ThrowOnError> => (options.client ?? client).post<AddCommentResponses, AddCommentErrors, ThrowOnError>({
|
||||
url: '/v1/reaction/post/{post_id}/comment',
|
||||
@@ -221,7 +221,7 @@ export const addComment = <ThrowOnError extends boolean = true>(options: Options
|
||||
});
|
||||
|
||||
/**
|
||||
* 내 댓글 지우기
|
||||
* 내 댓글 지우기 (로그인 없이 쓴 댓글은 같은 IP 에서)
|
||||
*/
|
||||
export const deleteComment = <ThrowOnError extends boolean = true>(options: Options<DeleteCommentData, ThrowOnError>): RequestResult<DeleteCommentResponses, DeleteCommentErrors, ThrowOnError> => (options.client ?? client).delete<DeleteCommentResponses, DeleteCommentErrors, ThrowOnError>({ url: '/v1/reaction/comment/{comment_id}', ...options });
|
||||
|
||||
@@ -275,10 +275,15 @@ export const scoreMyGak = <ThrowOnError extends boolean = true>(options: Options
|
||||
export const deleteMyGak = <ThrowOnError extends boolean = true>(options: Options<DeleteMyGakData, ThrowOnError>): RequestResult<DeleteMyGakResponses, DeleteMyGakErrors, ThrowOnError> => (options.client ?? client).delete<DeleteMyGakResponses, DeleteMyGakErrors, ThrowOnError>({ url: '/v1/my-gak/{my_gak_id}', ...options });
|
||||
|
||||
/**
|
||||
* 동네 이야기 (전국, 최신순, 로그인 없이 보기)
|
||||
* 동네 이야기 (전국 최신순, 보는 동네와 같은 시도 글은 앞으로, 같은 사람 글은 띄움, 로그인 없이 보기)
|
||||
*/
|
||||
export const listTalks = <ThrowOnError extends boolean = true>(options?: Options<ListTalksData, ThrowOnError>): RequestResult<ListTalksResponses, ListTalksErrors, ThrowOnError> => (options?.client ?? client).get<ListTalksResponses, ListTalksErrors, ThrowOnError>({ url: '/v1/talk/list', ...options });
|
||||
|
||||
/**
|
||||
* 내가 쓴 글 (최신순)
|
||||
*/
|
||||
export const listMyTalks = <ThrowOnError extends boolean = true>(options?: Options<ListMyTalksData, ThrowOnError>): RequestResult<ListMyTalksResponses, ListMyTalksErrors, ThrowOnError> => (options?.client ?? client).get<ListMyTalksResponses, ListMyTalksErrors, ThrowOnError>({ url: '/v1/talk/mine', ...options });
|
||||
|
||||
/**
|
||||
* 동네 이야기 쓰기 (링크·전화번호 불가, 하루 5개)
|
||||
*/
|
||||
|
||||
@@ -662,6 +662,7 @@ export type Hero = {
|
||||
* 히어로 상태 한 줄: 습도·불쾌지수·자외선(밤 구간 빼고)·미세먼지 단계 이름. tone=warn 이면 조심(앱이 주황 글자로)
|
||||
*/
|
||||
status?: Array<HeroStat>;
|
||||
tomorrow?: HeroTomorrow | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -688,6 +689,38 @@ export type HeroStat = {
|
||||
tone: 'normal' | 'warn' | 'rain';
|
||||
};
|
||||
|
||||
/**
|
||||
* HeroTomorrow
|
||||
*
|
||||
* 히어로 '내일' 스위치. 3시간 칸 날씨는 /v1/weather/today?day=tomorrow 로 따로 받는다.
|
||||
*/
|
||||
export type HeroTomorrow = {
|
||||
/**
|
||||
* Day
|
||||
*/
|
||||
day: string;
|
||||
/**
|
||||
* Weather Slots
|
||||
*
|
||||
* 내일 구간별 날씨 점수 {morning·day·evening·night: 점수}
|
||||
*/
|
||||
weather_slots?: {
|
||||
[key: string]: number;
|
||||
};
|
||||
/**
|
||||
* Weather Why
|
||||
*
|
||||
* 내일 구간별 날씨 점수 근거
|
||||
*/
|
||||
weather_why?: {
|
||||
[key: string]: Array<WeatherWhy>;
|
||||
};
|
||||
/**
|
||||
* 내일 하루 점수로 1위인 각. score·summary 는 내일 값
|
||||
*/
|
||||
top1?: TopIndex | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* HourCell
|
||||
*/
|
||||
@@ -1150,6 +1183,30 @@ export type PostData = {
|
||||
saved?: boolean | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* PostReaction
|
||||
*
|
||||
* 포스트 틀이 아닌 카드(히어로·오늘의 각)에 붙는 좋아요·댓글.
|
||||
*/
|
||||
export type PostReaction = {
|
||||
/**
|
||||
* Post Id
|
||||
*/
|
||||
post_id: number;
|
||||
/**
|
||||
* Like Count
|
||||
*/
|
||||
like_count: number;
|
||||
/**
|
||||
* Comment Count
|
||||
*/
|
||||
comment_count: number;
|
||||
/**
|
||||
* Liked
|
||||
*/
|
||||
liked?: boolean | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* PostType
|
||||
*/
|
||||
@@ -1213,7 +1270,15 @@ export const PostType = {
|
||||
/**
|
||||
* UV
|
||||
*/
|
||||
UV: 15
|
||||
UV: 15,
|
||||
/**
|
||||
* HERO
|
||||
*/
|
||||
HERO: 16,
|
||||
/**
|
||||
* TODAY_GAK
|
||||
*/
|
||||
TODAY_GAK: 17
|
||||
} as const;
|
||||
|
||||
/**
|
||||
@@ -1350,6 +1415,12 @@ export type ReqComment = {
|
||||
* Body
|
||||
*/
|
||||
body: string;
|
||||
/**
|
||||
* Region
|
||||
*
|
||||
* 로그인 없이 쓸 때 보고 있는 동네 코드. 이름이 '마포구 익명'으로 보인다
|
||||
*/
|
||||
region?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1647,6 +1718,8 @@ export type ResFeed = {
|
||||
* Posts
|
||||
*/
|
||||
posts?: Array<PostData>;
|
||||
hero_post?: PostReaction | null;
|
||||
gak_post?: PostReaction | null;
|
||||
bands?: Bands | null;
|
||||
};
|
||||
|
||||
@@ -2118,8 +2191,10 @@ export type ResTalkList = {
|
||||
talks?: Array<TalkData>;
|
||||
/**
|
||||
* Next Cursor
|
||||
*
|
||||
* 다음 페이지를 받을 때 그대로 cursor 로 보낸다
|
||||
*/
|
||||
next_cursor?: number | null;
|
||||
next_cursor?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -3186,6 +3261,10 @@ export type WeatherSlot = {
|
||||
* Rain Prob
|
||||
*/
|
||||
rain_prob?: number | null;
|
||||
/**
|
||||
* Humidity
|
||||
*/
|
||||
humidity?: number | null;
|
||||
/**
|
||||
* Icon
|
||||
*/
|
||||
@@ -3455,6 +3534,12 @@ export type GetWeatherTodayData = {
|
||||
* 구 행정코드
|
||||
*/
|
||||
region: string;
|
||||
/**
|
||||
* Day
|
||||
*
|
||||
* tomorrow 면 내일 칸
|
||||
*/
|
||||
day?: 'today' | 'tomorrow';
|
||||
};
|
||||
url: '/v1/weather/today';
|
||||
};
|
||||
@@ -4630,10 +4715,16 @@ export type ListTalksData = {
|
||||
};
|
||||
path?: never;
|
||||
query?: {
|
||||
/**
|
||||
* Region
|
||||
*
|
||||
* 보는 사람의 구 행정코드
|
||||
*/
|
||||
region?: string | null;
|
||||
/**
|
||||
* Cursor
|
||||
*/
|
||||
cursor?: number | null;
|
||||
cursor?: string | null;
|
||||
};
|
||||
url: '/v1/talk/list';
|
||||
};
|
||||
@@ -4656,6 +4747,42 @@ export type ListTalksResponses = {
|
||||
|
||||
export type ListTalksResponse = ListTalksResponses[keyof ListTalksResponses];
|
||||
|
||||
export type ListMyTalksData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* Authorization
|
||||
*/
|
||||
authorization?: string | null;
|
||||
};
|
||||
path?: never;
|
||||
query?: {
|
||||
/**
|
||||
* Cursor
|
||||
*/
|
||||
cursor?: string | null;
|
||||
};
|
||||
url: '/v1/talk/mine';
|
||||
};
|
||||
|
||||
export type ListMyTalksErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type ListMyTalksError = ListMyTalksErrors[keyof ListMyTalksErrors];
|
||||
|
||||
export type ListMyTalksResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResTalkList;
|
||||
};
|
||||
|
||||
export type ListMyTalksResponse = ListMyTalksResponses[keyof ListMyTalksResponses];
|
||||
|
||||
export type AddTalkData = {
|
||||
body: ReqTalk;
|
||||
headers?: {
|
||||
|
||||
+37
-3
@@ -1,12 +1,13 @@
|
||||
import { useEffect, useRef, useState, type CSSProperties, type MouseEvent, type ReactNode, type RefObject } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { PostType, SlotTone, type GakSlide, type HoursSlide, type PlanSlide, type PostData, type ResFeed, type RowsSlide, type SunsetSlide, type WeekSlide } from '../api/client/types.gen'
|
||||
import { PostType, SlotTone, type GakSlide, type HoursSlide, type PlanSlide, type PostData, type PostReaction, type ResFeed, type RowsSlide, type SunsetSlide, type WeekSlide } from '../api/client/types.gen'
|
||||
import { cx } from '../lib/utils'
|
||||
import { cardBg, clockShort, fall } from './lib'
|
||||
import type { SlideBg } from './types'
|
||||
import { deg } from './weatherText'
|
||||
import { useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query'
|
||||
import { likePostMutation, unlikePostMutation } from '../api/client/@tanstack/react-query.gen'
|
||||
import { usePinnedLike, type PinnedKey } from './pinnedLike'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { CommentIcon, HeartIcon, SendIcon } from './svg'
|
||||
import { useCarousel } from './carousel'
|
||||
@@ -28,6 +29,8 @@ const ACCOUNTS: Record<PostType, readonly [string, string]> = {
|
||||
[PostType.DAY_TRIP]: ['당일치기', 'picnic'],
|
||||
[PostType.MOON]: ['오늘 밤 달', 'moon'],
|
||||
[PostType.UV]: ['자외선', 'glasses'],
|
||||
[PostType.HERO]: ['오늘 날씨', 'sun'],
|
||||
[PostType.TODAY_GAK]: ['오늘의 각', 'rabbit'],
|
||||
}
|
||||
|
||||
type Slide = HoursSlide | RowsSlide | GakSlide | SunsetSlide | WeekSlide | PlanSlide
|
||||
@@ -478,12 +481,23 @@ function FullCard({ post }: PostProps) {
|
||||
)
|
||||
}
|
||||
|
||||
type FrameProps = { title: string; account: string; avatar: string; caption?: ReactNode; more?: ReactNode; shot?: RefObject<HTMLDivElement | null>; children: ReactNode }
|
||||
type FrameProps = {
|
||||
title: string
|
||||
account: string
|
||||
avatar: string
|
||||
caption?: ReactNode
|
||||
more?: ReactNode
|
||||
shot?: RefObject<HTMLDivElement | null>
|
||||
pinned?: { key: PinnedKey; post?: PostReaction | null }
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
/** 피드 글과 같은 틀(계정 줄·본문·보내기 줄)에 날씨·각 같은 화면 조각을 담는다. 보내기는 shot(공유용 틀)이 있으면 그것을, 없으면 본문을 이미지로 */
|
||||
export function PostFrame({ title, account, avatar, caption, more, shot, children }: FrameProps) {
|
||||
export function PostFrame({ title, account, avatar, caption, more, shot, pinned, children }: FrameProps) {
|
||||
const { open } = useSheet()
|
||||
const bodyRef = useRef<HTMLDivElement>(null)
|
||||
const like = usePinnedLike(pinned?.key ?? 'gak_post', pinned?.post)
|
||||
const postId = pinned?.post?.post_id
|
||||
const share = () => {
|
||||
const el = shot?.current ?? bodyRef.current
|
||||
if (el) open({ type: 'share', share: { title, slides: [el] } })
|
||||
@@ -503,17 +517,37 @@ export function PostFrame({ title, account, avatar, caption, more, shot, childre
|
||||
</div>
|
||||
<div ref={bodyRef}>{children}</div>
|
||||
<div className="flex items-center gap-3.5 px-3 pt-2.5 pb-1 [&_svg]:size-[26px] [&_svg]:stroke-[1.9]">
|
||||
{postId != null && (
|
||||
<>
|
||||
<button type="button" onClick={like.toggle} aria-pressed={like.liked} aria-label="좋아요" className={cx('relative grid size-7 cursor-pointer place-items-center', TAP44)}>
|
||||
<HeartIcon className={like.liked ? 'fill-(--heart) stroke-(--heart)' : 'fill-none stroke-(--ink)'} />
|
||||
</button>
|
||||
<button type="button" onClick={() => open({ type: 'comments', postId })} aria-label="댓글 보기" className={cx('relative grid size-7 cursor-pointer place-items-center', TAP44)}>
|
||||
<CommentIcon className="fill-none stroke-(--ink) [stroke-linejoin:round]" />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
<button type="button" onClick={share} aria-label="보내기" className={cx('relative grid size-7 cursor-pointer place-items-center', TAP44)}>
|
||||
<SendIcon className="fill-none stroke-(--ink) [stroke-linecap:round] [stroke-linejoin:round]" />
|
||||
</button>
|
||||
{more && <span className="ml-auto text-[13px] font-bold text-(--ink2)">{more}</span>}
|
||||
</div>
|
||||
{postId != null && (
|
||||
<p className="px-3 py-0.5 text-sm font-extrabold">
|
||||
{like.failed ? <span className="text-(--heart)" role="alert">좋아요를 반영하지 못했어요. 다시 해 주세요.</span> : `좋아요 ${like.count.toLocaleString()}개`}
|
||||
</p>
|
||||
)}
|
||||
{caption && (
|
||||
<p className="px-3 pt-0.5 pb-3 text-sm">
|
||||
<b className="mr-[5px] font-extrabold">날씨각</b>
|
||||
{caption}
|
||||
</p>
|
||||
)}
|
||||
{postId != null && (
|
||||
<button type="button" onClick={() => open({ type: 'comments', postId })} className="block cursor-pointer px-3 pb-3 text-sm font-semibold text-(--ink3)">
|
||||
{pinned?.post?.comment_count ? `댓글 ${pinned.post.comment_count}개 모두 보기` : '첫 댓글 남기기'}
|
||||
</button>
|
||||
)}
|
||||
</article>
|
||||
)
|
||||
}
|
||||
+32
-60
@@ -14,9 +14,7 @@ import {
|
||||
listCommentsInfiniteOptions,
|
||||
listCommentsInfiniteQueryKey,
|
||||
listRegionsOptions,
|
||||
loginMutation,
|
||||
meQueryKey,
|
||||
signupMutation,
|
||||
unlikeCommentMutation,
|
||||
updateMeMutation,
|
||||
} from '../api/client/@tanstack/react-query.gen'
|
||||
@@ -35,6 +33,7 @@ import { useSky } from './skyContext'
|
||||
import { SHARE_SIZES, shareImage, type ShareSize } from './storyImage'
|
||||
import { SheetContext, useSheet, type SharePayload, type SheetState } from './sheetContext'
|
||||
import { HeartIcon } from './svg'
|
||||
import { MyTalks } from './talk'
|
||||
import { Avatar, Ic, Skel, StateBox, TAP44, Thumb } from './ui'
|
||||
|
||||
export function SheetProvider({ children }: { children: ReactNode }) {
|
||||
@@ -529,7 +528,7 @@ function ShareSheet({ share }: { share: SharePayload }) {
|
||||
const srcs = useRef<string[]>([])
|
||||
const [toast, setToast] = useState('')
|
||||
const image = images[size]
|
||||
const text = `${share.title} · 날씨각 ${SITE_URL}`
|
||||
const text = `${share.title} · 날씨각`
|
||||
|
||||
// 고른 크기의 이미지를 미리 만들어 둔다. 누를 때 만들면 아이폰이 공유창을 막는다
|
||||
useEffect(() => {
|
||||
@@ -558,14 +557,21 @@ function ShareSheet({ share }: { share: SharePayload }) {
|
||||
return () => list.forEach((s) => URL.revokeObjectURL(s))
|
||||
}, [])
|
||||
|
||||
// 휴대폰은 공유창에 이미지와 링크를 같이 넘기고, 공유창이 없으면 이미지를 내려받고 링크를 복사한다
|
||||
// 휴대폰은 공유창에 이미지와 링크를 같이 넘기고, 이미지만 받는 앱이 있어 링크도 복사해 둔다. 공유창이 없으면 이미지를 내려받고 링크를 복사한다
|
||||
const send = () => {
|
||||
if (!image) return
|
||||
const file = new File([image.blob], `nalssigak-${SHARE_SIZES[size].ratio.replace(':', 'x')}.png`, { type: 'image/png' })
|
||||
if (navigator.canShare?.({ files: [file], text })) {
|
||||
navigator.share({ files: [file], title: share.title, text }).then(
|
||||
() => {
|
||||
setToast('보냈어요')
|
||||
if (navigator.canShare?.({ files: [file], text, url: SITE_URL })) {
|
||||
const copied = navigator.clipboard?.writeText(SITE_URL).then(
|
||||
() => true,
|
||||
(e: unknown) => {
|
||||
console.error('[share] copy link', e)
|
||||
return false
|
||||
},
|
||||
)
|
||||
navigator.share({ files: [file], title: share.title, text, url: SITE_URL }).then(
|
||||
async () => {
|
||||
setToast((await copied) ? '보냈어요. 링크도 복사해 뒀어요' : '보냈어요')
|
||||
track('share', { content_type: 'image', item_id: share.title, method: 'share_sheet', ratio: SHARE_SIZES[size].ratio })
|
||||
},
|
||||
(e: unknown) => {
|
||||
@@ -585,7 +591,7 @@ function ShareSheet({ share }: { share: SharePayload }) {
|
||||
setToast('이미지를 내려받았어요')
|
||||
return
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(
|
||||
navigator.clipboard.writeText(`${text} ${SITE_URL}`).then(
|
||||
() => setToast('이미지를 내려받고 링크를 복사했어요'),
|
||||
() => setToast('이미지를 내려받았어요. 링크 복사는 막혀 있어요'),
|
||||
)
|
||||
@@ -715,8 +721,7 @@ function CommentRow({ c, postId }: { c: CommentData; postId: number }) {
|
||||
|
||||
function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
const { region } = useRegion()
|
||||
const { open } = useSheet()
|
||||
const { loggedIn, me } = useAuth()
|
||||
const { me } = useAuth()
|
||||
const queryClient = useQueryClient()
|
||||
const list = useInfiniteQuery({
|
||||
...listCommentsInfiniteOptions({ path: { post_id: postId } }),
|
||||
@@ -731,12 +736,11 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
|
||||
const submit = (e: FormEvent) => {
|
||||
e.preventDefault()
|
||||
if (!loggedIn) return open({ type: 'login', then: { type: 'comments', postId, draft: text } })
|
||||
const body = text.trim()
|
||||
if (!body || add.isPending) return
|
||||
setAddFailed(false)
|
||||
add.mutate(
|
||||
{ path: { post_id: postId }, body: { body } },
|
||||
{ path: { post_id: postId }, body: { body, region: region.code } },
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
setAddFailed(!res.result?.success)
|
||||
@@ -790,7 +794,7 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
</p>
|
||||
<form onSubmit={submit} className="flex items-center gap-2.5 border-t border-(--line) px-3 pt-2.5 pb-2.5">
|
||||
<input ref={inputRef} value={text} onChange={(e) => setText(e.target.value)} readOnly={add.isPending} maxLength={60} placeholder={me ? `${me.nickname}(으)로 댓글 달기…` : '댓글 달기…'} aria-label="댓글" className="min-w-0 flex-1 rounded-full border border-[#dfe5ee] bg-[#f7f9fc] px-3.5 py-2.5" />
|
||||
<button type="submit" disabled={add.isPending || (loggedIn && !text.trim())} className="cursor-pointer font-extrabold text-(--rain) disabled:opacity-40">
|
||||
<button type="submit" disabled={add.isPending || !text.trim()} className="cursor-pointer font-extrabold text-(--rain) disabled:opacity-40">
|
||||
<Swap labels={['게시', '올리는 중…']} at={add.isPending ? 1 : 0} />
|
||||
</button>
|
||||
</form>
|
||||
@@ -799,74 +803,41 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
}
|
||||
|
||||
/* ---------- 로그인 ---------- */
|
||||
const AUTH_ERRORS: Record<string, string> = {
|
||||
AUTH_FAILED: '아이디나 비밀번호가 맞지 않아요.',
|
||||
AUTH_DUPLICATE_ID: '이미 쓰고 있는 아이디예요.',
|
||||
INVALID_INPUT: '아이디는 영어 소문자·숫자·_ 4~20자, 비밀번호는 8~64자, 닉네임은 2~12자로 써 주세요.',
|
||||
}
|
||||
|
||||
function LoginSheet({ onDone, onLoggedIn }: { onDone: () => void; onLoggedIn: () => void }) {
|
||||
const { me } = useAuth()
|
||||
const [mode, setMode] = useState<'login' | 'signup'>('login')
|
||||
const [loginId, setLoginId] = useState('')
|
||||
const [password, setPassword] = useState('')
|
||||
const [nickname, setNickname] = useState('')
|
||||
const [error, setError] = useState('')
|
||||
const login = useMutation(loginMutation())
|
||||
const signup = useMutation(signupMutation())
|
||||
const pending = login.isPending || signup.isPending
|
||||
|
||||
const done = (res: ResAuth, method: 'id' | 'google' = 'id') => {
|
||||
const done = (res: ResAuth) => {
|
||||
if (!res.result?.success || !res.access_token) {
|
||||
setError(method === 'google' ? '구글로 로그인하지 못했어요. 다시 해 주세요.' : (AUTH_ERRORS[res.result?.desc ?? ''] ?? '잠시 뒤에 다시 해 주세요.'))
|
||||
setError('구글로 로그인하지 못했어요. 다시 해 주세요.')
|
||||
return
|
||||
}
|
||||
setTokens(res.access_token, res.refresh_token ?? null)
|
||||
track(method === 'google' ? 'login' : mode === 'login' ? 'login' : 'sign_up', { method })
|
||||
track('login', { method: 'google' })
|
||||
onLoggedIn()
|
||||
}
|
||||
const fail = () => setError('서버에 닿지 못했어요. 잠시 뒤에 다시 해 주세요.')
|
||||
|
||||
const submit = (e: FormEvent) => {
|
||||
e.preventDefault()
|
||||
setError('')
|
||||
if (mode === 'login') login.mutate({ body: { login_id: loginId.trim(), password } }, { onSuccess: (res) => done(res), onError: fail })
|
||||
else signup.mutate({ body: { login_id: loginId.trim(), password, nickname: nickname.trim() } }, { onSuccess: (res) => done(res), onError: fail })
|
||||
}
|
||||
|
||||
if (me) return <MeSheet onDone={onDone} />
|
||||
|
||||
const field = 'w-full rounded-[14px] border border-[#dfe5ee] bg-[#f7f9fc] px-3.5 py-3'
|
||||
return (
|
||||
<Body>
|
||||
<form onSubmit={submit} className="flex flex-col gap-2.5">
|
||||
<p className="text-center text-sm font-semibold text-(--ink2)">글쓰기·댓글은 로그인한 뒤에 할 수 있어요.</p>
|
||||
<GoogleButton onResult={(res) => done(res, 'google')} onFail={fail} />
|
||||
<div className="grid grid-cols-2 gap-1 rounded-full bg-[#f3f6fb] p-1" role="group" aria-label="로그인 또는 가입">
|
||||
{(
|
||||
[
|
||||
['login', '로그인'],
|
||||
['signup', '처음이에요'],
|
||||
] as const
|
||||
).map(([m, l]) => (
|
||||
<button key={m} type="button" aria-pressed={mode === m} onClick={() => setMode(m)} className={cx('cursor-pointer rounded-full py-2 text-sm font-extrabold', mode === m ? 'bg-(--ink) text-white' : 'text-(--ink2)')}>
|
||||
{l}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<input value={loginId} onChange={(e) => setLoginId(e.target.value)} autoComplete="username" required minLength={4} maxLength={20} placeholder="아이디" aria-label="아이디" className={field} />
|
||||
<input value={password} onChange={(e) => setPassword(e.target.value)} type="password" autoComplete={mode === 'login' ? 'current-password' : 'new-password'} required minLength={mode === 'signup' ? 8 : undefined} maxLength={64} placeholder={mode === 'signup' ? '비밀번호 (8자 이상)' : '비밀번호'} aria-label="비밀번호" className={field} />
|
||||
{mode === 'signup' && <input value={nickname} onChange={(e) => setNickname(e.target.value)} required minLength={2} maxLength={12} placeholder="닉네임 (2~12자)" aria-label="닉네임" className={field} />}
|
||||
<div className="flex flex-col gap-2.5">
|
||||
<p className="text-center text-sm font-semibold text-(--ink2)">글쓰기는 로그인한 뒤에 할 수 있어요.</p>
|
||||
<GoogleButton
|
||||
onResult={(res) => {
|
||||
setError('')
|
||||
done(res)
|
||||
}}
|
||||
onFail={fail}
|
||||
/>
|
||||
<p className="min-h-5 text-center text-[13px] font-bold text-(--heart)" aria-live="polite">
|
||||
{error}
|
||||
</p>
|
||||
<button type="submit" disabled={pending} className="cursor-pointer rounded-[14px] bg-(--orange) p-[13px] font-jua text-[17px] text-white shadow-[inset_0_-5px_0_var(--orange-deep)] disabled:opacity-60">
|
||||
<Swap labels={mode === 'login' ? ['로그인', '로그인 중…'] : ['가입하고 시작하기', '가입하는 중…']} at={pending ? 1 : 0} />
|
||||
</button>
|
||||
<button type="button" onClick={onDone} className="cursor-pointer rounded-[14px] p-[13px] text-[15px] font-extrabold text-(--ink2)">
|
||||
나중에 할게요
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</Body>
|
||||
)
|
||||
}
|
||||
@@ -987,6 +958,7 @@ function MeSheet({ onDone }: { onDone: () => void }) {
|
||||
<p className={cx('m-0 min-h-5 text-center text-[13px] font-bold', saving ? 'text-(--ink2)' : 'text-(--heart)')} aria-live="polite">
|
||||
{saving ? (saving.nickname == null ? '저장 중…' : '') : error}
|
||||
</p>
|
||||
<MyTalks />
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
|
||||
+279
-68
@@ -1,8 +1,19 @@
|
||||
import { Fragment, useEffect, useRef, useState, type ReactNode } from 'react'
|
||||
import { Link } from 'react-router'
|
||||
import { Link, useLocation } from 'react-router'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { getFeedOptions, getWeatherTodayOptions } from '../api/client/@tanstack/react-query.gen'
|
||||
import { RainType, Sky, type BandArticle, type BandEvent, type Hero as HeroData, type ResWeatherToday, type TalkData, type TopIndex, type WeatherSlot } from '../api/client/types.gen'
|
||||
import {
|
||||
RainType,
|
||||
Sky,
|
||||
type BandArticle,
|
||||
type BandEvent,
|
||||
type Hero as HeroData,
|
||||
type PostReaction,
|
||||
type ResWeatherToday,
|
||||
type TalkData,
|
||||
type TopIndex,
|
||||
type WeatherSlot,
|
||||
} from '../api/client/types.gen'
|
||||
import { cx } from '../lib/utils'
|
||||
import { cardBg, fall, kindOfHour, kst, type Load, loadOf, MEDALS, type TimeKind, WEEKDAYS } from './lib'
|
||||
import { FoliageCard } from './foliageMap'
|
||||
@@ -10,13 +21,14 @@ import { InstallBanner } from './installBanner'
|
||||
import { MyGakRow } from './myGak'
|
||||
import { fromShare } from './myGakState'
|
||||
import { PostCard, PostCardSkel, PostFrame } from './Post'
|
||||
import { usePinnedLike } from './pinnedLike'
|
||||
import { FeedComposer, TalkCard } from './talk'
|
||||
import { useFeedTalks } from './talkState'
|
||||
import { useRegion } from './regionContext'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { useSky } from './skyContext'
|
||||
import { DayShareCard, DayShareGrid, GakShareCard, type DayShare } from './shareCards'
|
||||
import { SendIcon } from './svg'
|
||||
import { CommentIcon, HeartIcon, SendIcon } from './svg'
|
||||
import { Ic, Rail, Sec, Skel, StateBox, TAP44, Thumb } from './ui'
|
||||
import { deg, slotAt } from './weatherText'
|
||||
|
||||
@@ -32,10 +44,24 @@ const PREVIEW: Record<TimeKind, { label: string; hour: number }> = {
|
||||
}
|
||||
|
||||
// 비·눈 줄기: 위치·주기를 엇갈려 고르게
|
||||
const DROPS = Array.from({ length: 22 }, (_, i) => ({ left: `${(i * 41) % 100}%`, '--top': `${(i * 29) % 90}%`, '--dl': `${((i * 37) % 100) / 100}s`, '--dur': `${0.55 + ((i * 13) % 5) / 10}s` }))
|
||||
const FLAKES = Array.from({ length: 16 }, (_, i) => ({ left: `${(i * 47) % 100}%`, '--top': `${(i * 31) % 90}%`, '--dl': `${((i * 53) % 100) / 25}s`, '--dur': `${3.2 + ((i * 7) % 5) / 2}s` }))
|
||||
const DROPS = Array.from({ length: 22 }, (_, i) => ({
|
||||
left: `${(i * 41) % 100}%`,
|
||||
'--top': `${(i * 29) % 90}%`,
|
||||
'--dl': `${((i * 37) % 100) / 100}s`,
|
||||
'--dur': `${0.55 + ((i * 13) % 5) / 10}s`,
|
||||
}))
|
||||
const FLAKES = Array.from({ length: 16 }, (_, i) => ({
|
||||
left: `${(i * 47) % 100}%`,
|
||||
'--top': `${(i * 31) % 90}%`,
|
||||
'--dl': `${((i * 53) % 100) / 25}s`,
|
||||
'--dur': `${3.2 + ((i * 7) % 5) / 2}s`,
|
||||
}))
|
||||
|
||||
const STARS = Array.from({ length: 26 }, (_, i) => ({ left: `${(i * 37) % 100}%`, top: `${(i * 53) % 60}%`, opacity: 0.4 + ((i * 7) % 6) / 10 }))
|
||||
const STARS = Array.from({ length: 26 }, (_, i) => ({
|
||||
left: `${(i * 37) % 100}%`,
|
||||
top: `${(i * 53) % 60}%`,
|
||||
opacity: 0.4 + ((i * 7) % 6) / 10,
|
||||
}))
|
||||
// 별똥별 셋: 위치·길이·주기를 엇갈려 하나씩 떨어지게
|
||||
const SHOOTS = [
|
||||
{ top: '6%', left: '80%', '--len': '90px', '--dur': '7s', '--dl': '1.5s' },
|
||||
@@ -73,7 +99,12 @@ function heroVal(load: Load, v: ReactNode, skel: string) {
|
||||
const failed = (load: Load) => load === 'error' || load === 'retrying'
|
||||
|
||||
// 미리보기 탭과 서버 구간 이름. 저녁 탭(노을 하늘)은 서버의 evening 구간
|
||||
const SLOT_KEY: Record<TimeKind, string> = { morning: 'morning', day: 'day', sunset: 'evening', night: 'night' }
|
||||
const SLOT_KEY: Record<TimeKind, string> = {
|
||||
morning: 'morning',
|
||||
day: 'day',
|
||||
sunset: 'evening',
|
||||
night: 'night',
|
||||
}
|
||||
|
||||
/** 미리보기 시간대면 이미 받은 구간 점수·순위로 다시 줄 세운다. 그 구간과 안 겹치는 각은 흐리게 끝으로. 구간 값이 없으면(예전 캐시) 그대로 */
|
||||
function atSlot(items: TopIndex[], kind: TimeKind | null): TopIndex[] {
|
||||
@@ -81,12 +112,27 @@ function atSlot(items: TopIndex[], kind: TimeKind | null): TopIndex[] {
|
||||
if (!k || !items.some((g) => Object.keys(g.slot_ranks ?? {}).length)) return items
|
||||
const on = items.filter((g) => g.slot_ranks?.[k] != null && g.slots?.[k] != null)
|
||||
return [
|
||||
...on.map((g) => ({ ...g, score: g.slots![k], rank: g.slot_ranks![k], active: true })).sort((a, b) => a.rank - b.rank),
|
||||
...on
|
||||
.map((g) => ({
|
||||
...g,
|
||||
score: g.slots![k],
|
||||
rank: g.slot_ranks![k],
|
||||
active: true,
|
||||
}))
|
||||
.sort((a, b) => a.rank - b.rank),
|
||||
...items.filter((g) => !on.includes(g)).map((g) => ({ ...g, active: false })),
|
||||
]
|
||||
}
|
||||
|
||||
type HeroProps = { hero?: HeroData | null; today?: ResWeatherToday; ranked: TopIndex[]; all: TopIndex[]; feedLoad: Load; todayLoad: Load }
|
||||
type HeroProps = {
|
||||
hero?: HeroData | null
|
||||
post?: PostReaction | null
|
||||
today?: ResWeatherToday
|
||||
ranked: TopIndex[]
|
||||
all: TopIndex[]
|
||||
feedLoad: Load
|
||||
todayLoad: Load
|
||||
}
|
||||
|
||||
type Weather = 'clear' | 'partly' | 'cloudy' | 'rain' | 'snow' | 'sleet'
|
||||
|
||||
@@ -99,31 +145,67 @@ function weatherOf(slot?: WeatherSlot): Weather {
|
||||
return slot?.sky === Sky.CLOUDY ? 'cloudy' : slot?.sky === Sky.PARTLY ? 'partly' : 'clear'
|
||||
}
|
||||
|
||||
const WEATHER_ICON: Record<Weather, string> = { clear: 'sun', partly: 'sun_cloud', cloudy: 'cloud', rain: 'rain', snow: 'snow', sleet: 'snow' }
|
||||
const WEATHER_ICON: Record<Weather, string> = {
|
||||
clear: 'sun',
|
||||
partly: 'sun_cloud',
|
||||
cloudy: 'cloud',
|
||||
rain: 'rain',
|
||||
snow: 'snow',
|
||||
sleet: 'snow',
|
||||
}
|
||||
// 구름 수: 구름 많음 둘, 흐림·비·눈 셋
|
||||
const CLOUDS = [
|
||||
{ cls: 'top-9 left-[5%] h-8 w-[84px]', d: '.1s', f: '6s' },
|
||||
{ cls: 'top-[96px] left-[63%] h-9 w-[96px]', d: '.25s', f: '6.4s' },
|
||||
{ cls: 'top-[30px] left-[72%] h-7 w-[64px]', d: '.4s', f: '5.4s' },
|
||||
]
|
||||
const CLOUD_N: Record<Weather, number> = { clear: 0, partly: 2, cloudy: 3, rain: 3, snow: 3, sleet: 3 }
|
||||
const CLOUD_N: Record<Weather, number> = {
|
||||
clear: 0,
|
||||
partly: 2,
|
||||
cloudy: 3,
|
||||
rain: 3,
|
||||
snow: 3,
|
||||
sleet: 3,
|
||||
}
|
||||
|
||||
function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
const { open } = useSheet()
|
||||
const like = usePinnedLike('hero_post', post)
|
||||
const { region } = useRegion()
|
||||
const tplRef = useRef<HTMLDivElement>(null)
|
||||
const gridRef = useRef<HTMLDivElement>(null)
|
||||
// 내일 스위치: 내일 칸 날씨는 켤 때 받고, 시간대는 화면 전체 하늘과 따로 히어로 안에서만 고른다
|
||||
// 내일 날씨 페이지(/tomorrow/...)로 들어오면 내일이 켜진 채로
|
||||
const { pathname } = useLocation()
|
||||
const [tmr, setTmr] = useState(() => pathname.startsWith('/tomorrow/'))
|
||||
const [tmrKind, setTmrKind] = useState<TimeKind>('day')
|
||||
const tomorrowQ = useQuery({
|
||||
...getWeatherTodayOptions({
|
||||
query: { region: region.code, day: 'tomorrow' },
|
||||
}),
|
||||
enabled: tmr,
|
||||
})
|
||||
const ahead = hero?.tomorrow
|
||||
const share = () =>
|
||||
tplRef.current && open({ type: 'share', share: { title: `${region.name} 오늘 날씨`, slides: [tplRef.current], square: gridRef.current ? [gridRef.current] : undefined } })
|
||||
tplRef.current &&
|
||||
open({
|
||||
type: 'share',
|
||||
share: {
|
||||
title: `${region.name} ${tmr ? '내일' : '오늘'} 날씨`,
|
||||
slides: [tplRef.current],
|
||||
square: gridRef.current ? [gridRef.current] : undefined,
|
||||
},
|
||||
})
|
||||
const { preview, setServerKind, setPreview } = useSky()
|
||||
const mode: Mode = preview ?? 'now'
|
||||
const mode: Mode = tmr ? tmrKind : (preview ?? 'now')
|
||||
const clock = useNow()
|
||||
const t = kst(clock)
|
||||
const t = kst(tmr ? new Date(clock.getTime() + 86400000) : clock)
|
||||
const nowKind = hero?.sky_mode ?? kindOfHour(t.h, t.mo, t.mi)
|
||||
const kind = mode === 'now' ? nowKind : mode
|
||||
// 화면 전체 하늘 배경도 같은 시간대로 맞춘다
|
||||
useEffect(() => setServerKind(hero?.sky_mode ?? null), [hero?.sky_mode, setServerKind])
|
||||
const slots = today?.slots ?? []
|
||||
const slots = (tmr ? tomorrowQ.data?.slots : today?.slots) ?? []
|
||||
const slotsLoad = tmr ? loadOf(tomorrowQ) : todayLoad
|
||||
// 그 시각 칸, 비어 있으면(지난 새벽 칸 등) 그 뒤 첫 예보 칸
|
||||
// 지금은 가장 가까운 3시간 칸(17시면 18시 칸). 시간대는 그 시각 칸, 비어 있으면(지난 새벽 칸 등) 그 뒤 첫 예보 칸
|
||||
const slotOf = (k: TimeKind | 'now') => {
|
||||
@@ -137,35 +219,69 @@ function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
return s?.temp_c != null ? s : (slots.find((x) => kst(x.at).h > h && x.temp_c != null) ?? s)
|
||||
}
|
||||
const weather = weatherOf(slotOf(mode))
|
||||
const slotScore = mode === 'now' ? undefined : hero?.weather_slots?.[SLOT_KEY[mode]]
|
||||
const score = slotScore ?? hero?.weather_score
|
||||
const slotScore = mode === 'now' ? undefined : (tmr ? ahead?.weather_slots : hero?.weather_slots)?.[SLOT_KEY[mode]]
|
||||
const score = tmr ? slotScore : (slotScore ?? hero?.weather_score)
|
||||
// 점수 옆 ? 버튼: 보고 있는 시간대(지금이면 지금 구간)의 날씨 점수 근거
|
||||
const whyKey = mode === 'now' ? SLOT_KEY[nowKind] : SLOT_KEY[mode]
|
||||
const why = hero?.weather_why?.[whyKey]
|
||||
const whyLabel = mode === 'now' || mode === nowKind ? '지금' : PREVIEW[mode].label
|
||||
const slotTop = mode === 'now' ? undefined : ranked.find((g) => g.active)
|
||||
const top1 = slotTop ?? hero?.top1
|
||||
const why = (tmr ? ahead?.weather_why : hero?.weather_why)?.[whyKey]
|
||||
const whyLabel = tmr && mode !== 'now' ? `내일 ${PREVIEW[mode].label}` : mode === 'now' || mode === nowKind ? '지금' : PREVIEW[mode].label
|
||||
const slotTop = mode === 'now' || tmr ? undefined : ranked.find((g) => g.active)
|
||||
const top1 = tmr ? ahead?.top1 : (slotTop ?? hero?.top1)
|
||||
// 저녁(노을)부터는 가운데 동그라미가 오늘 밤 달 모양이 된다
|
||||
const moon = (kind === 'sunset' || kind === 'night') && hero?.moon_name && hero.moon_pct != null ? { name: hero.moon_name, pct: hero.moon_pct, waning: WANING.includes(hero.moon_name) } : null
|
||||
const moon =
|
||||
!tmr && (kind === 'sunset' || kind === 'night') && hero?.moon_name && hero.moon_pct != null
|
||||
? {
|
||||
name: hero.moon_name,
|
||||
pct: hero.moon_pct,
|
||||
waning: WANING.includes(hero.moon_name),
|
||||
}
|
||||
: null
|
||||
// 말풍선 머리말은 칸 이름 그대로: 지금은 / 아침은 / 낮은 / 저녁은 / 밤은
|
||||
const when = mode === 'now' || mode === nowKind ? '지금' : PREVIEW[mode].label
|
||||
const bubble = slotTop ? (slotTop.score >= 70 ? `${when}은 ${slotTop.name}!` : `${when}은 쉬어 가요`) : hero ? (hero.bubble ?? '지금은 쉬어 가요') : failed(feedLoad) ? '앗, 날씨를 못 불러왔어요' : null
|
||||
const status = hero?.status ?? []
|
||||
const bubble = tmr
|
||||
? top1
|
||||
? top1.score >= 70
|
||||
? `내일은 ${top1.name}!`
|
||||
: '내일은 쉬어 가요'
|
||||
: null
|
||||
: slotTop
|
||||
? slotTop.score >= 70
|
||||
? `${when}은 ${slotTop.name}!`
|
||||
: `${when}은 쉬어 가요`
|
||||
: hero
|
||||
? (hero.bubble ?? '지금은 쉬어 가요')
|
||||
: failed(feedLoad)
|
||||
? '앗, 날씨를 못 불러왔어요'
|
||||
: null
|
||||
// 내일은 최저·최고 기온과 고른 시간대 습도
|
||||
const temps = slots.flatMap((x) => (x.temp_c != null ? [x.temp_c] : []))
|
||||
const humidity = tmr && mode !== 'now' ? slotOf(mode)?.humidity : null
|
||||
const status = tmr
|
||||
? [
|
||||
...(temps.length
|
||||
? [
|
||||
{ label: '최저', value: deg(Math.min(...temps)), tone: 'info' },
|
||||
{ label: '최고', value: deg(Math.max(...temps)), tone: 'info' },
|
||||
]
|
||||
: []),
|
||||
...(humidity != null ? [{ label: '습도', value: `${humidity}%`, tone: 'info' }] : []),
|
||||
]
|
||||
: (hero?.status ?? [])
|
||||
const rain = weather === 'rain' || weather === 'sleet'
|
||||
const snow = weather === 'snow' || weather === 'sleet'
|
||||
|
||||
// 공유 이미지: 아침~밤 네 시간대 모두. 점수는 시간대 점수, 각은 그 시간대 1등
|
||||
const days: DayShare[] = KINDS.map((k) => {
|
||||
const isNow = k === nowKind
|
||||
const isNow = !tmr && k === nowKind
|
||||
const s = slotOf(isNow ? 'now' : k)
|
||||
const top = atSlot(all, k).find((g) => g.active)
|
||||
const top = tmr ? ahead?.top1 : atSlot(all, k).find((g) => g.active)
|
||||
return {
|
||||
kind: k,
|
||||
label: PREVIEW[k].label,
|
||||
now: isNow,
|
||||
icon: k === 'night' && weatherOf(s) === 'clear' ? 'moon' : WEATHER_ICON[weatherOf(s)],
|
||||
temp: s?.temp_c != null ? deg(s.temp_c) : '–',
|
||||
score: hero?.weather_slots?.[SLOT_KEY[k]] ?? (isNow ? hero?.weather_score : null),
|
||||
score: (tmr ? ahead?.weather_slots : hero?.weather_slots)?.[SLOT_KEY[k]] ?? (isNow ? hero?.weather_score : null),
|
||||
gak: top ? { name: top.name, icon: top.icon } : null,
|
||||
}
|
||||
})
|
||||
@@ -190,12 +306,58 @@ function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
</div>
|
||||
)}
|
||||
<div className="relative z-[3] flex items-center justify-between">
|
||||
<p className="m-0 text-[14px] font-bold opacity-80">
|
||||
{t.mo}월 {t.d}일 {WEEKDAYS[t.wd]}요일
|
||||
</p>
|
||||
<button type="button" onClick={share} aria-label="오늘 날씨 보내기" className={cx('relative grid size-7 cursor-pointer place-items-center opacity-80 [&_svg]:size-[22px] [&_svg]:stroke-[2]', TAP44)}>
|
||||
<SendIcon className="fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round]" />
|
||||
</button>
|
||||
<span className="flex items-center gap-2">
|
||||
<span className="b-strip grid grid-cols-2 rounded-full p-[3px]" role="radiogroup" aria-label="오늘 또는 내일 날씨">
|
||||
{(
|
||||
[
|
||||
[false, '오늘'],
|
||||
[true, '내일'],
|
||||
] as const
|
||||
).map(([v, l]) => (
|
||||
<button
|
||||
key={l}
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={tmr === v}
|
||||
onClick={() => setTmr(v)}
|
||||
className={cx('cursor-pointer rounded-full px-2.5 py-0.5 font-jua text-[13px]', tmr === v ? 'b-strip-on text-(--orange-deep)' : 'opacity-75')}
|
||||
>
|
||||
{l}
|
||||
</button>
|
||||
))}
|
||||
</span>
|
||||
<span className="text-[13px] font-bold opacity-80">
|
||||
{t.mo}월 {t.d}일 {WEEKDAYS[t.wd]}요일
|
||||
</span>
|
||||
</span>
|
||||
<span className="flex items-center gap-3 [&_svg]:size-[22px] [&_svg]:stroke-[2]">
|
||||
{post && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
onClick={like.toggle}
|
||||
aria-pressed={like.liked}
|
||||
aria-label={like.failed ? '좋아요를 반영하지 못했어요. 다시 눌러 주세요' : '오늘 날씨 좋아요'}
|
||||
className={cx('relative flex cursor-pointer items-center gap-1 text-[13px] font-extrabold', TAP44, !like.liked && 'opacity-80')}
|
||||
>
|
||||
<HeartIcon className={like.liked ? 'fill-(--heart) stroke-(--heart)' : 'fill-none stroke-current'} />
|
||||
{like.count > 0 && like.count.toLocaleString()}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => open({ type: 'comments', postId: post.post_id })}
|
||||
aria-label="오늘 날씨 댓글"
|
||||
className={cx('relative flex cursor-pointer items-center gap-1 text-[13px] font-extrabold opacity-80', TAP44)}
|
||||
>
|
||||
<CommentIcon className="fill-none stroke-current [stroke-linejoin:round]" />
|
||||
{post.comment_count > 0 && post.comment_count.toLocaleString()}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
<button type="button" onClick={share} aria-label="오늘 날씨 보내기" className={cx('relative grid size-7 cursor-pointer place-items-center opacity-80', TAP44)}>
|
||||
<SendIcon className="fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round]" />
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<div className="relative h-[146px]">
|
||||
{CLOUDS.slice(0, CLOUD_N[weather]).map((c) => (
|
||||
@@ -205,32 +367,47 @@ function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
))}
|
||||
<div className="b-fall absolute top-2 left-1/2 -ml-16 aspect-square w-32" style={fall('0s', '5.6s')}>
|
||||
<div className="b-sun b-bob relative grid size-full place-items-center rounded-full text-center">
|
||||
{/* 안 보이는 쪽을 덮어 오늘 밤 달 모양으로 */}
|
||||
{moon && (
|
||||
<svg viewBox="-1 -1 2 2" className="pointer-events-none absolute inset-0 size-full" aria-hidden="true">
|
||||
<path d={moonPath(moon.pct, 1, false)} fill={kind === 'sunset' ? 'rgb(96 40 86 / .55)' : 'rgb(34 30 86 / .62)'} transform={moon.waning ? 'scale(-1,1)' : undefined} />
|
||||
</svg>
|
||||
)}
|
||||
<span className={cx('relative', moon && '[text-shadow:0_0_6px_#fff,0_0_12px_#fff]')}>
|
||||
<small className="block font-jua text-[12px]">{failed(feedLoad) ? '점수를 못 불러왔어요' : `${slotScore != null && mode !== 'now' ? PREVIEW[mode].label : '지금'} 날씨 점수`}</small>
|
||||
<b className="block font-bagel text-[52px] leading-[0.95] font-normal">{heroVal(feedLoad, score, 'w-[84px]')}</b>
|
||||
</span>
|
||||
{why && score != null && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => open({ type: 'weatherWhy', why: { label: whyLabel, score, why } })}
|
||||
aria-label={`${whyLabel} 날씨 점수 ${score}점, 어떻게 나왔는지 보기`}
|
||||
className={cx('absolute right-0 bottom-1 z-[2] grid size-7 cursor-pointer place-items-center rounded-full bg-white font-jua text-[16px] text-(--orange-deep) shadow-[0_2px_6px_rgb(40_48_74/0.25)]', TAP44)}
|
||||
>
|
||||
?
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{/* 안 보이는 쪽을 덮어 오늘 밤 달 모양으로 */}
|
||||
{moon && (
|
||||
<svg viewBox="-1 -1 2 2" className="pointer-events-none absolute inset-0 size-full" aria-hidden="true">
|
||||
<path d={moonPath(moon.pct, 1, false)} fill={kind === 'sunset' ? 'rgb(96 40 86 / .55)' : 'rgb(34 30 86 / .62)'} transform={moon.waning ? 'scale(-1,1)' : undefined} />
|
||||
</svg>
|
||||
)}
|
||||
<span className={cx('relative', moon && '[text-shadow:0_0_6px_#fff,0_0_12px_#fff]')}>
|
||||
<small className="block font-jua text-[12px]">
|
||||
{failed(feedLoad) ? '점수를 못 불러왔어요' : `${tmr && mode !== 'now' ? `내일 ${PREVIEW[mode].label}` : slotScore != null && mode !== 'now' ? PREVIEW[mode].label : '지금'} 날씨 점수`}
|
||||
</small>
|
||||
<b className="block font-bagel text-[52px] leading-[0.95] font-normal">{heroVal(feedLoad, score, 'w-[84px]')}</b>
|
||||
</span>
|
||||
{why && score != null && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
open({
|
||||
type: 'weatherWhy',
|
||||
why: { label: whyLabel, score, why },
|
||||
})
|
||||
}
|
||||
aria-label={`${whyLabel} 날씨 점수 ${score}점, 어떻게 나왔는지 보기`}
|
||||
className={cx(
|
||||
'absolute right-0 bottom-1 z-[2] grid size-7 cursor-pointer place-items-center rounded-full bg-white font-jua text-[16px] text-(--orange-deep) shadow-[0_2px_6px_rgb(40_48_74/0.25)]',
|
||||
TAP44,
|
||||
)}
|
||||
>
|
||||
?
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="relative z-[3] text-center">
|
||||
{top1 ? (
|
||||
<button type="button" onClick={() => open({ type: 'gak', indexId: top1.index_id })} aria-label={`${bubble ?? ''} 1위 ${top1.name} ${top1.score}점, 계산 근거 보기`} className="cursor-pointer font-jua text-[24px] leading-tight">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => open({ type: 'gak', indexId: top1.index_id })}
|
||||
aria-label={`${bubble ?? ''} 1위 ${top1.name} ${top1.score}점, 계산 근거 보기`}
|
||||
className="cursor-pointer font-jua text-[24px] leading-tight"
|
||||
>
|
||||
{bubble}
|
||||
</button>
|
||||
) : (
|
||||
@@ -242,7 +419,11 @@ function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
<p className="m-0 mt-1.5 flex flex-wrap justify-center gap-x-1.5 font-jua text-[14px]">
|
||||
{status.map((x, i) => (
|
||||
<Fragment key={x.label}>
|
||||
{i > 0 && <span className="opacity-30" aria-hidden="true">·</span>}
|
||||
{i > 0 && (
|
||||
<span className="opacity-30" aria-hidden="true">
|
||||
·
|
||||
</span>
|
||||
)}
|
||||
<span className={cx('whitespace-nowrap', x.tone === 'warn' && 'b-warn')}>
|
||||
<span className={cx(x.tone !== 'warn' && 'opacity-75')}>{x.label}</span> <b className="font-normal">{x.value}</b>
|
||||
</span>
|
||||
@@ -253,14 +434,21 @@ function Hero({ hero, today, ranked, all, feedLoad, todayLoad }: HeroProps) {
|
||||
</div>
|
||||
<div className="b-strip relative z-[3] mt-2.5 grid grid-cols-4 gap-1 rounded-[18px] p-[3px]" role="tablist" aria-label="하루 흐름, 누르면 그 시간대 하늘로">
|
||||
{KINDS.map((k) => {
|
||||
const isNow = k === nowKind
|
||||
const isNow = !tmr && k === nowKind
|
||||
const s = slotOf(isNow ? 'now' : k)
|
||||
const on = k === kind
|
||||
return (
|
||||
<button key={k} type="button" role="tab" aria-selected={on} onClick={() => setPreview(isNow ? null : k)} className={cx('flex cursor-pointer flex-col items-center rounded-[14px] py-1.5', on && 'b-strip-on')}>
|
||||
<button
|
||||
key={k}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={on}
|
||||
onClick={() => (tmr ? setTmrKind(k) : setPreview(isNow ? null : k))}
|
||||
className={cx('flex cursor-pointer flex-col items-center rounded-[14px] py-1.5', on && 'b-strip-on')}
|
||||
>
|
||||
<span className={cx('text-[13px] font-bold', on ? 'text-(--orange-deep)' : 'opacity-75')}>{isNow ? '지금' : PREVIEW[k].label}</span>
|
||||
<Ic name={k === 'night' && weatherOf(s) === 'clear' ? 'moon' : WEATHER_ICON[weatherOf(s)]} className="my-0.5 h-[22px] w-[22px] object-contain" />
|
||||
<b className="font-jua text-[15px] font-normal">{heroVal(todayLoad, s?.temp_c != null ? deg(s.temp_c) : null, 'w-7')}</b>
|
||||
<b className="font-jua text-[15px] font-normal">{heroVal(slotsLoad, s?.temp_c != null ? deg(s.temp_c) : null, 'w-7')}</b>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
@@ -281,12 +469,20 @@ function moonPath(pct: number, r: number, lit: boolean) {
|
||||
return `M0,${-r} A${r},${r} 0 0 ${lit ? 1 : 0} 0,${r} ${edge}`
|
||||
}
|
||||
|
||||
function GakCard({ items, place, at }: { items: TopIndex[]; place: string; at: string }) {
|
||||
function GakCard({ items, post, place, at }: { items: TopIndex[]; post?: PostReaction | null; place: string; at: string }) {
|
||||
const { open } = useSheet()
|
||||
const tplRef = useRef<HTMLDivElement>(null)
|
||||
const top = items.filter((g) => g.active).slice(0, 5)
|
||||
return (
|
||||
<PostFrame title={`오늘의 각 · ${place}`} account="오늘의 각" avatar="rabbit" more={<Link to="/gak">전체 보기</Link>} caption="누르면 계산 근거를 보여 줘요" shot={tplRef}>
|
||||
<PostFrame
|
||||
title={`오늘의 각 · ${place}`}
|
||||
account="오늘의 각"
|
||||
avatar="rabbit"
|
||||
more={<Link to="/gak">전체 보기</Link>}
|
||||
caption="누르면 계산 근거를 보여 줘요"
|
||||
shot={tplRef}
|
||||
pinned={{ key: 'gak_post', post }}
|
||||
>
|
||||
<GakShareCard items={top} title={`오늘의 각 · ${place} ${at}`} ref={tplRef} />
|
||||
<div className="b-band-2 px-4 pt-3.5 pb-3">
|
||||
<p className="m-0 font-jua text-[19px]">
|
||||
@@ -368,6 +564,8 @@ function SeasonBand({ news }: { news: BandArticle[] }) {
|
||||
)
|
||||
}
|
||||
|
||||
const TALK_EVERY = 3
|
||||
|
||||
export function TodayPage() {
|
||||
const { region } = useRegion()
|
||||
const feed = useQuery(getFeedOptions({ query: { region: region.code } }))
|
||||
@@ -382,8 +580,19 @@ export function TodayPage() {
|
||||
const nowAt = f?.hero?.now_at
|
||||
const load = loadOf(feed)
|
||||
const [mine, setMine] = useState<TalkData[]>([])
|
||||
// 사람들이 쓴 글은 운영 포스트 3개마다 하나씩. 방금 올린 내 글은 글쓰기 칸 아래에 따로 있으니 빼고
|
||||
const talks = useFeedTalks().filter((t) => !mine.some((m) => m.talk_id === t.talk_id))
|
||||
// 사람들이 쓴 글은 4·7·10번째 포스트 뒤에 하나씩(3번째 뒤 행사 띠와 안 붙게), 남은 글은 피드 끝에. 방금 올린 내 글은 글쓰기 칸 아래에 따로 있으니 빼고
|
||||
const feedTalks = useFeedTalks()
|
||||
const talks = feedTalks.talks.filter((t) => !mine.some((m) => m.talk_id === t.talk_id))
|
||||
const between = Math.max(0, Math.floor((posts.length - 1) / TALK_EVERY))
|
||||
const moreRef = useRef<HTMLDivElement>(null)
|
||||
const { more, loadMore } = feedTalks
|
||||
useEffect(() => {
|
||||
const el = moreRef.current
|
||||
if (!el || !more) return
|
||||
const io = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && loadMore(), { rootMargin: '600px' })
|
||||
io.observe(el)
|
||||
return () => io.disconnect()
|
||||
}, [more, loadMore])
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo({ top: 0 })
|
||||
@@ -409,15 +618,15 @@ export function TodayPage() {
|
||||
return (
|
||||
// 피드 칸은 전국 공통이라 지역이 바뀌어도 글 번호가 같다. 지역마다 새로 그려 넘긴 슬라이드·펼친 상태가 남지 않게 한다
|
||||
<section key={region.code} aria-label="오늘" aria-busy={load === 'loading'} className={cx('transition-opacity', feed.isPlaceholderData && 'opacity-60')}>
|
||||
<Hero hero={f?.hero} today={today.data} ranked={stories} all={f?.stories ?? []} feedLoad={load} todayLoad={loadOf(today)} />
|
||||
<Hero hero={f?.hero} post={f?.hero_post} today={today.data} ranked={stories} all={f?.stories ?? []} feedLoad={load} todayLoad={loadOf(today)} />
|
||||
<FeedComposer onPosted={(t) => setMine((m) => [t, ...m])} />
|
||||
{mine.map((t) => (
|
||||
<TalkCard key={t.talk_id} t={t} />
|
||||
<TalkCard key={t.talk_id} t={t} onGone={() => setMine((m) => m.filter((x) => x.talk_id !== t.talk_id))} />
|
||||
))}
|
||||
<MyGakRow />
|
||||
{/* 실패 안내는 여기 한 번만, 각 카드 스켈레톤과 같은 크기로 */}
|
||||
{stories.some((g) => g.active) ? (
|
||||
<GakCard items={stories} place={region.name.split(' ').at(-1)!} at={sloted ? `${PREVIEW[preview].label} 기준` : nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} />
|
||||
<GakCard items={stories} post={f?.gak_post} place={region.name.split(' ').at(-1)!} at={sloted ? `${PREVIEW[preview].label} 기준` : nowAt ? `${kst(nowAt).h}시 기준` : '오늘 기준'} />
|
||||
) : load === 'loading' ? (
|
||||
<PostCardSkel />
|
||||
) : (
|
||||
@@ -434,11 +643,13 @@ export function TodayPage() {
|
||||
<Fragment key={p.post_id}>
|
||||
<PostCard post={p} />
|
||||
{i === 1 && <FoliageCard />}
|
||||
{(i + 1) % 3 === 0 && talks[(i + 1) / 3 - 1] && <TalkCard t={talks[(i + 1) / 3 - 1]} />}
|
||||
{i > 0 && i % TALK_EVERY === 0 && talks[i / TALK_EVERY - 1] && <TalkCard t={talks[i / TALK_EVERY - 1]} />}
|
||||
{bandAt.find(([at]) => at === i + 1)?.[1]}
|
||||
</Fragment>
|
||||
))}
|
||||
{feed.isSuccess && bandAt.filter(([at]) => at > posts.length).map(([at, node]) => <Fragment key={at}>{node}</Fragment>)}
|
||||
{load !== 'loading' && talks.slice(between).map((t) => <TalkCard key={t.talk_id} t={t} />)}
|
||||
<div ref={moreRef} aria-hidden />
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
@@ -553,13 +553,13 @@ html.b-sheet-open .b-app :is(.b-fall, .b-bob, .b-blob, .b-skystars i, .b-shoot,
|
||||
}
|
||||
}
|
||||
|
||||
/* 위·아래 바는 반투명으로 하늘이 비치게 */
|
||||
/* 위 바는 반투명으로 하늘이 비치게, 아래 탭 바는 홈 바 자리까지 글이 비치지 않게 불투명 */
|
||||
.b-topbg {
|
||||
background: rgb(255 255 255 / 0.18);
|
||||
transition: background 1.4s ease;
|
||||
}
|
||||
.b-tabbar {
|
||||
background: rgb(255 255 255 / 0.6);
|
||||
background: #f7faff;
|
||||
overflow: visible;
|
||||
border-color: rgb(255 255 255 / 0.4);
|
||||
}
|
||||
@@ -567,7 +567,7 @@ html.b-sheet-open .b-app :is(.b-fall, .b-bob, .b-blob, .b-skystars i, .b-shoot,
|
||||
background: rgb(14 20 51 / 0.35);
|
||||
}
|
||||
.b-app[data-t='night'] .b-tabbar {
|
||||
background: rgb(18 24 60 / 0.62);
|
||||
background: #121838;
|
||||
border-color: rgb(255 255 255 / 0.08);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,54 +3,42 @@ import data from '../../seo/foliage_2026.json'
|
||||
import { cx } from '../lib/utils'
|
||||
import { kst } from './lib'
|
||||
import { PostFrame } from './Post'
|
||||
import { Ic } from './ui'
|
||||
|
||||
type Mountain = { name: string; region: string; lat: number; lon: number; peak: string }
|
||||
type Stage = 'peak' | 'soon' | 'before' | 'after'
|
||||
type Kind = 'maple' | 'ginkgo'
|
||||
type Spot = { name: string; kind: Kind; region: string; lat: number; lon: number; peak: string; basis: string }
|
||||
type Stage = 'before' | 'first' | 'peak'
|
||||
|
||||
// 지도 그림(public/foliage/korea-map.webp, 정사각형)의 위경도 → 그림 위 위치. generated-images/foliage-map/south_outline.json 과 같은 값
|
||||
const MAP = { lon0: 124.5, lat1: 38.75, k: 0.809017, s: 153.5327, ox: 40, oy: 62.92, size: 1024 }
|
||||
const PEAK_DAYS = 3 // 절정일 앞뒤 이만큼은 '지금 절정'
|
||||
const SOON_DAYS = 7
|
||||
// 발표에 시작일이 없어 절정 FIRST_DAYS 일 전부터 첫 단풍, PEAK_DAYS 일 전부터 절정으로 본다
|
||||
const FIRST_DAYS = 14
|
||||
const PEAK_DAYS = 3
|
||||
const SEASON = { from: '09-20', to: '11-25' }
|
||||
const SEOUL = { lat: 37.566, lon: 126.978 }
|
||||
|
||||
const STAGE: Record<Stage, { label: string; dot: string }> = {
|
||||
peak: { label: '지금 절정', dot: 'bg-[#ff5a36]' },
|
||||
soon: { label: '곧 절정', dot: 'bg-[#ffb02e]' },
|
||||
before: { label: '아직', dot: 'bg-[#7cc47a]' },
|
||||
after: { label: '절정 지남', dot: 'bg-[#b9a69a]' },
|
||||
const STAGE: Record<Stage, { label: string; icon: string }> = {
|
||||
before: { label: '단풍 전', icon: 'size-3 opacity-60 grayscale' },
|
||||
first: { label: '첫 단풍', icon: 'size-3.5' },
|
||||
peak: { label: '절정', icon: 'size-[18px]' },
|
||||
}
|
||||
const KIND: Record<Kind, { label: string; icon: string }> = {
|
||||
maple: { label: '단풍', icon: 'maple' },
|
||||
ginkgo: { label: '은행', icon: 'ginkgo' },
|
||||
}
|
||||
|
||||
const pos = (m: Mountain) => ({
|
||||
const pos = (m: Spot) => ({
|
||||
left: `${((MAP.ox + (m.lon - MAP.lon0) * MAP.k * MAP.s) / MAP.size) * 100}%`,
|
||||
top: `${((MAP.oy + (MAP.lat1 - m.lat) * MAP.s) / MAP.size) * 100}%`,
|
||||
})
|
||||
|
||||
// 점이 붙은 곳은 이름을 점 왼쪽·위·아래로 돌려 겹치지 않게. 없으면 오른쪽
|
||||
type Side = 'left' | 'right' | 'top' | 'bottom'
|
||||
const SIDE: Record<string, Side> = {
|
||||
광덕산: 'left',
|
||||
설악산: 'top',
|
||||
금원산: 'top',
|
||||
두륜산: 'left',
|
||||
'한라산(1100도로)': 'left',
|
||||
}
|
||||
const LABEL_AT: Record<Side, string> = {
|
||||
right: 'left-full top-1/2 -translate-y-1/2',
|
||||
left: 'right-full top-1/2 -translate-y-1/2',
|
||||
top: 'bottom-full left-1/2 -translate-x-1/2',
|
||||
bottom: 'top-full left-1/2 -translate-x-1/2',
|
||||
}
|
||||
const short = (name: string) => name.replace(/\(.*\)$/, '')
|
||||
|
||||
const DAY = 86_400_000
|
||||
const days = (from: string, to: string) => Math.round((Date.parse(to) - Date.parse(from)) / DAY)
|
||||
|
||||
function stage(m: Mountain, today: string): Stage {
|
||||
function stage(m: Spot, today: string): Stage {
|
||||
const d = days(today, m.peak)
|
||||
if (Math.abs(d) <= PEAK_DAYS) return 'peak'
|
||||
if (d < 0) return 'after'
|
||||
return d <= SOON_DAYS ? 'soon' : 'before'
|
||||
if (d <= PEAK_DAYS) return 'peak'
|
||||
return d <= FIRST_DAYS ? 'first' : 'before'
|
||||
}
|
||||
|
||||
const md = (iso: string) => `${Number(iso.slice(5, 7))}/${Number(iso.slice(8, 10))}`
|
||||
@@ -63,51 +51,57 @@ export function FoliageCard() {
|
||||
const [picked, setPicked] = useState<string | null>(null)
|
||||
const mmdd = today.slice(5)
|
||||
if (mmdd < SEASON.from || mmdd > SEASON.to) return null
|
||||
const mountains = (data.mountains as unknown as Mountain[]).map((m) => ({ ...m, stage: stage(m, today) }))
|
||||
const peakNow = mountains.filter((m) => m.stage === 'peak').map((m) => m.name)
|
||||
// 발표 지도에 서울 안 산은 없어 서울 시청에서 가장 가까운 산으로
|
||||
const seoul = mountains.reduce((a, b) => (Math.hypot(b.lat - SEOUL.lat, b.lon - SEOUL.lon) < Math.hypot(a.lat - SEOUL.lat, a.lon - SEOUL.lon) ? b : a))
|
||||
const sel = mountains.find((m) => m.name === picked)
|
||||
const spots = (data.spots as Spot[]).map((m) => ({ ...m, stage: stage(m, today) }))
|
||||
const peakNow = spots.filter((m) => m.stage === 'peak').map((m) => m.name)
|
||||
// 발표 지도에 서울 안 산은 없어 서울 시청에서 가장 가까운 단풍 예측 산으로
|
||||
const forecast = spots.filter((m) => m.kind === 'maple' && m.basis.startsWith('산림청'))
|
||||
const seoul = forecast.reduce((a, b) => (Math.hypot(b.lat - SEOUL.lat, b.lon - SEOUL.lon) < Math.hypot(a.lat - SEOUL.lat, a.lon - SEOUL.lon) ? b : a))
|
||||
const sel = spots.find((m) => m.name === picked)
|
||||
return (
|
||||
<PostFrame title="단풍 지도" account="단풍 지도" avatar="maple" caption={peakNow.length ? `지금 절정: ${peakNow.join(' · ')}` : undefined}>
|
||||
<div className="relative bg-[#e6f2ff] px-4 pt-4 pb-3">
|
||||
<PostFrame title="단풍 지도" account="단풍 지도" avatar="maple" caption={peakNow.length ? `지금 절정 ${peakNow.length}곳: ${peakNow.slice(0, 5).join(' · ')}${peakNow.length > 5 ? ' 외' : ''}` : undefined}>
|
||||
<div className="relative bg-[#fff6ea] px-4 pt-4 pb-3">
|
||||
<p className="m-0 text-[13px] font-extrabold opacity-75">단풍 지도 · {md(today)}</p>
|
||||
<p className="m-0 mt-1 font-jua text-[24px] leading-tight">서울 근교 {seoul.name} 절정 예상 {md(seoul.peak)}</p>
|
||||
<div className="relative mx-auto mt-1 aspect-square w-full">
|
||||
<img src="/foliage/korea-map.webp" alt="한반도 지도" className="absolute inset-0 size-full" />
|
||||
{mountains.map((m) => (
|
||||
<img src="/foliage/korea-map.webp" alt="단풍 지도" className="absolute inset-0 size-full" />
|
||||
{spots.map((m) => (
|
||||
<button
|
||||
key={m.name}
|
||||
type="button"
|
||||
onClick={() => setPicked(m.name === picked ? null : m.name)}
|
||||
aria-label={`${m.name} ${STAGE[m.stage].label}, 절정 예상 ${md(m.peak)}`}
|
||||
className="absolute -translate-x-1/2 -translate-y-1/2 cursor-pointer p-1"
|
||||
aria-label={`${m.name} ${KIND[m.kind].label} ${STAGE[m.stage].label}, 절정 예상 ${md(m.peak)}`}
|
||||
className={cx('absolute grid -translate-x-1/2 -translate-y-1/2 cursor-pointer place-items-center p-0.5', m.name === picked && 'z-[2] scale-150')}
|
||||
style={pos(m)}
|
||||
>
|
||||
<i className={cx('block size-3 rounded-full border-2 border-white shadow-[0_1px_4px_rgb(40_48_74/0.35)]', STAGE[m.stage].dot, m.name === picked && 'size-4.5')} />
|
||||
<span className={cx('absolute py-1 text-[10.5px] leading-none font-extrabold whitespace-nowrap text-(--ink2) [text-shadow:0_0_3px_#fff,0_0_3px_#fff]', LABEL_AT[SIDE[m.name] ?? 'right'])}>
|
||||
{short(m.name)}
|
||||
</span>
|
||||
<Ic name={KIND[m.kind].icon} className={cx('drop-shadow-[0_0_1.5px_#fff] drop-shadow-[0_1px_1px_rgb(40_48_74/0.4)]', STAGE[m.stage].icon)} />
|
||||
</button>
|
||||
))}
|
||||
{sel && (
|
||||
<p className="absolute right-0 bottom-0 m-0 rounded-[14px] bg-white/90 px-3 py-2 text-[13px] font-bold shadow-[0_4px_12px_rgb(40_48_74/0.15)]">
|
||||
<p className="absolute right-0 bottom-0 z-[3] m-0 max-w-[75%] rounded-[14px] bg-white/95 px-3 py-2 text-[13px] font-bold shadow-[0_4px_12px_rgb(40_48_74/0.15)]">
|
||||
<b className="font-jua text-[16px] font-normal">{sel.name}</b> {sel.region}
|
||||
<br />
|
||||
{STAGE[sel.stage].label} · 절정 예상 {md(sel.peak)}
|
||||
{KIND[sel.kind].label} {STAGE[sel.stage].label} · 절정 예상 {md(sel.peak)}
|
||||
{!sel.basis.startsWith('산림청') && <small className="block text-[11px] font-semibold text-(--ink3)">가까운 예측 지점 날짜예요</small>}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-2 flex flex-wrap justify-center gap-x-3 gap-y-1 text-[12.5px] font-bold">
|
||||
{(Object.keys(STAGE) as Stage[]).map((s) => (
|
||||
<span key={s} className="flex items-center gap-1">
|
||||
<i className={cx('size-2.5 rounded-full', STAGE[s].dot)} />
|
||||
{STAGE[s].label}
|
||||
<div className="mt-2 flex flex-wrap items-center justify-center gap-x-3 gap-y-1 text-[12.5px] font-bold">
|
||||
{(Object.keys(KIND) as Kind[]).map((k) => (
|
||||
<span key={k} className="flex items-center gap-1">
|
||||
<Ic name={KIND[k].icon} className="size-4" />
|
||||
{KIND[k].label}
|
||||
</span>
|
||||
))}
|
||||
<span className="opacity-30" aria-hidden="true">|</span>
|
||||
{(Object.keys(STAGE) as Stage[]).map((st) => (
|
||||
<span key={st} className="flex items-center gap-1">
|
||||
<Ic name="maple" className={cx('size-4', STAGE[st].icon)} />
|
||||
{STAGE[st].label}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<p className="m-0 mt-1.5 text-center text-[11px] font-semibold text-(--ink3)">
|
||||
출처: 산림청 2026 단풍절정 예측 · 단풍나무 잎 절반이 물든 때 기준
|
||||
출처: 산림청 2026 단풍절정 예측 · 잎 절반이 물든 때를 절정으로, 그 2주 전부터 첫 단풍으로 봐요
|
||||
</p>
|
||||
</div>
|
||||
</PostFrame>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CSSProperties } from 'react'
|
||||
|
||||
const SHARED = new Set(['bear', 'bike', 'bronze', 'camping', 'carwash', 'chimaek', 'cloud', 'coldwind', 'delivery', 'dog', 'garden', 'glasses', 'gold', 'hiking', 'iced_hot', 'jjamppong', 'laundry', 'letter', 'makeup', 'makgeolli', 'maple', 'moon', 'muggy', 'naengmyeon', 'photo', 'picnic', 'rabbit', 'rain', 'running', 'silver', 'snow', 'stars', 'sun_cloud', 'sun', 'sunset', 'taxi', 'umbrella', 'vent', 'walk', 'yajang', 'baseball', 'study', 'netflix', 'chestnut', 'peanut', 'tangerine', 'sweet_potato', 'fallen_leaf', 'kimchi', 'apple', 'mask', 'golf', 'jipkok', 'fishing', 'drive', 'kite', 'waterplay', 'riverwind', 'trot', 'pajeon', 'bingsu', 'blanket', 'indoordry', 'flower', 'bungeoppang', 'singing_rain', 'hangang', 'themepark', 'date', 'frizz', 'boiler', 'sunscreen', 'mosquito', 'tennis', 'hyodo', 'thanks', 'gift', 'party', 'game', 'selfie', 'sentimental'])
|
||||
const SHARED = new Set(['bear', 'bike', 'bronze', 'camping', 'carwash', 'chimaek', 'cloud', 'coldwind', 'delivery', 'dog', 'garden', 'glasses', 'gold', 'hiking', 'iced_hot', 'jjamppong', 'laundry', 'letter', 'makeup', 'makgeolli', 'maple', 'moon', 'muggy', 'naengmyeon', 'photo', 'picnic', 'rabbit', 'rain', 'running', 'silver', 'snow', 'stars', 'sun_cloud', 'sun', 'sunset', 'taxi', 'umbrella', 'vent', 'walk', 'yajang', 'baseball', 'study', 'netflix', 'chestnut', 'peanut', 'tangerine', 'sweet_potato', 'fallen_leaf', 'kimchi', 'apple', 'mask', 'golf', 'jipkok', 'fishing', 'drive', 'kite', 'waterplay', 'riverwind', 'trot', 'pajeon', 'bingsu', 'blanket', 'indoordry', 'flower', 'bungeoppang', 'singing_rain', 'hangang', 'themepark', 'date', 'frizz', 'boiler', 'sunscreen', 'mosquito', 'tennis', 'hyodo', 'thanks', 'gift', 'party', 'game', 'selfie', 'sentimental', 'ginkgo'])
|
||||
const OWN = new Set(['fireworks', 'bulb', 'calendar', 'thermo', 'sheaf', 'popup', 'exhibition', 'concert'])
|
||||
|
||||
/** 아이콘 이름 → 파일 경로 (공용 public/icons, B 전용 public/b/icons). 'none'(데이터 없는 칸)은 그림 없음 */
|
||||
|
||||
+47
-10
@@ -1,10 +1,10 @@
|
||||
import { useState, type ReactNode } from 'react'
|
||||
import type { MyGakRule, MyGakScore } from '../api/client/types.gen'
|
||||
import type { MyGakPreset, MyGakRule, MyGakScore } from '../api/client/types.gen'
|
||||
import { cx } from '../lib/utils'
|
||||
import { gakName, shareUrl, SLOTS, type MyGak, type Slot, useMyGak, useMyGakScores } from './myGakState'
|
||||
import { gakName, shareUrl, SLOTS, type MyGak, type Slot, useMyGak, useMyGakScores, usePresets } from './myGakState'
|
||||
import { useRegion } from './regionContext'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { Rail, Sec } from './ui'
|
||||
import { Ic, Rail, Sec } from './ui'
|
||||
|
||||
const SLOT_WORD = Object.fromEntries(SLOTS) as Record<Slot, string>
|
||||
|
||||
@@ -122,15 +122,49 @@ type Filled<T> = { [K in keyof T]-?: NonNullable<T[K]> }
|
||||
const DEFAULT_RULE: Filled<MyGakRule> = { temp: [15, 25], rain: 'dry', wind_max: 4, air: 'normal', humidity: [30, 60], slots: ['morning', 'day', 'evening', 'night'] }
|
||||
type Cond = 'temp' | 'rain' | 'wind_max' | 'air' | 'humidity'
|
||||
|
||||
const condsOf = (r: MyGakRule): Record<Cond, boolean> => ({ temp: !!r.temp, rain: !!r.rain, wind_max: r.wind_max != null, air: !!r.air, humidity: !!r.humidity })
|
||||
|
||||
/** 있는 각을 골라 그 각 조건으로 채운다 */
|
||||
function PresetPicker({ picked, onPick }: { picked: string | null; onPick: (p: MyGakPreset) => void }) {
|
||||
const items = usePresets().data ?? []
|
||||
if (!items.length) return null
|
||||
return (
|
||||
<div className="mb-3">
|
||||
<span className="font-jua text-[19px]">있는 각에서 불러오기</span>
|
||||
<div className="-mx-4">
|
||||
<Rail label="있는 각에서 불러오기">
|
||||
{items.map((p) => (
|
||||
<button
|
||||
key={p.code}
|
||||
type="button"
|
||||
aria-pressed={picked === p.code}
|
||||
onClick={() => onPick(p)}
|
||||
className={cx('flex w-[68px] cursor-pointer flex-col items-center gap-1 rounded-2xl px-1 py-2 text-[12px] leading-tight font-extrabold', picked === p.code ? 'bg-(--orange) text-white' : 'bg-[#f3f6fb] text-(--ink2)')}
|
||||
>
|
||||
<Ic name={p.icon} className="size-9" />
|
||||
<span className="w-full truncate">{p.name}</span>
|
||||
</button>
|
||||
))}
|
||||
</Rail>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** 내 각 만들기(이름과 조건)와 미리보기. shared 면 받은 각을 내 동네 점수로 보여 주고 가져오기만 */
|
||||
export function MixSheet({ shared, onDone }: { shared?: MyGak; onDone: () => void }) {
|
||||
const { region } = useRegion()
|
||||
const { create, pending, failed } = useMyGak()
|
||||
const [name, setName] = useState(shared?.name ?? '')
|
||||
const [vals, setVals] = useState({ ...DEFAULT_RULE, ...(shared?.rule ?? {}) } as typeof DEFAULT_RULE)
|
||||
const [on, setOn] = useState<Record<Cond, boolean>>(
|
||||
shared ? { temp: !!shared.rule.temp, rain: !!shared.rule.rain, wind_max: shared.rule.wind_max != null, air: !!shared.rule.air, humidity: !!shared.rule.humidity } : { temp: true, rain: true, wind_max: false, air: false, humidity: false },
|
||||
)
|
||||
const [on, setOn] = useState<Record<Cond, boolean>>(shared ? condsOf(shared.rule) : { temp: true, rain: true, wind_max: false, air: false, humidity: false })
|
||||
const [picked, setPicked] = useState<string | null>(null)
|
||||
const pick = (p: MyGakPreset) => {
|
||||
setPicked(p.code)
|
||||
setName(p.name)
|
||||
setVals({ ...DEFAULT_RULE, ...p.rule } as typeof DEFAULT_RULE)
|
||||
setOn(condsOf(p.rule))
|
||||
}
|
||||
const set = <K extends keyof typeof vals>(k: K, v: (typeof vals)[K]) => setVals((x) => ({ ...x, [k]: v }))
|
||||
const toggle = (k: Cond) => setOn((x) => ({ ...x, [k]: !x[k] }))
|
||||
const rule: MyGakRule = { slots: vals.slots, ...(Object.fromEntries((Object.keys(on) as Cond[]).filter((k) => on[k]).map((k) => [k, vals[k]])) as Partial<MyGakRule>) }
|
||||
@@ -144,10 +178,13 @@ export function MixSheet({ shared, onDone }: { shared?: MyGak; onDone: () => voi
|
||||
{shared ? (
|
||||
<p className="m-0 text-[13px] font-bold text-(--ink2)">친구가 보낸 각이에요. {region.name} 기준 점수예요</p>
|
||||
) : (
|
||||
<label className="block">
|
||||
<span className="font-jua text-[19px]">이름</span>
|
||||
<input value={name} onChange={(e) => setName(e.target.value)} maxLength={11} placeholder="소맥, 야독, 새우깡" className="mt-1.5 w-full rounded-2xl bg-[#f3f6fb] px-3.5 py-2.5 text-[15px]" />
|
||||
</label>
|
||||
<>
|
||||
<PresetPicker picked={picked} onPick={pick} />
|
||||
<label className="block">
|
||||
<span className="font-jua text-[19px]">이름</span>
|
||||
<input value={name} onChange={(e) => setName(e.target.value)} maxLength={11} placeholder="소맥, 야독, 새우깡" className="mt-1.5 w-full rounded-2xl bg-[#f3f6fb] px-3.5 py-2.5 text-[15px]" />
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
<fieldset disabled={!!shared} className="m-0 mt-3 border-0 p-0">
|
||||
<legend className="font-jua text-[19px]">조건</legend>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useEffect, useSyncExternalStore } from 'react'
|
||||
import { SITE_URL } from '../api/setup'
|
||||
import { addMyGakMutation, deleteMyGakMutation, listMyGakOptions, listMyGakQueryKey } from '../api/client/@tanstack/react-query.gen'
|
||||
import { addMyGakMutation, deleteMyGakMutation, listMyGakOptions, listMyGakQueryKey, listPresetsOptions } from '../api/client/@tanstack/react-query.gen'
|
||||
import { scoreMyGak } from '../api/client/sdk.gen'
|
||||
import type { MyGakRule, MyGakScore } from '../api/client/types.gen'
|
||||
import { useAuth } from './authContext'
|
||||
@@ -89,6 +89,11 @@ export function useMyGakScores(rules: MyGakRule[]) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 공식 각을 내 각 조건으로 옮긴 목록 (내 각 만들기에서 골라 채우기) */
|
||||
export function usePresets() {
|
||||
return useQuery({ ...listPresetsOptions(), staleTime: Infinity, select: (d) => d.items ?? [] })
|
||||
}
|
||||
|
||||
export function useMyGak() {
|
||||
const { loggedIn } = useAuth()
|
||||
const { open } = useSheet()
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import { useState } from 'react'
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { likePostMutation, unlikePostMutation } from '../api/client/@tanstack/react-query.gen'
|
||||
import type { PostReaction, ResFeed } from '../api/client/types.gen'
|
||||
|
||||
export type PinnedKey = 'hero_post' | 'gak_post'
|
||||
|
||||
/** 히어로·오늘의 각처럼 포스트 틀이 아닌 카드의 좋아요. 화면을 먼저 바꾸고 실패하면 되돌린다 */
|
||||
export function usePinnedLike(key: PinnedKey, r?: PostReaction | null) {
|
||||
const queryClient = useQueryClient()
|
||||
const like = useMutation(likePostMutation())
|
||||
const unlike = useMutation(unlikePostMutation())
|
||||
const [failed, setFailed] = useState(false)
|
||||
const liked = !!r?.liked
|
||||
const count = r?.like_count ?? 0
|
||||
const patch = (values: Partial<PostReaction>) =>
|
||||
queryClient.setQueriesData<ResFeed>({ predicate: (q) => (q.queryKey[0] as { _id?: string } | undefined)?._id === 'getFeed' }, (feed) =>
|
||||
feed?.[key] && feed[key].post_id === r?.post_id ? { ...feed, [key]: { ...feed[key], ...values } } : feed,
|
||||
)
|
||||
const toggle = () => {
|
||||
if (!r || like.isPending || unlike.isPending) return
|
||||
const on = !liked
|
||||
setFailed(false)
|
||||
patch({ liked: on, like_count: count + (on ? 1 : -1) })
|
||||
const revert = () => {
|
||||
patch({ liked, like_count: count })
|
||||
setFailed(true)
|
||||
}
|
||||
;(on ? like : unlike).mutate(
|
||||
{ path: { post_id: r.post_id } },
|
||||
{
|
||||
onSuccess: (res) => (res.result?.success ? patch({ liked: res.liked ?? on, ...(res.like_count != null ? { like_count: res.like_count } : {}) }) : revert()),
|
||||
onError: revert,
|
||||
},
|
||||
)
|
||||
}
|
||||
return { liked, count, failed, toggle }
|
||||
}
|
||||
+28
-5
@@ -15,6 +15,7 @@ import { cx } from '../lib/utils'
|
||||
import { useAuth } from './authContext'
|
||||
import { ago, kst } from './lib'
|
||||
import { useRegion } from './regionContext'
|
||||
import { useMyTalks } from './talkState'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { HeartIcon } from './svg'
|
||||
import { Avatar, TAP44 } from './ui'
|
||||
@@ -44,7 +45,7 @@ function slotWord(iso: string) {
|
||||
|
||||
function useRefreshTalks() {
|
||||
const queryClient = useQueryClient()
|
||||
return () => queryClient.invalidateQueries({ queryKey: [{ _id: 'listTalks' }] })
|
||||
return () => queryClient.invalidateQueries({ predicate: (q) => ['listTalks', 'listMyTalks'].includes((q.queryKey[0] as { _id?: string } | undefined)?._id ?? '') })
|
||||
}
|
||||
|
||||
function Composer({ onDone }: { onDone?: (t: TalkData) => void }) {
|
||||
@@ -158,7 +159,8 @@ function Composer({ onDone }: { onDone?: (t: TalkData) => void }) {
|
||||
)
|
||||
}
|
||||
|
||||
function TalkRow({ t }: { t: TalkData }) {
|
||||
/** onGone: 내 글을 지웠을 때. 목록을 다시 받아도 빠지지 않는 곳(방금 쓴 글)에서 직접 뺀다 */
|
||||
function TalkRow({ t, onGone }: { t: TalkData; onGone?: () => void }) {
|
||||
const { loggedIn } = useAuth()
|
||||
const { open } = useSheet()
|
||||
const refresh = useRefreshTalks()
|
||||
@@ -225,7 +227,7 @@ function TalkRow({ t }: { t: TalkData }) {
|
||||
{menu === 'done' ? (
|
||||
<span className="text-[#1f9d62]">처리했어요</span>
|
||||
) : t.mine ? (
|
||||
<button type="button" onClick={() => remove.mutate({ path: { talk_id: t.talk_id } }, after)} disabled={remove.isPending} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
<button type="button" onClick={() => remove.mutate({ path: { talk_id: t.talk_id } }, { ...after, onSuccess: (res) => (after.onSuccess(res), res.result?.success && onGone?.()) })} disabled={remove.isPending} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
지우기
|
||||
</button>
|
||||
) : menu === 'report' ? (
|
||||
@@ -270,10 +272,31 @@ export function FeedComposer({ onPosted }: { onPosted: (t: TalkData) => void })
|
||||
}
|
||||
|
||||
/** 피드에 끼우는 글 한 장 */
|
||||
export function TalkCard({ t }: { t: TalkData }) {
|
||||
export function TalkCard({ t, onGone }: { t: TalkData; onGone?: () => void }) {
|
||||
return (
|
||||
<article className="mt-3.5 border-y border-(--line) bg-white px-3" aria-label={`${t.nickname}의 글`}>
|
||||
<TalkRow key={`${t.talk_id}:${t.liked}:${t.like_count}`} t={t} />
|
||||
<TalkRow key={`${t.talk_id}:${t.liked}:${t.like_count}`} t={t} onGone={onGone} />
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
||||
/** 내 정보 창의 내가 쓴 글 */
|
||||
export function MyTalks() {
|
||||
const { talks, loaded, more, loadMore } = useMyTalks()
|
||||
if (!loaded) return null
|
||||
return (
|
||||
<section aria-label="내 글">
|
||||
<h4 className="m-0 mb-1 text-sm font-extrabold">내 글</h4>
|
||||
{talks.length ? (
|
||||
talks.map((t) => <TalkRow key={`${t.talk_id}:${t.liked}:${t.like_count}`} t={t} />)
|
||||
) : (
|
||||
<p className="m-0 text-[13px] font-semibold text-(--ink3)">아직 쓴 글이 없어요</p>
|
||||
)}
|
||||
{more && (
|
||||
<button type="button" onClick={() => loadMore()} className="mt-1 w-full cursor-pointer rounded-[14px] bg-[#f3f6fb] py-2.5 text-[13.5px] font-extrabold text-(--ink2)">
|
||||
더 보기
|
||||
</button>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -1,12 +1,33 @@
|
||||
import { useInfiniteQuery } from '@tanstack/react-query'
|
||||
import { listTalksInfiniteOptions } from '../api/client/@tanstack/react-query.gen'
|
||||
import { listMyTalksInfiniteOptions, listTalksInfiniteOptions } from '../api/client/@tanstack/react-query.gen'
|
||||
import { useRegion } from './regionContext'
|
||||
|
||||
/** 사람들이 쓴 글. 오늘 피드에 운영 포스트 사이사이 섞는다 */
|
||||
/** 사람들이 쓴 글. 오늘 피드에 운영 포스트 사이사이 섞고, 남은 글은 피드 끝에 이어 붙인다 */
|
||||
export function useFeedTalks() {
|
||||
const { region } = useRegion()
|
||||
const list = useInfiniteQuery({
|
||||
...listTalksInfiniteOptions(),
|
||||
...listTalksInfiniteOptions({ query: { region: region.code } }),
|
||||
initialPageParam: {},
|
||||
getNextPageParam: (last) => last.next_cursor ?? undefined,
|
||||
})
|
||||
return list.data?.pages.flatMap((p) => p.talks ?? []) ?? []
|
||||
return {
|
||||
talks: list.data?.pages.flatMap((p) => p.talks ?? []) ?? [],
|
||||
more: list.hasNextPage && !list.isFetchingNextPage,
|
||||
loadMore: list.fetchNextPage,
|
||||
}
|
||||
}
|
||||
|
||||
/** 내가 쓴 글 (최신순) */
|
||||
export function useMyTalks() {
|
||||
const list = useInfiniteQuery({
|
||||
...listMyTalksInfiniteOptions(),
|
||||
initialPageParam: {},
|
||||
getNextPageParam: (last) => last.next_cursor ?? undefined,
|
||||
})
|
||||
return {
|
||||
talks: list.data?.pages.flatMap((p) => p.talks ?? []) ?? [],
|
||||
loaded: list.isSuccess,
|
||||
more: list.hasNextPage && !list.isFetchingNextPage,
|
||||
loadMore: list.fetchNextPage,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user