Skip to content

Commit

Permalink
fix(claims): 🐛 Create Claims fix for undefined images
Browse files Browse the repository at this point in the history
  • Loading branch information
Nudelsuppe42 committed Jun 9, 2024
1 parent 1538ab0 commit 7a975f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/components/map/ClaimDrawerImages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
Group,
Image,
Progress,
rem,
Stack,
Text,
Tooltip,
rem,
} from '@mantine/core';
import {
Dropzone,
Expand Down Expand Up @@ -90,7 +90,8 @@ export function ClaimDrawerImages({ t, ...props }: ClaimDrawerImagesProps) {
});
};

if (props.images.length == 0 && !props.editable) return <></>;
// if(!props.images || props.images?.length)
if (props.images?.length == 0 && !props.editable) return <></>;

return (
<Carousel
Expand All @@ -110,7 +111,7 @@ export function ClaimDrawerImages({ t, ...props }: ClaimDrawerImagesProps) {
h={'auto'}
w="100%"
>
{props.images.map((img, i) => {
{props.images?.map((img, i) => {
return (
<CarouselSlide key={img.id} w="100%" h="100%">
{props.editable && (
Expand Down
8 changes: 4 additions & 4 deletions src/pages/map/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
MenuItem,
MenuTarget,
NumberInput,
rem,
ScrollAreaAutosize,
Select,
Switch,
Expand All @@ -25,9 +24,10 @@ import {
TableTd,
TableTr,
Text,
Textarea,
TextInput,
Textarea,
Tooltip,
rem,
} from '@mantine/core';
import { useClipboard, useDebouncedState } from '@mantine/hooks';
import {
Expand All @@ -52,10 +52,10 @@ import {
import { useEffect, useState } from 'react';

import { useContextMenu } from '@/components/ContextMenu';
import Page from '@/components/Page';
import { ClaimDrawerImages } from '@/components/map/ClaimDrawerImages';
import Map from '@/components/map/Map';
import { MapContextMenu } from '@/components/map/MapContextMenu';
import Page from '@/components/Page';
import { useAccessToken } from '@/hooks/useAccessToken';
import { usePermissions } from '@/hooks/usePermissions';
import { useUser } from '@/hooks/useUser';
Expand Down Expand Up @@ -839,7 +839,7 @@ const ClaimEditPage: NextPage = () => {
setSelected(e.features[0]);
});
map.on('draw.selectionchange', (e) => {
if (e.points.length > 0) return;
if (e.points?.length > 0) return;
setSelected(e.features[0]);
});

Expand Down

0 comments on commit 7a975f3

Please sign in to comment.