@bbki.ng/site 1.5.7 → 1.5.9

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,9 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 1.5.9
4
+
5
+ ## 1.5.8
6
+
3
7
  ## 1.5.7
4
8
 
5
9
  ## 1.5.6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "url": "git+https://github.com/bbbottle/bbki.ng.git"
17
17
  },
18
18
  "dependencies": {
19
- "@bbki.ng/components": "workspace:2.4.6",
19
+ "@bbki.ng/components": "workspace:2.4.7",
20
20
  "@supabase/supabase-js": "^1.35.4",
21
21
  "classnames": "2.3.1",
22
22
  "react": "^18.0.0",
@@ -28,7 +28,7 @@
28
28
  "swr": "^2.2.5"
29
29
  },
30
30
  "devDependencies": {
31
- "@bbki.ng/stylebase": "workspace:0.3.6",
31
+ "@bbki.ng/stylebase": "workspace:0.3.7",
32
32
  "@mdx-js/mdx": "2.0.0-next.9",
33
33
  "@mdx-js/react": "^1.6.22",
34
34
  "@mdx-js/rollup": "3.0.0",
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: ""
2
+ title: "近况"
3
3
  ---
4
4
 
5
5
  import { MovieList } from "@/components/movie_list";
@@ -10,6 +10,7 @@ import { useNavigate, useParams } from "react-router-dom";
10
10
  import { useDelPost } from "@/hooks/use_delete_post";
11
11
  import { toast } from "sonner";
12
12
  import { confirm } from "@/utils";
13
+ import { useLoadingIndicator } from "@/hooks/useLoadingIndicator";
13
14
 
14
15
  export const ArticleCtxMenu = (props: { children: ReactElement }) => {
15
16
  const auth = useAuthed();
@@ -17,6 +18,7 @@ export const ArticleCtxMenu = (props: { children: ReactElement }) => {
17
18
  const routeParams = useParams();
18
19
  const nav = useNavigate();
19
20
  const title = routeParams.title;
21
+ const dot = useLoadingIndicator();
20
22
 
21
23
  if (!auth) {
22
24
  return props.children;
@@ -27,11 +29,13 @@ export const ArticleCtxMenu = (props: { children: ReactElement }) => {
27
29
  }
28
30
 
29
31
  const doDel = useCallback(() => {
32
+ dot.setVisibility(true);
30
33
  del(title)
31
34
  .then(() => {
32
35
  toast.success("删除成功", {
33
36
  position: "top-center",
34
37
  });
38
+ dot.setVisibility(false);
35
39
  nav("/blog");
36
40
  })
37
41
  .catch(console.log);
@@ -0,0 +1,11 @@
1
+ import { GlobalLoadingContext } from "@/global_loading_state_provider";
2
+ import { useContext } from "react";
3
+
4
+ export const useLoadingIndicator = () => {
5
+ const globalCtx = useContext(GlobalLoadingContext);
6
+
7
+ return {
8
+ setVisibility: globalCtx.setIsLoading,
9
+ isVisible: globalCtx.isLoading,
10
+ };
11
+ };