Merge branch 'feat/top-button' — 오른쪽 아래 문의·맨 위로 버튼과 문의 창

This commit is contained in:
skkim committed 2026-11-11 10:56:03 +09:00
commit eaa62751cd
9 files changed
+88 -3

No files matched your search

+3 -1
View File
@@ -37,7 +37,7 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화
| `설치_완료` (코드 `install_done`) | 설치 완료 (브라우저가 `appinstalled`를 줄 때만. 아이폰은 오지 않음) | 없음 | `install.ts` |
| `앱_실행` (코드 `app_launch`) | 홈 화면 아이콘(설치한 앱)으로 엶 | `mode: 'standalone'` | `main.tsx` |
| `첫화면_멈춤` (코드 `boot_stuck`) | 8초 넘게 '날씨 불러오는 중' 첫 화면이 남음 (페이지마다 한 번) | `reason`(첫 오류 문구, 100자), `seconds`, `tries`(연달아 다시 불러온 횟수), `app_started`(앱 파일 실행 여부) | `index.html` 첫 화면 스크립트 |
| `창_열기` (코드 `sheet_open`) | 아래에서 올라오는 창이 열림 (각·글·보내기·댓글·로그인·내 정보·지역·내 각·홈 화면 추가·점수 근거·이야기 등) | `sheet`(창 종류: `gak`·`article`·`share`·`comments`·`login`·`me`·`region`·`mix`·`myGak`·`install`·`weatherWhy`·`talk`·`seasonWeek`) | `Sheets.tsx` `SheetProvider` `open` |
| `창_열기` (코드 `sheet_open`) | 아래에서 올라오는 창이 열림 (각·글·보내기·댓글·로그인·내 정보·지역·내 각·홈 화면 추가·점수 근거·이야기 등) | `sheet`(창 종류: `gak`·`article`·`share`·`comments`·`login`·`me`·`region`·`mix`·`myGak`·`install`·`weatherWhy`·`talk`·`seasonWeek`·`contact`) | `Sheets.tsx` `SheetProvider` `open` |
| `좋아요` (코드 `like`) | 좋아요 성공 (취소는 안 보냄) | `content_type: 'post' \| 'comment' \| 'talk' \| 'hero_post' \| 'gak_post' \| 'foliage_post' \| 'events_post' \| 'season_post'`, `item_id`(포스트·댓글·글 번호) | `Post.tsx` `FullCard`, `pinnedLike.ts`, `Sheets.tsx` `CommentRow`, `talk.tsx` |
| `댓글` (코드 `comment`) | 댓글 올리기 성공 | `post_id` | `Sheets.tsx` `CommentsSheet` `send` |
| `이야기_댓글` (코드 `talk_comment`) | 사람 글에 댓글 올리기 성공 (로그인한 사람만) | `talk_id`(글 번호) | `Sheets.tsx` `CommentsSheet` `send` |
@@ -57,6 +57,8 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화
| `내각_저장` (코드 `my_gak_save`) | 내 각 만들기 성공 (로그인 전엔 기기에 저장) | `gak_name` | `myGakState.ts` `create` |
| `토스소개_시작` (코드 `toss_intro_start`) | 토스판 첫 소개 화면에서 '시작하기' | 없음 | `tossIntro.tsx` |
| `설치배너_닫기` (코드 `install_banner_close`) | '홈 화면에 추가' 띠를 × 로 닫음 | 없음 | `installBanner.tsx` |
| `맨위로_누름` (코드 `top_button`) | 오른쪽 아래 둥근 버튼(내려갔을 때 '맨 위로')을 눌러 맨 위로 올라감 | `page`(누른 화면: `today`·`sky`·`gak`·`week`·`season`·`talk` 등) | `BLayout.tsx` `FloatButton` |
| `문의_누름` (코드 `contact_click`) | 문의 창에서 전화·이메일을 누름 (창 열림은 `창_열기`의 `sheet: 'contact'`) | `method: 'phone' \| 'email'` | `Sheets.tsx` `ContactSheet` |
| `타로_뽑기` (코드 `fortune_draw`) | 오늘 한 장에서 카드를 뽑음 (하루 한 번, 다시 열 때는 안 보냄) | `card`(각 코드) | `fortune.tsx` `useTodayCard` |
| `하루_기록` (코드 `day_log`) | 저녁 체크인을 적어 둠 (고쳐 적어도 보냄). 다녀온 곳 이름은 보내지 않음 | `mood`(1~5), `went_out`, `card_hit`(맞았어요 true·글쎄요 false·안 고름 null) | `fortune.tsx` `useTodayCard` |
| `오늘아이콘_누름` (코드 `today_icon`) | 오늘 탭 아이콘 줄에서 아이콘을 누름 | `icon`(`tarot`·`saju`·`game`·`foliage`·`shorts`·`myGak`·`talk`) | `todayIcons.tsx` `TodayIcons` |
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

+33
View File
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react
import { NavLink, Outlet, useLocation, useNavigationType } from 'react-router'
import { useIsFetching, useQuery, useQueryClient } from '@tanstack/react-query'
import { authConfigOptions, getSeasonWeekOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen'
import { track } from '../lib/analytics'
import { cx } from '../lib/utils'
import { kindOfHour, kst, seasonOf, type TimeKind } from '@nalssigak/shared/lib'
import './b.css'
@@ -89,6 +90,37 @@ function TopBar() {
)
}
// 이만큼 내려가면 문의 버튼이 맨 위로 버튼으로 바뀐다
const TOP_AFTER = 400
/** 오른쪽 아래 둥근 버튼: 맨 위에서는 문의(문의 창 열기), 내려가면 맨 위로 */
function FloatButton() {
const { pathname } = useLocation()
const { open } = useSheet()
const [down, setDown] = useState(() => window.scrollY > TOP_AFTER)
useEffect(() => {
const check = () => setDown(window.scrollY > TOP_AFTER)
window.addEventListener('scroll', check, { passive: true })
return () => window.removeEventListener('scroll', check)
}, [])
// 쇼츠는 화면 전체가 영상이라 가리지 않게 뺀다
if (pathname.startsWith('/shorts')) return null
const toTop = () => {
track('top_button', { page: TABS.find((t) => t.to !== '/' && pathname.startsWith(t.to))?.key ?? pathname.split('/')[1] ?? 'today' })
window.scrollTo({ top: 0, behavior: 'smooth' })
}
return (
<button
type="button"
onClick={down ? toTop : () => open({ type: 'contact' })}
aria-label={down ? '맨 위로' : '문의하기'}
className="fixed right-[max(12px,calc((100%-440px)/2+12px))] bottom-[calc(80px+env(safe-area-inset-bottom,0px))] z-20 size-14 cursor-pointer rounded-full drop-shadow-[0_6px_10px_rgb(40_48_74/0.22)]"
>
<Ic name={down ? 'top' : 'contact'} className="size-full" />
</button>
)
}
const STARS = Array.from({ length: 46 }, (_, i) => ({
left: `${(i * 41 + 7) % 100}%`,
top: `${(i * 67 + 3) % 96}%`,
@@ -279,6 +311,7 @@ function Shell() {
<main className="relative z-[1]">
<Outlet />
</main>
<FloatButton />
<nav aria-label="주요 메뉴" className="b-tabbar fixed inset-x-0 bottom-0 z-30 grid grid-cols-5 border-t px-[max(4px,calc((100%-432px)/2))] pt-[7px] pb-[calc(8px+env(safe-area-inset-bottom,0px))] backdrop-blur-[10px]">
{TABS.map((t) =>
t.key === 'today' ? (
+46 -1
View File
@@ -92,7 +92,7 @@ export function SheetProvider({ children }: { children: ReactNode }) {
)
}
const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', share: '보내기', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', install: '홈 화면에 추가', weatherWhy: '날씨 점수는 이렇게 나와요', talk: '이야기', tarot: '오늘 타로', level: '내 레벨', levelUp: '레벨이 올랐어요', gameHelp: '구름 합치기 하는 법' } as const
const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', share: '보내기', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', install: '홈 화면에 추가', weatherWhy: '날씨 점수는 이렇게 나와요', talk: '이야기', tarot: '오늘 타로', level: '내 레벨', levelUp: '레벨이 올랐어요', gameHelp: '구름 합치기 하는 법', contact: '날씨각 문의' } as const
/** 아래에서 올라오는 창: 네이티브 <dialog>라 ESC·포커스 가두기·포커스 되돌리기가 기본으로 된다 */
function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void }) {
@@ -183,6 +183,7 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void
{shown.type === 'level' && <LevelSheet />}
{shown.type === 'levelUp' && <LevelUpSheet level={shown.level} />}
{shown.type === 'gameHelp' && <GameHelpSheet />}
{shown.type === 'contact' && <ContactSheet onDone={onClose} />}
</div>
)}
</dialog>
@@ -554,6 +555,50 @@ function GameHelpSheet() {
)
}
const CONTACTS = [
{ method: 'phone', label: '전화 문의', value: '010-2755-6463', href: 'tel:010-2755-6463', icon: 'M6.6 3h3l1.5 4.2-2 1.5a12 12 0 0 0 6.2 6.2l1.5-2L21 14.4v3A2.6 2.6 0 0 1 18.4 20 15.4 15.4 0 0 1 4 5.6 2.6 2.6 0 0 1 6.6 3Z' },
{ method: 'email', label: '이메일 문의', value: 'sales@o2o.kr', href: 'mailto:sales@o2o.kr', icon: 'M3.5 6.5h17v11h-17zM4 7l8 6.5L20 7' },
] as const
/** 오른쪽 아래 문의 버튼으로 여는 창: 운영사 소개와 전화·이메일 */
function ContactSheet({ onDone }: { onDone: () => void }) {
return (
<Body className="flex flex-col items-center text-center">
<img src="/b/aio2o.png" alt="AIO2O" width={162} height={27} className="mt-1 block h-[27px] w-auto" />
<h4 className="mt-3 mb-0 font-jua text-[22px] font-normal">무엇을 도와드릴까요?</h4>
<p className="mt-1.5 mb-0 text-[13.5px] leading-[1.6] font-semibold text-(--ink2)">
날씨각은 에이아이오투오가 만듭니다.
<br />
AI로 생활에 유용한 정보를 연결하고,
<br />
산업 현장의 문제를 해결합니다.
</p>
<div className="mt-4 flex w-full flex-col gap-2">
{CONTACTS.map((c) => (
<a key={c.method} href={c.href} onClick={() => track('contact_click', { method: c.method })} className="flex items-center gap-3 rounded-[16px] bg-[#f3f6fb] p-3 text-left text-(--ink)">
<span className="b-keep-bg grid size-11 shrink-0 place-items-center rounded-full bg-white text-(--orange)">
<svg viewBox="0 0 24 24" className="size-[22px]" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<path d={c.icon} />
</svg>
</span>
<span className="flex min-w-0 flex-1 flex-col">
<span className="text-[12px] font-bold text-(--ink2)">{c.label}</span>
<span className="truncate text-[17px] font-extrabold">{c.value}</span>
</span>
<span className="text-xl text-(--orange)" aria-hidden="true">
›
</span>
</a>
))}
</div>
<p className="mt-3.5 mb-0 text-[12px] font-semibold text-(--ink3)">주식회사 에이아이오투오 · AIO2O</p>
<button type="button" onClick={onDone} className="mt-3 w-full cursor-pointer rounded-[14px] bg-(--orange) p-3 text-[15px] font-extrabold text-white">
확인
</button>
</Body>
)
}
function SeasonWeekSheet() {
const { open } = useSheet()
const q = useQuery(getSeasonWeekOptions())
+1 -1
View File
@@ -1,7 +1,7 @@
import type { CSSProperties } from 'react'
import { ARTICLE_LABEL } from '@nalssigak/shared/lib'
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 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', 'top', 'contact'])
const OWN = new Set(['fireworks', 'bulb', 'calendar', 'thermo', 'sheaf', 'popup', 'exhibition', 'concert', 'crystal_ball', 'yin_yang', 'tshirt', 'clapper', 'speech', 'droplet', 'leaf', 'rainbow', 'milky_way', 'shooting_star', 'alarm_clock', 'check_mark_button', 'sparkles', 'warning', 'locked', 'money_bag', 'red_heart', 'briefcase', 'spiral_calendar', 'two_hearts', 'sunrise', 'candy', 'lollipop', 'spider', 'spider_web', 'bat', 'ghost', 'skull', 'jack_o_lantern', 'pepero_choco', 'pepero_almond', 'pepero_strawberry', 'pepero_nude', 'pepero_pair', 'pepero_bundle', 'pepero_box', 'pepero_basket', 'xmas_candy_cane', 'xmas_ornament', 'xmas_gingerbread', 'xmas_santa_hat', 'xmas_stocking', 'xmas_wreath', 'xmas_santa', 'christmas_tree', 'pear', 'dango', 'moon_viewing', 'full_moon'])
/** 아이콘 이름 → 파일 경로 (공용 public/icons, B 전용 public/b/icons). 'none'(데이터 없는 칸)은 그림 없음 */
+1
View File
@@ -25,6 +25,7 @@ export type SheetState =
| { type: 'level' }
| { type: 'levelUp'; level: number }
| { type: 'gameHelp' }
| { type: 'contact' }
| null
export type SheetApi = { open: (s: Exclude<SheetState, null>) => void; close: () => void }
+4
View File
@@ -46,6 +46,8 @@ export type Events<Sheet extends string = string> = {
game_over: { round: number; score: number; best: boolean; drops: number }
toss_intro_start: Record<string, never>
install_banner_close: Record<string, never>
top_button: { page: string }
contact_click: { method: 'phone' | 'email' }
}
/** GA 에 찍히는 이벤트 이름 (한국어). 코드에서는 왼쪽 키로 부른다 */
@@ -90,4 +92,6 @@ export const GA_NAME: Record<keyof Events, string> = {
game_over: '게임_끝',
toss_intro_start: '토스소개_시작',
install_banner_close: '설치배너_닫기',
top_button: '맨위로_누름',
contact_click: '문의_누름',
}