@bbki.ng/site 5.0.5 → 5.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 +12 -0
- package/package.json +2 -2
- package/src/blog/app.tsx +1 -0
- package/src/blog/components/Logger.tsx +0 -2
- package/src/blog/components/Version.tsx +14 -0
- package/src/blog/components/article/index.tsx +2 -4
- package/src/blog/components/index.tsx +1 -1
- package/src/blog/components/reload_prompt/index.tsx +27 -26
- package/src/blog/index.tsx +1 -2
- package/src/blog/pages/cover/index.tsx +3 -0
- package/src/blog/pages/extensions/txt/article.tsx +0 -3
- package/vite.config.js +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbki.ng/site",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "code behind bbki.ng",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"sonner": "1.4.0",
|
|
21
21
|
"swr": "^2.2.5",
|
|
22
22
|
"vaul": "1.1.2",
|
|
23
|
-
"@bbki.ng/components": "5.
|
|
23
|
+
"@bbki.ng/components": "5.1.1",
|
|
24
24
|
"@bbki.ng/stylebase": "3.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
package/src/blog/app.tsx
CHANGED
|
@@ -25,6 +25,7 @@ import { BBContext } from "@/context/bbcontext";
|
|
|
25
25
|
import { useClipboardToPost } from "@/hooks/use_clipboard_to_post";
|
|
26
26
|
import { useSharedStringToPost } from "@/hooks/use_shared_string_to_post";
|
|
27
27
|
import { ThreeColLayout, ErrorBoundary } from "@bbki.ng/components";
|
|
28
|
+
import { Version } from "./components/version";
|
|
28
29
|
|
|
29
30
|
const Layout = () => {
|
|
30
31
|
const { isLoading, isFontLoading } = useContext(GlobalLoadingContext);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Tag } from "@bbki.ng/components";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export const Version = ({ className }: { className?: string }) => {
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
const appVer = GLOBAL_BBKING_VERSION;
|
|
7
|
+
const tagUrl = `https://github.com/bbbottle/bottle/releases/tag/@bbki.ng/site@${appVer}`;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Tag to={tagUrl} external prefix="v" className={className}>
|
|
11
|
+
{appVer}
|
|
12
|
+
</Tag>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import React, { ReactElement
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
2
|
import { Tags, Article, Button } from "@bbki.ng/components";
|
|
3
3
|
import { ROUTES } from "@/constants";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
-
import {
|
|
6
|
-
import { useSafeArticleLoading } from "@/hooks/use_safe_loading";
|
|
7
|
-
import { OpenHeartReaction, Reaction } from "../reaction/oh_reaction";
|
|
5
|
+
import { Reaction } from "../reaction/oh_reaction";
|
|
8
6
|
import { useNavigate } from "react-router-dom";
|
|
9
7
|
|
|
10
8
|
export type ArticlePageProps = {
|
|
@@ -31,7 +31,7 @@ export { MySuspense } from "./my_suspense";
|
|
|
31
31
|
|
|
32
32
|
export const CenterLinkList = (props: any) => {
|
|
33
33
|
return (
|
|
34
|
-
<div className="flex justify-center relative p-16">
|
|
34
|
+
<div className="flex justify-center relative p-16 h-full">
|
|
35
35
|
<LinkList {...props} />
|
|
36
36
|
<BlurCover status={props.loading ? "show" : "silent"} />
|
|
37
37
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
1
2
|
import { toast } from "sonner";
|
|
2
3
|
|
|
3
4
|
// @ts-ignore
|
|
@@ -19,32 +20,32 @@ export const ReloadPrompt = () => {
|
|
|
19
20
|
},
|
|
20
21
|
});
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (needRefresh) {
|
|
25
|
+
toast("", {
|
|
26
|
+
description: "发现新版本,是否更新?",
|
|
27
|
+
duration: 10000,
|
|
28
|
+
position: "bottom-right",
|
|
29
|
+
actionButtonStyle: {
|
|
30
|
+
backgroundColor: "#fff",
|
|
31
|
+
color: "rgb(37,99,235)",
|
|
32
|
+
},
|
|
33
|
+
action: {
|
|
34
|
+
label: "是",
|
|
35
|
+
onClick: () => {
|
|
36
|
+
updateServiceWorker(false).then(() => {
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
toast("", {
|
|
39
|
+
description: `已更新`,
|
|
40
|
+
position: "bottom-right",
|
|
41
|
+
});
|
|
42
|
+
setNeedRefresh(false);
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}, [needRefresh]);
|
|
48
49
|
|
|
49
50
|
return null;
|
|
50
51
|
};
|
package/src/blog/index.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import { createRoot } from "react-dom/client";
|
|
|
3
3
|
import { Toaster } from "sonner";
|
|
4
4
|
import { BrowserRouter as Router } from "react-router-dom";
|
|
5
5
|
import { ReloadPrompt } from "@/components";
|
|
6
|
-
// import "@bbki.ng/components/style";
|
|
7
6
|
import App from "./app";
|
|
8
7
|
import "./main.css";
|
|
9
8
|
import Logger from "@/components/Logger";
|
|
@@ -16,7 +15,7 @@ export const RenderBlogInto = (ele: Element) => {
|
|
|
16
15
|
<App />
|
|
17
16
|
<Toaster />
|
|
18
17
|
<Logger />
|
|
19
|
-
|
|
18
|
+
<ReloadPrompt />
|
|
20
19
|
</Router>
|
|
21
20
|
</React.StrictMode>
|
|
22
21
|
);
|
|
@@ -2,6 +2,7 @@ import React, { useContext } from "react";
|
|
|
2
2
|
import { CenterLinkList } from "@/components";
|
|
3
3
|
import { EffectLayer } from "@/components/effect-layer/EffectLayer";
|
|
4
4
|
import { GlobalRoutesContext } from "@/context/global_routes_provider";
|
|
5
|
+
import { Version } from "@/components/version";
|
|
5
6
|
|
|
6
7
|
export const Cover = (props: { className?: string }) => {
|
|
7
8
|
const globalRouteCtx = useContext(GlobalRoutesContext);
|
|
@@ -11,6 +12,7 @@ export const Cover = (props: { className?: string }) => {
|
|
|
11
12
|
return (
|
|
12
13
|
<>
|
|
13
14
|
<CenterLinkList
|
|
15
|
+
spaceBetween
|
|
14
16
|
className="select-none"
|
|
15
17
|
links={[
|
|
16
18
|
// {
|
|
@@ -24,6 +26,7 @@ export const Cover = (props: { className?: string }) => {
|
|
|
24
26
|
...pluginEntry,
|
|
25
27
|
]}
|
|
26
28
|
title=""
|
|
29
|
+
footer={<Version className="" />}
|
|
27
30
|
/>
|
|
28
31
|
</>
|
|
29
32
|
);
|
|
@@ -20,7 +20,6 @@ const ArticleMap: TArticleMap = {};
|
|
|
20
20
|
|
|
21
21
|
MdxArticleList.forEach((article: unknown) => {
|
|
22
22
|
const { meta, default: component } = article as MdxArticle;
|
|
23
|
-
console.log(meta);
|
|
24
23
|
const dateStr = meta.created_at
|
|
25
24
|
? meta.created_at.toISOString().split("T")[0]
|
|
26
25
|
: "";
|
|
@@ -56,8 +55,6 @@ export default () => {
|
|
|
56
55
|
|
|
57
56
|
const date = posts.created_at ? posts.created_at.split("T")[0] : "";
|
|
58
57
|
|
|
59
|
-
console.log("posts", posts);
|
|
60
|
-
|
|
61
58
|
return (
|
|
62
59
|
<DropZone onDrop={reader} disabled={!isKing}>
|
|
63
60
|
<ArticlePage title={title} date={date}>
|