Skip to content

Commit

Permalink
fix slots rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloose committed Nov 18, 2024
1 parent 7dabf19 commit acb28b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions app/src/pages/Editor/components/GalleryCanvas2D.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { PictureSlot } from './blocks/PictureSlot';
import { useEditorStore } from '@/stores/editorAction';
import { setCursor } from '@/utils';
import { useApi } from '@/hooks/useApi';
import { GenericGalleryBlock, isDoorBlock, isModel3DBlock, isWallBlock, PictureSlotProps } from '@/types';
import { GenericGalleryBlock, isDoorBlock, isModel3DBlock, isPictureSlotBlock, isWallBlock, PictureSlotProps } from '@/types';

export const GalleryCanvas2D = ({ gallery }: { gallery: string }) => {
const [viewport, setViewport] = useState({ x: 0, y: 0 });
Expand Down Expand Up @@ -167,8 +167,7 @@ export const GalleryCanvas2D = ({ gallery }: { gallery: string }) => {
<Layer>
{
blocks.map((item, index) => {
if (isWallBlock(item)) {
return null;
if (isPictureSlotBlock(item)) {
return <PictureSlot key={index} block={item as PictureSlotProps} />;
}
if (isModel3DBlock(item)) {
Expand Down
7 changes: 2 additions & 5 deletions app/src/pages/Editor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { Suspense, useState } from 'react';
import { useState } from 'react';
import { UserButton } from '@/components/UserButton';
import { DynamicText } from '@/components/DynamicText';
import { GalleryCanvas2D } from './components/GalleryCanvas';
import { GalleryCanvas2D } from './components/GalleryCanvas2D';
import { MenuBurger } from './components/MenuBurger';
import { MainButtons } from './components/MainButtons';
import { EditorSidebar } from './components/ContentSidebar';
import { DRAG_PORTAL_ID } from './components/constants';
import { useLocation } from 'wouter';
import { Modal } from '@mantine/core';
import { Gallery3D } from '../Gallery3D';

export const Editor = ({ gallery }: { gallery: string }) => {
const [projectName, setProjectName] = useState('Nueva galería');
const [location, setLocation] = useLocation();
const [previewOpened, setPreviewOpened] = useState(false);

return (
Expand Down
4 changes: 4 additions & 0 deletions app/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export const isWallBlock = (block: GenericGalleryBlock): block is WallBlockProps
return block.type === 'wall';
};

export const isPictureSlotBlock = (block: GenericGalleryBlock): block is WallBlockProps => {
return block.type === 'wall' && block.props.res !== null;
};

export const isModel3DBlock = (block: GenericGalleryBlock): block is Model3DBlockProps => {
return block.type === 'model3d';
};
Expand Down

0 comments on commit acb28b4

Please sign in to comment.