mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
Compare commits
No commits in common. "f87615f163313cffcd9def19c5ccaa5ca4017523" and "b43ce6a4bf381048a75b77e3574f3256fcd9fcf1" have entirely different histories.
f87615f163
...
b43ce6a4bf
@ -12,5 +12,4 @@ NEXT_PUBLIC_FixedTopServerName=false
|
|||||||
NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png
|
NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png
|
||||||
NEXT_PUBLIC_CustomTitle=NezhaDash
|
NEXT_PUBLIC_CustomTitle=NezhaDash
|
||||||
NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha.
|
NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha.
|
||||||
NEXT_PUBLIC_Links=[{"link":"https://baidu.com","name":"Baidu"},{"link":"https://google.com","name":"Google"}]
|
|
||||||
NEXT_PUBLIC_DisableIndex=false
|
NEXT_PUBLIC_DisableIndex=false
|
||||||
|
@ -29,9 +29,12 @@ export default function ServerDetailClient({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const previousPath = sessionStorage.getItem("fromMainPage");
|
const previousPath = sessionStorage.getItem("lastPath");
|
||||||
if (previousPath) {
|
if (previousPath) {
|
||||||
setHasHistory(true);
|
setHasHistory(true);
|
||||||
|
} else {
|
||||||
|
const currentPath = window.location.pathname;
|
||||||
|
sessionStorage.setItem("lastPath", currentPath);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -51,7 +51,6 @@ function Header() {
|
|||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
<section className="flex items-center gap-2">
|
<section className="flex items-center gap-2">
|
||||||
<Links />
|
|
||||||
<LanguageSwitcher />
|
<LanguageSwitcher />
|
||||||
<ModeToggle />
|
<ModeToggle />
|
||||||
</section>
|
</section>
|
||||||
@ -61,39 +60,6 @@ function Header() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
type links = {
|
|
||||||
link: string;
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
function Links() {
|
|
||||||
const linksEnv = getEnv("NEXT_PUBLIC_Links");
|
|
||||||
|
|
||||||
const links: links[] | null = linksEnv ? JSON.parse(linksEnv) : null;
|
|
||||||
|
|
||||||
console.log(links);
|
|
||||||
|
|
||||||
if (!links) return null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
{links.map((link, index) => {
|
|
||||||
return (
|
|
||||||
<a
|
|
||||||
key={index}
|
|
||||||
href={link.link}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="flex items-center gap-1 text-sm font-medium opacity-50 transition-opacity hover:opacity-100"
|
|
||||||
>
|
|
||||||
{link.name}
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://github.com/streamich/react-use/blob/master/src/useInterval.ts
|
// https://github.com/streamich/react-use/blob/master/src/useInterval.ts
|
||||||
const useInterval = (callback: () => void, delay: number | null) => {
|
const useInterval = (callback: () => void, delay: number | null) => {
|
||||||
const savedCallback = useRef<() => void>(() => {});
|
const savedCallback = useRef<() => void>(() => {});
|
||||||
|
@ -29,12 +29,8 @@ export default function ServerCard({
|
|||||||
const fixedTopServerName =
|
const fixedTopServerName =
|
||||||
getEnv("NEXT_PUBLIC_FixedTopServerName") === "true";
|
getEnv("NEXT_PUBLIC_FixedTopServerName") === "true";
|
||||||
|
|
||||||
const saveSession = () => {
|
|
||||||
sessionStorage.setItem("fromMainPage", "true");
|
|
||||||
};
|
|
||||||
|
|
||||||
return online ? (
|
return online ? (
|
||||||
<Link onClick={saveSession} href={`/${id}`} prefetch={true}>
|
<Link href={`/${id}`} prefetch={true}>
|
||||||
<Card
|
<Card
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 cursor-pointer",
|
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 cursor-pointer",
|
||||||
|
Loading…
Reference in New Issue
Block a user