zudoku 0.1.1-dev.43 → 0.1.1-dev.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.1.1-dev.43",
3
+ "version": "0.1.1-dev.44",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -7,7 +7,7 @@ import { Header } from "./Header.js";
7
7
  import { useDevPortal } from "./context/DevPortalProvider.js";
8
8
  import { useViewportAnchor } from "./context/ViewportAnchorContext.js";
9
9
  import { SideNavigation } from "./navigation/SideNavigation.js";
10
- import { SideNavigationWrapper } from "./navigation/SideNavigationWrapper.js";
10
+ import { Spinner } from "./Spinner.js";
11
11
 
12
12
  export const Layout = ({ children }: { children?: ReactNode }) => {
13
13
  const location = useLocation();
@@ -42,8 +42,14 @@ export const Layout = ({ children }: { children?: ReactNode }) => {
42
42
  </Helmet>
43
43
  <Header />
44
44
 
45
- <div className="max-w-screen-2xl mx-auto pt-[--header-height] px-10 lg:px-12">
46
- <Suspense fallback={<div />}>
45
+ <div className="max-w-screen-2xl mx-auto pt-[--header-height] px-10 lg:px-12 h-full">
46
+ <Suspense
47
+ fallback={
48
+ <div className="grid h-full place-items-center">
49
+ <Spinner />
50
+ </div>
51
+ }
52
+ >
47
53
  <SideNavigation />
48
54
  <main
49
55
  className="dark:border-white/10 translate-x-0
@@ -0,0 +1,5 @@
1
+ import { LoaderCircle } from "lucide-react";
2
+
3
+ export const Spinner = ({ size = 16 }: { size?: number }) => (
4
+ <LoaderCircle size={size} className="animate-spin" />
5
+ );
@@ -11,7 +11,7 @@ export const SideNavigation = () => {
11
11
  return (
12
12
  <SideNavigationWrapper
13
13
  ref={navRef}
14
- data={navigation.data.items.length > 0 ? "true" : "false"}
14
+ pushMainContent={navigation.data.items.length > 0}
15
15
  >
16
16
  {navigation.data.items.map((category) => (
17
17
  <SideNavigationCategory key={category.label} category={category} />
@@ -3,10 +3,14 @@ import { cn } from "../../util/cn.js";
3
3
 
4
4
  export const SideNavigationWrapper = forwardRef<
5
5
  HTMLDivElement,
6
- PropsWithChildren<{ data?: string; className?: string }>
7
- >(({ children, className, data }, ref) => (
6
+ PropsWithChildren<{ pushMainContent?: boolean; className?: string }>
7
+ >(({ children, className, pushMainContent }, ref) => (
8
8
  <nav
9
- data-navigation={data}
9
+ // this data attribute is used in `Layout.tsx` to determine if side navigation
10
+ // is present for the current page so the main content is pushed to the right
11
+ // it's also important to set `peer` class here.
12
+ // maybe this could be simplified by adjusting the layout
13
+ data-navigation={String(pushMainContent)}
10
14
  className={cn(
11
15
  "peer hidden lg:flex flex-col fixed text-sm overflow-y-auto shrink-0 p-[--padding-nav-item] -mx-[--padding-nav-item] pb-20 pt-[--padding-content-top] w-[--side-nav-width] h-[calc(100%-var(--header-height))] scroll-pt-2 gap-2",
12
16
  className,
@@ -72,12 +72,15 @@ const AllOperationsQuery = graphql(/* GraphQL */ `
72
72
  }
73
73
  `);
74
74
 
75
+ const suspenseContext = { suspense: true };
76
+
75
77
  export const OperationList = () => {
76
78
  const { type, input } = useOasConfig();
77
79
 
78
80
  const [result] = useQuery({
79
81
  query: AllOperationsQuery,
80
82
  variables: { type, input },
83
+ context: suspenseContext,
81
84
  });
82
85
 
83
86
  if (!result.data) return null;
@@ -21,6 +21,7 @@ import { CirclePlayIcon, LoaderCircle, MonitorCheckIcon } from "lucide-react";
21
21
  import { createUrl } from "./createUrl.js";
22
22
  import { UrlDisplay } from "./UrlDisplay.js";
23
23
  import { useApiIdentities } from "../../../components/context/DevPortalProvider.js";
24
+ import { Spinner } from "../../../components/Spinner.js";
24
25
 
25
26
  function mimeTypeToLanguage(mimeType: string) {
26
27
  const mimeTypeMapping = {
@@ -305,7 +306,7 @@ const Playground = ({
305
306
  <div className="grid place-items-center h-full">
306
307
  <span className="text-[16px] font-semibold text-muted-foreground">
307
308
  {queryMutation.isPending ? (
308
- <LoaderCircle size={18} className="animate-spin" />
309
+ <Spinner />
309
310
  ) : (
310
311
  "Send a request first to see the response here"
311
312
  )}