Compare commits

...

20 Commits

Author SHA1 Message Date
hamster1963
f87615f163 Merge branch 'main' into cloudflare 2024-11-15 11:21:29 +08:00
hamster1963
095c9ed114 fix(router): error in the back button after refreshing the first time you enter the detail page 2024-11-15 11:21:02 +08:00
kattocloud
91f45e4968
Merge branch 'hamster1963:main' into main 2024-11-14 19:56:35 +08:00
hamster1963
a47a3fc9a5 Merge remote-tracking branch 'upstream/main' 2024-11-11 21:15:07 +08:00
kattocloud
53b5b33f53
Merge branch 'hamster1963:main' into main 2024-11-08 13:15:08 +08:00
kattocloud
161a57f560
Merge branch 'hamster1963:main' into main 2024-11-07 14:41:06 +08:00
kattocloud
d43f4c8ebb
Merge branch 'hamster1963:main' into main 2024-11-06 20:12:17 +08:00
GH Action - Upstream Sync
18bc1018e8 Merge branch 'main' of https://github.com/hamster1963/nezha-dash 2024-11-06 01:46:08 +00:00
kattocloud
ea0a87263e
Merge branch 'hamster1963:main' into main 2024-11-04 21:50:06 +08:00
kattocloud
82114cc65b
Merge branch 'hamster1963:main' into main 2024-11-04 20:48:44 +08:00
kattocloud
aae30a3294
Update README.md 2024-11-04 20:48:27 +08:00
GH Action - Upstream Sync
01c6184b0b Merge branch 'main' of https://github.com/hamster1963/nezha-dash 2024-11-04 01:51:09 +00:00
kattocloud
63042acba1
Merge branch 'hamster1963:main' into main 2024-11-03 06:06:25 +08:00
kattocloud
094271cfd7
Merge branch 'hamster1963:main' into main 2024-11-02 21:41:55 +08:00
kattocloud
2d1ec2947b
Merge branch 'hamster1963:main' into main 2024-11-01 19:16:15 +08:00
GH Action - Upstream Sync
1defac061d Merge branch 'main' of https://github.com/hamster1963/nezha-dash 2024-10-31 01:50:30 +00:00
kattocloud
51f7173f91
Merge branch 'hamster1963:main' into main 2024-10-30 14:30:22 +08:00
kattocloud
32f5c09d8b
Update README.md 2024-10-29 13:25:17 +08:00
kattocloud
7b0427a27b
Merge branch 'hamster1963:main' into main 2024-10-25 16:51:06 +08:00
hamster1963
c20740a152 feat: add header links 2024-10-25 01:16:59 +08:00
4 changed files with 41 additions and 5 deletions

View File

@ -12,4 +12,5 @@ NEXT_PUBLIC_FixedTopServerName=false
NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png
NEXT_PUBLIC_CustomTitle=NezhaDash
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

View File

@ -29,12 +29,9 @@ export default function ServerDetailClient({
}, []);
useEffect(() => {
const previousPath = sessionStorage.getItem("lastPath");
const previousPath = sessionStorage.getItem("fromMainPage");
if (previousPath) {
setHasHistory(true);
} else {
const currentPath = window.location.pathname;
sessionStorage.setItem("lastPath", currentPath);
}
}, []);

View File

@ -51,6 +51,7 @@ function Header() {
</p>
</section>
<section className="flex items-center gap-2">
<Links />
<LanguageSwitcher />
<ModeToggle />
</section>
@ -60,6 +61,39 @@ 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
const useInterval = (callback: () => void, delay: number | null) => {
const savedCallback = useRef<() => void>(() => {});

View File

@ -29,8 +29,12 @@ export default function ServerCard({
const fixedTopServerName =
getEnv("NEXT_PUBLIC_FixedTopServerName") === "true";
const saveSession = () => {
sessionStorage.setItem("fromMainPage", "true");
};
return online ? (
<Link href={`/${id}`} prefetch={true}>
<Link onClick={saveSession} href={`/${id}`} prefetch={true}>
<Card
className={cn(
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 cursor-pointer",