Skip to content

Commit cdba010

Browse files
committed
feat: add navigating progress
1 parent 6476cdd commit cdba010

11 files changed

Lines changed: 58 additions & 6 deletions

File tree

web/astro.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export default defineConfig({
1313
plugins: [tailwindcss()],
1414
server: {
1515
proxy: {
16-
"/api": "http://127.0.0.1:3000",
16+
// "/api": "http://127.0.0.1:3000",
17+
"/api": "https://tool.sunls.de",
1718
},
1819
},
1920
},

web/public/apple-icon.png

674 Bytes
Loading

web/public/favicon.ico

-14.7 KB
Binary file not shown.

web/public/favicon.svg

Lines changed: 3 additions & 0 deletions
Loading

web/src/components/Header.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
22
import ThemeIcon from "@/components/ThemeIcon.astro"
3+
import Navigating from "@/components/tsx/Navigating"
34
import { Button } from "@/components/ui/button"
45
import { VERSION } from "@/lib/constants"
56
import clsx from "clsx"
6-
import { DraftingCompass, Github, ToolCase } from "lucide-react"
7+
import { Github, ToolCase } from "lucide-react"
78
89
interface Props {
910
wide: boolean
@@ -12,7 +13,7 @@ interface Props {
1213
const { wide } = Astro.props
1314
---
1415

15-
<div class="bg-sidebar border-b py-3 shadow-xs">
16+
<div class="bg-sidebar relative border-b py-3 shadow-xs">
1617
<div
1718
class={clsx(
1819
"mx-auto flex w-5/6 items-center px-2",
@@ -36,6 +37,7 @@ const { wide } = Astro.props
3637
{VERSION}
3738
</Button>
3839
</div>
40+
<Navigating client:load />
3941
</div>
4042

4143
<script>

web/src/components/Title.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ const { tool } = Astro.props
77
transition:name={tool.route}
88
>
99
<img
10+
width="24"
11+
height="24"
1012
src={tool.image}
11-
class="h-5"
1213
alt={tool.name}
1314
draggable={false}
1415
transition:name={tool.image}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { $navigating } from "@/lib/store/store"
2+
import { useStore } from "@nanostores/react"
3+
4+
function Navigating() {
5+
const navigating = useStore($navigating)
6+
if (!navigating) {
7+
return null
8+
}
9+
10+
return (
11+
<div className="animate-progress absolute -bottom-0.5 left-0 h-0.5 bg-green-400 dark:bg-green-600" />
12+
)
13+
}
14+
15+
export default Navigating

web/src/layouts/Layout.astro

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const title = tool ? tool.name : "开发者工具箱"
2121
<meta charset="UTF-8" />
2222
<meta name="generator" content={Astro.generator} />
2323
<meta name="viewport" content="width=device-width,initial-scale=1" />
24-
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
24+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
2525
<meta name="apple-mobile-web-app-capable" content="yes" />
2626
<meta name="apple-mobile-web-app-title" content="devtools" />
2727
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
@@ -80,3 +80,14 @@ const title = tool ? tool.name : "开发者工具箱"
8080
applyTheme()
8181
document.addEventListener("astro:after-swap", applyTheme)
8282
</script>
83+
84+
<script>
85+
import { $navigating } from "@/lib/store/store"
86+
87+
document.addEventListener("astro:before-preparation", () =>
88+
$navigating.set(true)
89+
)
90+
document.addEventListener("astro:after-preparation", () =>
91+
$navigating.set(false)
92+
)
93+
</script>

web/src/lib/store/store.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
import { persistentAtom } from "@nanostores/persistent"
2+
import { atom } from "nanostores"
23

34
export const $theme = persistentAtom<string>("theme")
5+
6+
export const $navigating = atom(false)

web/src/pages/index.astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ import { ExternalLink, Zap } from "lucide-react"
2121
>
2222
<div class="flex items-center gap-2">
2323
<img
24+
width=28
25+
height=28
26+
loading="lazy"
27+
decoding="async"
2428
src={tool.image}
25-
class="h-7"
2629
alt={tool.name}
2730
draggable={false}
2831
transition:name={tool.image}

0 commit comments

Comments
 (0)