@bbki.ng/site 5.0.3 → 5.0.5
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 +4 -0
- package/package.json +2 -2
- package/src/blog/components/article/index.tsx +1 -2
- package/src/blog/components/article_ctx_menu/index.tsx +1 -1
- package/src/blog/hooks/use_font_loading.ts +4 -4
- package/src/blog/pages/extensions/txt/index.tsx +1 -4
- package/src/blog/hooks/use_safe_loading.ts +0 -29
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbki.ng/site",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
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.0.
|
|
23
|
+
"@bbki.ng/components": "5.0.3",
|
|
24
24
|
"@bbki.ng/stylebase": "3.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -20,7 +20,6 @@ export type ArticlePageProps = {
|
|
|
20
20
|
export const ArticlePage = (props: ArticlePageProps) => {
|
|
21
21
|
const { tags: tagNames, title, description, headless } = props;
|
|
22
22
|
const navgation = useNavigate();
|
|
23
|
-
const loading = useSafeArticleLoading(0.2, 5);
|
|
24
23
|
// const defaultTag = { children: "目录", to: "/blog" };
|
|
25
24
|
const allTags = tagNames
|
|
26
25
|
? tagNames.map((t) => ({ children: t, to: `${ROUTES.TAGS}/${t}` }))
|
|
@@ -41,7 +40,7 @@ export const ArticlePage = (props: ArticlePageProps) => {
|
|
|
41
40
|
date={props.date}
|
|
42
41
|
description={description}
|
|
43
42
|
className={`${props.className} mb-128`}
|
|
44
|
-
loading={
|
|
43
|
+
loading={false}
|
|
45
44
|
>
|
|
46
45
|
<article className={articleCls}>{props.children}</article>
|
|
47
46
|
<div className="relative left-[-4px]">
|
|
@@ -44,7 +44,7 @@ export const ArticleCtxMenu = (props: { children: ReactElement }) => {
|
|
|
44
44
|
return (
|
|
45
45
|
<ContextMenu>
|
|
46
46
|
<ContextMenuTrigger>{props.children}</ContextMenuTrigger>
|
|
47
|
-
<ContextMenuContent
|
|
47
|
+
<ContextMenuContent>
|
|
48
48
|
<ContextMenuItem
|
|
49
49
|
onClick={() => {
|
|
50
50
|
confirm("确认删除?", doDel);
|
|
@@ -3,7 +3,7 @@ import { changeFont } from "@/utils";
|
|
|
3
3
|
import { FontType } from "@/types/font";
|
|
4
4
|
|
|
5
5
|
export const useFontLoading = () => {
|
|
6
|
-
const [isFontLoading, setIsFontLoading] = useState(
|
|
6
|
+
const [isFontLoading, setIsFontLoading] = useState(false);
|
|
7
7
|
|
|
8
8
|
const handleFontLoading = () => {
|
|
9
9
|
setIsFontLoading(true);
|
|
@@ -13,9 +13,9 @@ export const useFontLoading = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const handleFontLoadingDone = () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, 500);
|
|
16
|
+
setIsFontLoading(false);
|
|
17
|
+
// setTimeout(() => {
|
|
18
|
+
// }, 500);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const handleFontLoadingError = () => {
|
|
@@ -5,7 +5,6 @@ import { usePosts } from "@/hooks/use_posts";
|
|
|
5
5
|
import { CenterLinkList } from "@/components";
|
|
6
6
|
import { useAuthed } from "@/hooks/use_authed";
|
|
7
7
|
import { useFile2Post } from "@/hooks/use_file_to_post";
|
|
8
|
-
import { useSafeArticleLoading } from "@/hooks/use_safe_loading";
|
|
9
8
|
import { useClipboardToPost } from "@/hooks/use_clipboard_to_post";
|
|
10
9
|
import { useLocation } from "react-router-dom";
|
|
11
10
|
import {
|
|
@@ -21,8 +20,6 @@ type TxtProps = {
|
|
|
21
20
|
const Posts = (props: TxtProps) => {
|
|
22
21
|
const { titleList, isLoading, isError } = usePosts();
|
|
23
22
|
|
|
24
|
-
const isGlobalLoading = useSafeArticleLoading(0.2, 5);
|
|
25
|
-
|
|
26
23
|
useBlogScrollRestoration();
|
|
27
24
|
|
|
28
25
|
const { gotoTop } = useBlogScroll();
|
|
@@ -40,7 +37,7 @@ const Posts = (props: TxtProps) => {
|
|
|
40
37
|
return (
|
|
41
38
|
<CenterLinkList
|
|
42
39
|
links={props.articleList || links}
|
|
43
|
-
loading={
|
|
40
|
+
loading={isLoading}
|
|
44
41
|
footer={
|
|
45
42
|
<Button onClick={gotoTop} className="mt-128">
|
|
46
43
|
<svg
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useEffect } from "react";
|
|
2
|
-
import { GlobalLoadingContext } from "@/context/global_loading_state_provider";
|
|
3
|
-
|
|
4
|
-
export const useSafeArticleLoading = (safeSec: number, timeOutSec: number) => {
|
|
5
|
-
const { isLoading, isFontLoading } = useContext(GlobalLoadingContext);
|
|
6
|
-
const [isArticleLoading, setIsArticleLoading] = React.useState(true);
|
|
7
|
-
const [isTimeout, setIsTimeout] = React.useState(false);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const id = setTimeout(() => {
|
|
11
|
-
setIsArticleLoading(false);
|
|
12
|
-
}, safeSec * 1000);
|
|
13
|
-
|
|
14
|
-
const timeoutId = setTimeout(() => {
|
|
15
|
-
setIsTimeout(true);
|
|
16
|
-
}, timeOutSec * 1000);
|
|
17
|
-
|
|
18
|
-
return () => {
|
|
19
|
-
clearTimeout(id);
|
|
20
|
-
clearTimeout(timeoutId);
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
|
-
|
|
24
|
-
if (isTimeout) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return isFontLoading || isArticleLoading;
|
|
29
|
-
};
|