fix: 홈 화면에 추가 카드·메뉴를 휴대폰(아이폰·안드로이드·앱 안 브라우저)에서만 보이게
This commit is contained in:
1 parent
e5716c0c7c
commit
77d29ce24f
3 files changed
+12
-7
No files matched your search
@@ -26,7 +26,7 @@ import { cx } from '../lib/utils'
|
||||
import { useAuth } from './authContext'
|
||||
import { ago, ARTICLE_CAT, articleMeta, AVATAR_COLORS, cardBg, CHARACTERS, dateRange, loadOf, MOODS, shortDay } from './lib'
|
||||
import { GoogleButton } from './googleLogin'
|
||||
import { useInstall } from './install'
|
||||
import { onPhone, useInstall } from './install'
|
||||
import { InstallSheet } from './installBanner'
|
||||
import { MixSheet } from './myGak'
|
||||
import { ownPage, useRegion } from './regionContext'
|
||||
@@ -905,9 +905,11 @@ function MeSheet({ onDone }: { onDone: () => void }) {
|
||||
<Avatar character={me.character} color={me.color} mood={me.mood} size={64} />
|
||||
<p className="m-0 text-center text-sm font-semibold text-(--ink2)">{me.provider === AuthProvider.GOOGLE ? '구글 계정으로 로그인했어요' : `${me.login_id}(으)로 로그인했어요`}</p>
|
||||
</div>
|
||||
<button type="button" onClick={() => install('menu')} className="cursor-pointer rounded-2xl bg-[#fff4ec] py-2.5 font-jua text-[15.5px] text-(--orange)">
|
||||
📲 홈 화면에 추가
|
||||
</button>
|
||||
{onPhone() && (
|
||||
<button type="button" onClick={() => install('menu')} className="cursor-pointer rounded-2xl bg-[#fff4ec] py-2.5 font-jua text-[15.5px] text-(--orange)">
|
||||
📲 홈 화면에 추가
|
||||
</button>
|
||||
)}
|
||||
<section aria-label="내 캐릭터">
|
||||
<h4 className="m-0 mb-2 text-sm font-extrabold">내 캐릭터</h4>
|
||||
<div className="grid grid-cols-3 gap-2" role="radiogroup" aria-label="캐릭터 고르기">
|
||||
|
||||
@@ -37,6 +37,9 @@ export function platform(): Platform {
|
||||
return 'other'
|
||||
}
|
||||
|
||||
/** 휴대폰에서만 홈 화면 추가를 권한다 (PC 는 안 보임) */
|
||||
export const onPhone = () => ['ios', 'android', 'inapp'].includes(platform())
|
||||
|
||||
/** 설치창을 바로 띄울 수 있는지 (안드로이드 Chrome 등) */
|
||||
export function useCanPrompt() {
|
||||
return useSyncExternalStore(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { track } from '../lib/analytics'
|
||||
import { dismiss, dismissed, platform, useInstall } from './install'
|
||||
import { dismiss, dismissed, onPhone, platform, useInstall } from './install'
|
||||
|
||||
const SITE = 'https://weather.o2o.kr'
|
||||
|
||||
/** 오늘 탭의 작은 설치 카드. 오늘의 각까지 본 뒤 자리에 놓고, 닫으면 2주 숨기고, 홈 화면에서 연 경우엔 안 보인다 */
|
||||
/** 오늘 탭의 작은 설치 카드. 오늘의 각까지 본 뒤 자리에 놓고, 휴대폰 브라우저에서만 보인다. 닫으면 2주 숨긴다 (홈 화면에서 연 경우·PC 는 안 보임) */
|
||||
export function InstallBanner() {
|
||||
const install = useInstall()
|
||||
const [hidden, setHidden] = useState(() => platform() === 'standalone' || dismissed())
|
||||
const [hidden, setHidden] = useState(() => !onPhone() || dismissed())
|
||||
|
||||
useEffect(() => {
|
||||
if (!hidden) track('install_banner_view', {})
|
||||
|
||||
Reference in new issue
Block a user