From b551fc44ead5894012af896032761f17b57f23cc Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Tue, 21 Nov 2023 19:26:55 +0600 Subject: [PATCH] refactored lab --- src/components/lab/LabLine/index.tsx | 16 ---------- src/components/lab/LabLine/styles.module.scss | 7 ----- src/constants/node/index.ts | 21 ------------- .../components}/LabNoResults/index.tsx | 0 .../LabNoResults/styles.module.scss | 0 .../components}/LabAudioBlock/index.tsx | 0 .../components}/LabBottomPanel/index.tsx | 0 .../LabBottomPanel/styles.module.scss | 0 .../components}/LabDescription/index.tsx | 0 .../LabDescription/styles.module.scss | 0 .../LabNode/components}/LabImage/index.tsx | 0 .../components}/LabImage/styles.module.scss | 0 .../components}/LabNodeTitle/index.tsx | 0 .../LabNodeTitle/styles.module.scss | 0 .../LabNode/components}/LabPad/index.tsx | 0 .../components}/LabPad/styles.module.scss | 0 .../LabNode/components}/LabText/index.tsx | 0 .../components}/LabText/styles.module.scss | 0 .../LabNode/components}/LabVideo/index.tsx | 0 .../components/LabNode/constants/index.ts | 26 ++++++++++++++++ .../LabNode/hooks/useLabNodeBlocks.ts | 31 +++++++++++++++++++ .../lab/LabGrid/components}/LabNode/index.tsx | 13 ++++---- .../components}/LabNode/styles.module.scss | 0 src/containers/lab/LabGrid/index.tsx | 4 +-- .../lab/LabHead/index.tsx | 0 .../lab/LabHead/styles.module.scss | 0 src/containers/lab/LabLoading/index.tsx | 3 +- .../LabBanner/components}/LabSquare/index.tsx | 0 .../components}/LabSquare/styles.module.scss | 0 .../LabStats/components}/LabBanner/index.tsx | 8 ++--- .../components}/LabBanner/styles.module.scss | 0 .../components}/LabFactoryBanner/index.tsx | 0 .../LabFactoryBanner/styles.module.scss | 0 .../LabHeroes/components}/LabHero/index.tsx | 4 +-- .../components}/LabHero/styles.module.scss | 0 .../LabStats/components}/LabHeroes/index.tsx | 3 +- .../LabStats/components}/LabTags/index.tsx | 2 +- .../components}/LabTags/styles.module.scss | 0 src/containers/lab/LabStats/index.tsx | 6 ++-- src/hooks/node/useNodeBlocks.ts | 13 +------- src/layouts/LabLayout/index.tsx | 2 +- 41 files changed, 80 insertions(+), 79 deletions(-) delete mode 100644 src/components/lab/LabLine/index.tsx delete mode 100644 src/components/lab/LabLine/styles.module.scss rename src/{components/lab => containers/lab/LabGrid/components}/LabNoResults/index.tsx (100%) rename src/{components/lab => containers/lab/LabGrid/components}/LabNoResults/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabAudioBlock/index.tsx (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabBottomPanel/index.tsx (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabBottomPanel/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabDescription/index.tsx (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabDescription/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabImage/index.tsx (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabImage/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabNodeTitle/index.tsx (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabNodeTitle/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabPad/index.tsx (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabPad/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabText/index.tsx (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabText/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabGrid/components/LabNode/components}/LabVideo/index.tsx (100%) create mode 100644 src/containers/lab/LabGrid/components/LabNode/constants/index.ts create mode 100644 src/containers/lab/LabGrid/components/LabNode/hooks/useLabNodeBlocks.ts rename src/{components/lab => containers/lab/LabGrid/components}/LabNode/index.tsx (76%) rename src/{components/lab => containers/lab/LabGrid/components}/LabNode/styles.module.scss (100%) rename src/{components => containers}/lab/LabHead/index.tsx (100%) rename src/{components => containers}/lab/LabHead/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabStats/components/LabBanner/components}/LabSquare/index.tsx (100%) rename src/{components/lab => containers/lab/LabStats/components/LabBanner/components}/LabSquare/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabStats/components}/LabBanner/index.tsx (80%) rename src/{components/lab => containers/lab/LabStats/components}/LabBanner/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabStats/components}/LabFactoryBanner/index.tsx (100%) rename src/{components/lab => containers/lab/LabStats/components}/LabFactoryBanner/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabStats/components/LabHeroes/components}/LabHero/index.tsx (95%) rename src/{components/lab => containers/lab/LabStats/components/LabHeroes/components}/LabHero/styles.module.scss (100%) rename src/{components/lab => containers/lab/LabStats/components}/LabHeroes/index.tsx (93%) rename src/{components/lab => containers/lab/LabStats/components}/LabTags/index.tsx (95%) rename src/{components/lab => containers/lab/LabStats/components}/LabTags/styles.module.scss (100%) diff --git a/src/components/lab/LabLine/index.tsx b/src/components/lab/LabLine/index.tsx deleted file mode 100644 index 2c22c1d6..00000000 --- a/src/components/lab/LabLine/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { FC } from 'react'; - -import { NodeComponentProps } from '~/constants/node'; -import { useColorGradientFromString } from '~/hooks/color/useColorGradientFromString'; - -import styles from './styles.module.scss'; - -interface Props extends NodeComponentProps {} - -const LabLine: FC = ({ node: { title } }) => { - const background = useColorGradientFromString(title, 5, 3, 270); - - return
; -}; - -export { LabLine }; diff --git a/src/components/lab/LabLine/styles.module.scss b/src/components/lab/LabLine/styles.module.scss deleted file mode 100644 index 803f416b..00000000 --- a/src/components/lab/LabLine/styles.module.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "src/styles/variables"; - -.line { - height: 4px; - border-radius: $radius $radius 0 0; - width: 100%; -} diff --git a/src/constants/node/index.ts b/src/constants/node/index.ts index 5eaf9d1e..9543b27e 100644 --- a/src/constants/node/index.ts +++ b/src/constants/node/index.ts @@ -1,12 +1,5 @@ import { FC } from 'react'; -import { LabAudio } from '~/components/lab/LabAudioBlock'; -import { LabDescription } from '~/components/lab/LabDescription'; -import { LabImage } from '~/components/lab/LabImage'; -import { LabNodeTitle } from '~/components/lab/LabNodeTitle'; -import { LabPad } from '~/components/lab/LabPad'; -import { LabText } from '~/components/lab/LabText'; -import { LabVideo } from '~/components/lab/LabVideo'; import { NodeAudioBlock } from '~/components/node/NodeAudioBlock'; import { NodeAudioImageBlock } from '~/components/node/NodeAudioImageBlock'; import { NodeImageSwiperBlock } from '~/components/node/NodeImageSwiperBlock'; @@ -52,20 +45,6 @@ export type INodeComponents = Record< FC >; -export const LAB_PREVIEW_LAYOUT: Record[]> = { - [NODE_TYPES.IMAGE]: [LabImage, LabPad, LabNodeTitle, LabDescription], - [NODE_TYPES.VIDEO]: [LabVideo, LabPad, LabNodeTitle, LabDescription], - [NODE_TYPES.AUDIO]: [ - LabPad, - LabNodeTitle, - LabPad, - NodeAudioImageBlock, - LabAudio, - LabPad, - ], - [NODE_TYPES.TEXT]: [LabPad, LabNodeTitle, LabPad, LabText, LabPad], -}; - export const NODE_HEADS: INodeComponents = { [NODE_TYPES.IMAGE]: NodeImageSwiperBlock, }; diff --git a/src/components/lab/LabNoResults/index.tsx b/src/containers/lab/LabGrid/components/LabNoResults/index.tsx similarity index 100% rename from src/components/lab/LabNoResults/index.tsx rename to src/containers/lab/LabGrid/components/LabNoResults/index.tsx diff --git a/src/components/lab/LabNoResults/styles.module.scss b/src/containers/lab/LabGrid/components/LabNoResults/styles.module.scss similarity index 100% rename from src/components/lab/LabNoResults/styles.module.scss rename to src/containers/lab/LabGrid/components/LabNoResults/styles.module.scss diff --git a/src/components/lab/LabAudioBlock/index.tsx b/src/containers/lab/LabGrid/components/LabNode/components/LabAudioBlock/index.tsx similarity index 100% rename from src/components/lab/LabAudioBlock/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/components/LabAudioBlock/index.tsx diff --git a/src/components/lab/LabBottomPanel/index.tsx b/src/containers/lab/LabGrid/components/LabNode/components/LabBottomPanel/index.tsx similarity index 100% rename from src/components/lab/LabBottomPanel/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/components/LabBottomPanel/index.tsx diff --git a/src/components/lab/LabBottomPanel/styles.module.scss b/src/containers/lab/LabGrid/components/LabNode/components/LabBottomPanel/styles.module.scss similarity index 100% rename from src/components/lab/LabBottomPanel/styles.module.scss rename to src/containers/lab/LabGrid/components/LabNode/components/LabBottomPanel/styles.module.scss diff --git a/src/components/lab/LabDescription/index.tsx b/src/containers/lab/LabGrid/components/LabNode/components/LabDescription/index.tsx similarity index 100% rename from src/components/lab/LabDescription/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/components/LabDescription/index.tsx diff --git a/src/components/lab/LabDescription/styles.module.scss b/src/containers/lab/LabGrid/components/LabNode/components/LabDescription/styles.module.scss similarity index 100% rename from src/components/lab/LabDescription/styles.module.scss rename to src/containers/lab/LabGrid/components/LabNode/components/LabDescription/styles.module.scss diff --git a/src/components/lab/LabImage/index.tsx b/src/containers/lab/LabGrid/components/LabNode/components/LabImage/index.tsx similarity index 100% rename from src/components/lab/LabImage/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/components/LabImage/index.tsx diff --git a/src/components/lab/LabImage/styles.module.scss b/src/containers/lab/LabGrid/components/LabNode/components/LabImage/styles.module.scss similarity index 100% rename from src/components/lab/LabImage/styles.module.scss rename to src/containers/lab/LabGrid/components/LabNode/components/LabImage/styles.module.scss diff --git a/src/components/lab/LabNodeTitle/index.tsx b/src/containers/lab/LabGrid/components/LabNode/components/LabNodeTitle/index.tsx similarity index 100% rename from src/components/lab/LabNodeTitle/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/components/LabNodeTitle/index.tsx diff --git a/src/components/lab/LabNodeTitle/styles.module.scss b/src/containers/lab/LabGrid/components/LabNode/components/LabNodeTitle/styles.module.scss similarity index 100% rename from src/components/lab/LabNodeTitle/styles.module.scss rename to src/containers/lab/LabGrid/components/LabNode/components/LabNodeTitle/styles.module.scss diff --git a/src/components/lab/LabPad/index.tsx b/src/containers/lab/LabGrid/components/LabNode/components/LabPad/index.tsx similarity index 100% rename from src/components/lab/LabPad/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/components/LabPad/index.tsx diff --git a/src/components/lab/LabPad/styles.module.scss b/src/containers/lab/LabGrid/components/LabNode/components/LabPad/styles.module.scss similarity index 100% rename from src/components/lab/LabPad/styles.module.scss rename to src/containers/lab/LabGrid/components/LabNode/components/LabPad/styles.module.scss diff --git a/src/components/lab/LabText/index.tsx b/src/containers/lab/LabGrid/components/LabNode/components/LabText/index.tsx similarity index 100% rename from src/components/lab/LabText/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/components/LabText/index.tsx diff --git a/src/components/lab/LabText/styles.module.scss b/src/containers/lab/LabGrid/components/LabNode/components/LabText/styles.module.scss similarity index 100% rename from src/components/lab/LabText/styles.module.scss rename to src/containers/lab/LabGrid/components/LabNode/components/LabText/styles.module.scss diff --git a/src/components/lab/LabVideo/index.tsx b/src/containers/lab/LabGrid/components/LabNode/components/LabVideo/index.tsx similarity index 100% rename from src/components/lab/LabVideo/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/components/LabVideo/index.tsx diff --git a/src/containers/lab/LabGrid/components/LabNode/constants/index.ts b/src/containers/lab/LabGrid/components/LabNode/constants/index.ts new file mode 100644 index 00000000..db35391f --- /dev/null +++ b/src/containers/lab/LabGrid/components/LabNode/constants/index.ts @@ -0,0 +1,26 @@ +import { FC } from 'react'; + +import { NodeAudioImageBlock } from '~/components/node/NodeAudioImageBlock'; +import { NODE_TYPES, NodeComponentProps } from '~/constants/node'; + +import { LabAudio } from '../components/LabAudioBlock'; +import { LabDescription } from '../components/LabDescription'; +import { LabImage } from '../components/LabImage'; +import { LabNodeTitle } from '../components/LabNodeTitle'; +import { LabPad } from '../components/LabPad'; +import { LabText } from '../components/LabText'; +import { LabVideo } from '../components/LabVideo'; + +export const LAB_PREVIEW_LAYOUT: Record[]> = { + [NODE_TYPES.IMAGE]: [LabImage, LabPad, LabNodeTitle, LabDescription], + [NODE_TYPES.VIDEO]: [LabVideo, LabPad, LabNodeTitle, LabDescription], + [NODE_TYPES.AUDIO]: [ + LabPad, + LabNodeTitle, + LabPad, + NodeAudioImageBlock, + LabAudio, + LabPad, + ], + [NODE_TYPES.TEXT]: [LabPad, LabNodeTitle, LabPad, LabText, LabPad], +}; diff --git a/src/containers/lab/LabGrid/components/LabNode/hooks/useLabNodeBlocks.ts b/src/containers/lab/LabGrid/components/LabNode/hooks/useLabNodeBlocks.ts new file mode 100644 index 00000000..1f8f471f --- /dev/null +++ b/src/containers/lab/LabGrid/components/LabNode/hooks/useLabNodeBlocks.ts @@ -0,0 +1,31 @@ +import { createElement, FC, useCallback, useMemo } from 'react'; + +import { NodeComponentProps } from '~/constants/node'; +import { INode } from '~/types'; +import { isNil, prop } from '~/utils/ramda'; + +import { LAB_PREVIEW_LAYOUT } from '../constants'; + +// useNodeBlocks returns head, block and inline blocks of node +export const useLabNodeBlocks = (node: INode, isLoading: boolean) => { + const createBlock = useCallback( + (block?: FC, key = 0) => + !isNil(block) && + createElement(block, { + node, + isLoading, + key: `${node.id}-${key}`, + }), + [node, isLoading], + ); + + return useMemo( + () => + node?.type && prop(node.type, LAB_PREVIEW_LAYOUT) + ? prop(node.type, LAB_PREVIEW_LAYOUT).map((comp, i) => + createBlock(comp, i), + ) + : undefined, + [node, createBlock], + ); +}; diff --git a/src/components/lab/LabNode/index.tsx b/src/containers/lab/LabGrid/components/LabNode/index.tsx similarity index 76% rename from src/components/lab/LabNode/index.tsx rename to src/containers/lab/LabGrid/components/LabNode/index.tsx index e75b4586..2193e336 100644 --- a/src/components/lab/LabNode/index.tsx +++ b/src/containers/lab/LabGrid/components/LabNode/index.tsx @@ -3,22 +3,22 @@ import { FC, useMemo } from 'react'; import classNames from 'classnames'; import { isAfter, parseISO } from 'date-fns'; -import { LabBottomPanel } from '~/components/lab/LabBottomPanel'; import { useColorGradientFromString } from '~/hooks/color/useColorGradientFromString'; -import { useNodeBlocks } from '~/hooks/node/useNodeBlocks'; import { INode } from '~/types'; +import { LabBottomPanel } from './components/LabBottomPanel'; +import { useLabNodeBlocks } from './hooks/useLabNodeBlocks'; import styles from './styles.module.scss'; -interface IProps { +interface Props { node: INode; lastSeen: string | null | undefined; isLoading?: boolean; commentCount: number; } -const LabNode: FC = ({ node, isLoading, lastSeen, commentCount }) => { - const { lab } = useNodeBlocks(node, !!isLoading); +const LabNode: FC = ({ node, isLoading, lastSeen, commentCount }) => { + const blocks = useLabNodeBlocks(node, !!isLoading); const hasNewComments = useMemo( () => @@ -32,7 +32,8 @@ const LabNode: FC = ({ node, isLoading, lastSeen, commentCount }) => { return (
- {lab} + {blocks} + diff --git a/src/components/lab/LabSquare/index.tsx b/src/containers/lab/LabStats/components/LabBanner/components/LabSquare/index.tsx similarity index 100% rename from src/components/lab/LabSquare/index.tsx rename to src/containers/lab/LabStats/components/LabBanner/components/LabSquare/index.tsx diff --git a/src/components/lab/LabSquare/styles.module.scss b/src/containers/lab/LabStats/components/LabBanner/components/LabSquare/styles.module.scss similarity index 100% rename from src/components/lab/LabSquare/styles.module.scss rename to src/containers/lab/LabStats/components/LabBanner/components/LabSquare/styles.module.scss diff --git a/src/components/lab/LabBanner/index.tsx b/src/containers/lab/LabStats/components/LabBanner/index.tsx similarity index 80% rename from src/components/lab/LabBanner/index.tsx rename to src/containers/lab/LabStats/components/LabBanner/index.tsx index 6c2f90b5..2e6cb2e1 100644 --- a/src/components/lab/LabBanner/index.tsx +++ b/src/containers/lab/LabStats/components/LabBanner/index.tsx @@ -1,13 +1,9 @@ -import { FC } from 'react'; - import { Group } from '~/components/common/Group'; -import { LabSquare } from '~/components/lab/LabSquare'; +import { LabSquare } from './components/LabSquare'; import styles from './styles.module.scss'; -interface IProps {} - -const LabBanner: FC = () => ( +const LabBanner = () => (
Лаборатория!
diff --git a/src/components/lab/LabBanner/styles.module.scss b/src/containers/lab/LabStats/components/LabBanner/styles.module.scss similarity index 100% rename from src/components/lab/LabBanner/styles.module.scss rename to src/containers/lab/LabStats/components/LabBanner/styles.module.scss diff --git a/src/components/lab/LabFactoryBanner/index.tsx b/src/containers/lab/LabStats/components/LabFactoryBanner/index.tsx similarity index 100% rename from src/components/lab/LabFactoryBanner/index.tsx rename to src/containers/lab/LabStats/components/LabFactoryBanner/index.tsx diff --git a/src/components/lab/LabFactoryBanner/styles.module.scss b/src/containers/lab/LabStats/components/LabFactoryBanner/styles.module.scss similarity index 100% rename from src/components/lab/LabFactoryBanner/styles.module.scss rename to src/containers/lab/LabStats/components/LabFactoryBanner/styles.module.scss diff --git a/src/components/lab/LabHero/index.tsx b/src/containers/lab/LabStats/components/LabHeroes/components/LabHero/index.tsx similarity index 95% rename from src/components/lab/LabHero/index.tsx rename to src/containers/lab/LabStats/components/LabHeroes/components/LabHero/index.tsx index ed836f03..cf506f7f 100644 --- a/src/components/lab/LabHero/index.tsx +++ b/src/containers/lab/LabStats/components/LabHeroes/components/LabHero/index.tsx @@ -10,12 +10,12 @@ import { getPrettyDate } from '~/utils/dom'; import styles from './styles.module.scss'; -interface IProps { +interface Props { node?: Partial; isLoading?: boolean; } -const LabHero: FC = ({ node, isLoading }) => { +const LabHero: FC = ({ node, isLoading }) => { const { push } = useNavigation(); const onClick = useCallback(() => { push(URLS.NODE_URL(node?.id)); diff --git a/src/components/lab/LabHero/styles.module.scss b/src/containers/lab/LabStats/components/LabHeroes/components/LabHero/styles.module.scss similarity index 100% rename from src/components/lab/LabHero/styles.module.scss rename to src/containers/lab/LabStats/components/LabHeroes/components/LabHero/styles.module.scss diff --git a/src/components/lab/LabHeroes/index.tsx b/src/containers/lab/LabStats/components/LabHeroes/index.tsx similarity index 93% rename from src/components/lab/LabHeroes/index.tsx rename to src/containers/lab/LabStats/components/LabHeroes/index.tsx index 2cbcb053..61322fc9 100644 --- a/src/components/lab/LabHeroes/index.tsx +++ b/src/containers/lab/LabStats/components/LabHeroes/index.tsx @@ -1,10 +1,11 @@ import { FC } from 'react'; import { Group } from '~/components/common/Group'; -import { LabHero } from '~/components/lab/LabHero'; import styles from '~/containers/lab/LabStats/styles.module.scss'; import { INode } from '~/types'; +import { LabHero } from './components/LabHero'; + interface IProps { nodes: Partial[]; isLoading: boolean; diff --git a/src/components/lab/LabTags/index.tsx b/src/containers/lab/LabStats/components/LabTags/index.tsx similarity index 95% rename from src/components/lab/LabTags/index.tsx rename to src/containers/lab/LabStats/components/LabTags/index.tsx index d860dd62..6b96d816 100644 --- a/src/components/lab/LabTags/index.tsx +++ b/src/containers/lab/LabStats/components/LabTags/index.tsx @@ -4,7 +4,7 @@ import { Placeholder } from '~/components/placeholders/Placeholder'; import { Tag } from '~/components/tags/Tag'; import { ITag } from '~/types'; -import styles from './/styles.module.scss'; +import styles from './styles.module.scss'; interface IProps { tags: ITag[]; diff --git a/src/components/lab/LabTags/styles.module.scss b/src/containers/lab/LabStats/components/LabTags/styles.module.scss similarity index 100% rename from src/components/lab/LabTags/styles.module.scss rename to src/containers/lab/LabStats/components/LabTags/styles.module.scss diff --git a/src/containers/lab/LabStats/index.tsx b/src/containers/lab/LabStats/index.tsx index 08ce2e98..29372828 100644 --- a/src/containers/lab/LabStats/index.tsx +++ b/src/containers/lab/LabStats/index.tsx @@ -3,11 +3,11 @@ import { FC } from 'react'; import { Group } from '~/components/common/Group'; import { NodeHorizontalCard } from '~/components/common/NodeHorizontalCard'; import { SubTitle } from '~/components/common/SubTitle'; -import { LabFactoryBanner } from '~/components/lab/LabFactoryBanner'; -import { LabHeroes } from '~/components/lab/LabHeroes'; -import { LabTags } from '~/components/lab/LabTags'; +import { LabHeroes } from '~/containers/lab/LabStats/components/LabHeroes'; import { useLabContext } from '~/utils/context/LabContextProvider'; +import { LabFactoryBanner } from './components/LabFactoryBanner'; +import { LabTags } from './components/LabTags'; import styles from './styles.module.scss'; interface IProps {} diff --git a/src/hooks/node/useNodeBlocks.ts b/src/hooks/node/useNodeBlocks.ts index 5cf1f4d5..003a463c 100644 --- a/src/hooks/node/useNodeBlocks.ts +++ b/src/hooks/node/useNodeBlocks.ts @@ -2,7 +2,6 @@ import { createElement, FC, useCallback, useMemo } from 'react'; import { NodeComponentProps, - LAB_PREVIEW_LAYOUT, NODE_COMPONENTS, NODE_HEADS, NODE_INLINES, @@ -43,15 +42,5 @@ export const useNodeBlocks = (node: INode, isLoading: boolean) => { [node, createNodeBlock], ); - const lab = useMemo( - () => - node?.type && prop(node.type, LAB_PREVIEW_LAYOUT) - ? prop(node.type, LAB_PREVIEW_LAYOUT).map((comp, i) => - createNodeBlock(comp, i), - ) - : undefined, - [node, createNodeBlock], - ); - - return { head, block, inline, lab }; + return { head, block, inline }; }; diff --git a/src/layouts/LabLayout/index.tsx b/src/layouts/LabLayout/index.tsx index 6944cd6f..65800ba3 100644 --- a/src/layouts/LabLayout/index.tsx +++ b/src/layouts/LabLayout/index.tsx @@ -2,8 +2,8 @@ import { FC } from 'react'; import { Group } from '~/components/common/Group'; import { Sticky } from '~/components/common/Sticky'; -import { LabHead } from '~/components/lab/LabHead'; import { LabGrid } from '~/containers/lab/LabGrid'; +import { LabHead } from '~/containers/lab/LabHead'; import { LabLoading } from '~/containers/lab/LabLoading'; import { LabStats } from '~/containers/lab/LabStats'; import { Container } from '~/containers/main/Container';