-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
119 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
import { type FC } from "react"; | ||
|
||
import { LabsPage as LabsPageTemplate } from "@src/features/labs/labsTable/LabsPage"; | ||
|
||
const LabsPage: FC = () => { | ||
return <LabsPageTemplate />; | ||
}; | ||
|
||
export default LabsPage; | ||
export { LabsPage as default } from "@src/features/labs/labsList/LabsPage"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
packages/slice-machine/src/features/labs/labsList/LabsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { type FC, ReactNode, Suspense } from "react"; | ||
import { | ||
ErrorBoundary, | ||
Box, | ||
ProgressCircle, | ||
DefaultErrorMessage, | ||
} from "@prismicio/editor-ui"; | ||
import Head from "next/head"; | ||
|
||
import { | ||
AppLayout, | ||
AppLayoutBreadcrumb, | ||
AppLayoutContent, | ||
AppLayoutHeader, | ||
} from "@components/AppLayout"; | ||
|
||
import { LabsList } from "./LabsList"; | ||
|
||
export const LabsPage: FC = () => { | ||
return ( | ||
<> | ||
<Head> | ||
<title>Labs - Slice Machine</title> | ||
</Head> | ||
<ErrorBoundary | ||
renderError={() => ( | ||
<LabsPageLayout> | ||
<Box alignItems="center" justifyContent="center"> | ||
<DefaultErrorMessage | ||
title="Request failed" | ||
description="An error occurred while fetching your labs configuration." | ||
/> | ||
</Box> | ||
</LabsPageLayout> | ||
)} | ||
> | ||
<Suspense | ||
fallback={ | ||
<LabsPageLayout withHeader> | ||
<ProgressCircle /> | ||
</LabsPageLayout> | ||
} | ||
> | ||
<LabsPageLayout withHeader> | ||
<LabsList /> | ||
</LabsPageLayout> | ||
</Suspense> | ||
</ErrorBoundary> | ||
</> | ||
); | ||
}; | ||
|
||
type LabsPageLayoutProps = { | ||
children: ReactNode; | ||
withHeader?: boolean; | ||
}; | ||
|
||
const LabsPageLayout: FC<LabsPageLayoutProps> = ({ | ||
children, | ||
withHeader = false, | ||
}) => ( | ||
<AppLayout> | ||
{withHeader ? ( | ||
<AppLayoutHeader> | ||
<AppLayoutBreadcrumb folder="Labs" /> | ||
</AppLayoutHeader> | ||
) : null} | ||
<AppLayoutContent>{children}</AppLayoutContent> | ||
</AppLayout> | ||
); |
10 changes: 5 additions & 5 deletions
10
...e/src/features/labs/labsTable/useLabs.tsx → ...ine/src/features/labs/labsList/useLab.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { SliceMachineConfig } from "@slicemachine/manager"; | ||
import type { SliceMachineConfig } from "@slicemachine/manager"; | ||
|
||
import { useSliceMachineConfig } from "@src/hooks/useSliceMachineConfig"; | ||
|
||
export function useLabs(): Required<SliceMachineConfig>["labs"] { | ||
return useSliceMachineConfig().labs ?? {}; | ||
} | ||
|
||
export function useLab(key: keyof Required<SliceMachineConfig>["labs"]): { | ||
enabled: boolean; | ||
} { | ||
return { enabled: useLabs()[key] ?? false }; | ||
} | ||
|
||
function useLabs(): Required<SliceMachineConfig>["labs"] { | ||
return useSliceMachineConfig().labs ?? {}; | ||
} |
63 changes: 0 additions & 63 deletions
63
packages/slice-machine/src/features/labs/labsTable/LabsPage.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters