change login-page design
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { getToken } from '@/utils'
|
||||
import router from '@/router'
|
||||
import type { LocationQuery, RouteLocationNormalizedLoaded } from 'vue-router'
|
||||
|
||||
export const GUEST_HOME_QUERY = { guest: '1' } as const
|
||||
|
||||
export function isGuestHomeQuery(query: LocationQuery | Record<string, unknown>) {
|
||||
const value = query.guest
|
||||
return value === '1' || value === 1
|
||||
}
|
||||
|
||||
export function isGuestHomeActive(route?: RouteLocationNormalizedLoaded) {
|
||||
const current = route ?? router.currentRoute.value
|
||||
return current.name === 'home' && isGuestHomeQuery(current.query) && !getToken()
|
||||
}
|
||||
|
||||
export function guestHomeRoute() {
|
||||
return { name: 'home' as const, query: { ...GUEST_HOME_QUERY } }
|
||||
}
|
||||
@@ -17,6 +17,10 @@ type DraggableFloatingOptions = {
|
||||
/** فاصله از پایینِ نوار منو + montzar (px) — مثل تصویر */
|
||||
defaultBottomGap?: number
|
||||
defaultRightOffset?: number
|
||||
/** عرض کل پنجره بهجای فریم موبایل ۴۲۶ */
|
||||
fullViewport?: boolean
|
||||
/** نوار پایین اپ را در موقعیت پیشفرض لحاظ نکن */
|
||||
ignoreBottomChrome?: boolean
|
||||
}
|
||||
|
||||
function readBottomChromeHeight(): number {
|
||||
@@ -49,6 +53,8 @@ export function useDraggableFloatingButton(
|
||||
const height = options.height ?? 44
|
||||
const defaultBottomGap = options.defaultBottomGap ?? 12
|
||||
const defaultRightOffset = options.defaultRightOffset ?? 16
|
||||
const fullViewport = options.fullViewport === true
|
||||
const ignoreBottomChrome = options.ignoreBottomChrome === true
|
||||
|
||||
const pos = ref<FabPosition>({ x: 0, y: 0 })
|
||||
const dragging = ref(false)
|
||||
@@ -68,6 +74,7 @@ export function useDraggableFloatingButton(
|
||||
}))
|
||||
|
||||
function getViewportWidth() {
|
||||
if (fullViewport) return window.innerWidth
|
||||
return Math.min(window.innerWidth, 426)
|
||||
}
|
||||
|
||||
@@ -78,11 +85,16 @@ export function useDraggableFloatingButton(
|
||||
return Math.max(0, (vw - contentWidth) / 2)
|
||||
}
|
||||
|
||||
function getBottomChrome() {
|
||||
if (ignoreBottomChrome) return 0
|
||||
return readBottomChromeHeight()
|
||||
}
|
||||
|
||||
function getDefaultPosition(): FabPosition {
|
||||
const vh = window.innerHeight
|
||||
const offsetX = getHorizontalOffset()
|
||||
const contentWidth = getViewportWidth()
|
||||
const bottomChrome = readBottomChromeHeight()
|
||||
const bottomChrome = getBottomChrome()
|
||||
|
||||
return {
|
||||
x: offsetX + contentWidth - width - defaultRightOffset,
|
||||
|
||||
Reference in New Issue
Block a user