mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-02-04 12:40:10 +00:00
fix: inline card server name overflow
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
import { useRegisterSW } from 'virtual:pwa-register/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toast } from 'sonner';
|
||||
import { useRegisterSW } from "virtual:pwa-register/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
|
||||
function ReloadPrompt() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
const {
|
||||
needRefresh: [needRefresh, setNeedRefresh],
|
||||
updateServiceWorker,
|
||||
} = useRegisterSW({
|
||||
onRegisteredSW(swUrl) {
|
||||
console.log(`SW Registered: ${swUrl} (Version: ${import.meta.env.VITE_GIT_HASH})`);
|
||||
console.log(
|
||||
`SW Registered: ${swUrl} (Version: ${import.meta.env.VITE_GIT_HASH})`,
|
||||
);
|
||||
},
|
||||
onRegisterError(error) {
|
||||
console.log('SW registration error', error);
|
||||
console.log("SW registration error", error);
|
||||
},
|
||||
onOfflineReady() {
|
||||
toast.success(t('pwa.offlineReady'));
|
||||
toast.success(t("pwa.offlineReady"));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -32,19 +34,14 @@ function ReloadPrompt() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
toast.message(
|
||||
`${t('pwa.newContent')} (${import.meta.env.VITE_GIT_HASH})`,
|
||||
{
|
||||
action: {
|
||||
label: t('pwa.reload'),
|
||||
onClick: () => update(),
|
||||
},
|
||||
onDismiss: close,
|
||||
duration: Infinity,
|
||||
}
|
||||
);
|
||||
toast.message(`${t("pwa.newContent")} (${import.meta.env.VITE_GIT_HASH})`, {
|
||||
action: {
|
||||
label: t("pwa.reload"),
|
||||
onClick: () => update(),
|
||||
},
|
||||
onDismiss: close,
|
||||
duration: Infinity,
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function ServerCardInline({
|
||||
>
|
||||
{showFlag ? <ServerFlag country_code={country_code} /> : null}
|
||||
</div>
|
||||
<div className="relative flex flex-col">
|
||||
<div className="relative w-24 flex flex-col">
|
||||
<p
|
||||
className={cn(
|
||||
"break-all font-bold tracking-tight",
|
||||
@@ -226,7 +226,7 @@ export default function ServerCardInline({
|
||||
<div className="relative">
|
||||
<p
|
||||
className={cn(
|
||||
"break-all font-bold tracking-tight",
|
||||
"break-all font-bold w-24 tracking-tight",
|
||||
showFlag ? "text-xs" : "text-sm",
|
||||
)}
|
||||
>
|
||||
|
||||
29
src/vite-env.d.ts
vendored
29
src/vite-env.d.ts
vendored
@@ -1,22 +1,27 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module 'virtual:pwa-register/react' {
|
||||
import type { Dispatch, SetStateAction } from 'react'
|
||||
declare module "virtual:pwa-register/react" {
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
|
||||
export interface RegisterSWOptions {
|
||||
immediate?: boolean
|
||||
onNeedRefresh?: () => void
|
||||
onOfflineReady?: () => void
|
||||
onRegistered?: (registration: ServiceWorkerRegistration | undefined) => void
|
||||
onRegisteredSW?: (swScriptUrl: string, registration: ServiceWorkerRegistration | undefined) => void
|
||||
onRegisterError?: (error) => void
|
||||
immediate?: boolean;
|
||||
onNeedRefresh?: () => void;
|
||||
onOfflineReady?: () => void;
|
||||
onRegistered?: (
|
||||
registration: ServiceWorkerRegistration | undefined,
|
||||
) => void;
|
||||
onRegisteredSW?: (
|
||||
swScriptUrl: string,
|
||||
registration: ServiceWorkerRegistration | undefined,
|
||||
) => void;
|
||||
onRegisterError?: (error) => void;
|
||||
}
|
||||
|
||||
export interface RegisterSWHook {
|
||||
needRefresh: [boolean, Dispatch<SetStateAction<boolean>>]
|
||||
offlineReady: [boolean, Dispatch<SetStateAction<boolean>>]
|
||||
updateServiceWorker: (reloadPage?: boolean) => Promise<void>
|
||||
needRefresh: [boolean, Dispatch<SetStateAction<boolean>>];
|
||||
offlineReady: [boolean, Dispatch<SetStateAction<boolean>>];
|
||||
updateServiceWorker: (reloadPage?: boolean) => Promise<void>;
|
||||
}
|
||||
|
||||
export function useRegisterSW(options?: RegisterSWOptions): RegisterSWHook
|
||||
export function useRegisterSW(options?: RegisterSWOptions): RegisterSWHook;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user