@bbki.ng/site 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 1.1.1
4
+
3
5
  ## 1.1.0
4
6
 
5
7
  ## 1.0.16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,6 +24,7 @@
24
24
  "react-dom": "^18.0.0",
25
25
  "react-hotkeys-hook": "^3.4.3",
26
26
  "react-router-dom": "6",
27
+ "sonner": "1.4.0",
27
28
  "swr": "^1.2.1"
28
29
  },
29
30
  "devDependencies": {
Binary file
Binary file
@@ -1,8 +1,8 @@
1
- import React from "react";
1
+ import React, { useEffect } from "react";
2
+ import { toast } from "sonner";
2
3
 
3
4
  // @ts-ignore
4
5
  import { useRegisterSW } from "virtual:pwa-register/react";
5
- import { CornerPromptBox } from "@/components";
6
6
 
7
7
  export const ReloadPrompt = () => {
8
8
  const {
@@ -21,16 +21,31 @@ export const ReloadPrompt = () => {
21
21
 
22
22
  // @ts-ignore
23
23
  const appVer = GLOBAL_BBKING_VERSION;
24
- console.log("appVer: ", appVer);
25
24
 
26
- return (
27
- <CornerPromptBox
28
- className="z-[1010]"
29
- content={`🚀 发现新版本(当前 v${appVer})。获取更新?`}
30
- showBox={needRefresh}
31
- onCancel={close}
32
- cancelLabel="关闭"
33
- onOk={needRefresh ? () => updateServiceWorker(true) : close}
34
- />
35
- );
25
+ useEffect(() => {
26
+ if (!needRefresh) {
27
+ return;
28
+ }
29
+
30
+ toast("", {
31
+ description: "检测到更新,当前 v" + appVer + "。是否更新?",
32
+ position: "bottom-center",
33
+ actionButtonStyle: {
34
+ backgroundColor: "#fff",
35
+ color: "rgb(37,99,235)",
36
+ },
37
+ action: {
38
+ label: "是",
39
+ onClick: () => {
40
+ if (!needRefresh) {
41
+ setNeedRefresh(false);
42
+ return;
43
+ }
44
+ updateServiceWorker(true);
45
+ },
46
+ },
47
+ });
48
+ }, []);
49
+
50
+ return null;
36
51
  };
package/src/main.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { createRoot } from "react-dom/client";
3
+ import { Toaster } from "sonner";
3
4
  import { BrowserRouter as Router } from "react-router-dom";
4
5
  import { ReloadPrompt } from "@/components";
5
6
  import "@bbki.ng/components/style";
@@ -14,6 +15,7 @@ root.render(
14
15
  <Router>
15
16
  <ReloadPrompt />
16
17
  <App />
18
+ <Toaster />
17
19
  </Router>
18
20
  </React.StrictMode>
19
21
  );
package/vite.config.js CHANGED
@@ -79,9 +79,9 @@ export default defineConfig({
79
79
  ],
80
80
  },
81
81
  manifest: {
82
- name: "BBKi.ng",
83
- short_name: "BBKi.ng",
84
- description: "A Personal Site.",
82
+ name: "bbki.ng",
83
+ short_name: "bbki.ng",
84
+ description: "words, pictures",
85
85
  theme_color: "#ffffff",
86
86
  icons: [
87
87
  {