import { Box, Center, Flex, Heading, useColorModeValue, createDisclosure, Select, SelectContent, SelectIcon, SelectListbox, SelectOption, SelectOptionIndicator, SelectOptionText, SelectTrigger, SelectValue, Icon, Button, VStack, Text, } from "@hope-ui/solid" import { SwitchColorMode } from "./SwitchColorMode" import { ComponentProps, For, mergeProps, Show } from "solid-js" import { AiOutlineFullscreen, AiOutlineFullscreenExit } from "solid-icons/ai" import { hoverColor } from "~/utils" import { useRouter, useT } from "~/hooks" export const Error = (props: { msg: string disableColor?: boolean h?: string }) => { const merged = mergeProps( { h: "$full", }, props, ) const { to } = useRouter() const t = useT() // 检查是否是存储错误 const isStorageError = () => { return ( props.msg.includes("storage not found") || props.msg.includes("please add a storage") ) } // 检查是否是设备数上限错误 const isTooManyDevicesError = () => { return props.msg.includes("too many active devices") } // 检查是否是会话失效错误 const isSessionInactiveError = () => { return props.msg.includes("session inactive") } const handleGoToStorages = () => { to("/@manage/storages") } const handleGoToLogin = () => { to(`/@login?redirect=${encodeURIComponent(window.location.pathname)}`) } return (
{props.msg} {t("session.too_many_devices")} {t("session.session_inactive")}
) } export const BoxWithFullScreen = (props: Parameters[0]) => { const { isOpen, onToggle } = createDisclosure() return ( {props.children} ) } export function SelectWrapper(props: { value: T onChange: (v: T) => void options: { value: T label?: string }[] alwaysShowBorder?: boolean size?: "xs" | "sm" | "md" | "lg" w?: ComponentProps["w"] }) { return ( ) }