Skip to content

Commit

Permalink
Added guards
Browse files Browse the repository at this point in the history
  • Loading branch information
moiskillnadne committed Oct 26, 2024
1 parent 7247c13 commit 5846675
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/widget/Challenge/ui/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ export const Calendar = ({ streak, onDayClick, isCompleted }: Props) => {
</div>

<div className="grid grid-cols-7 gap-2 mt-[20px]">
{offset.map((index) => (
<div key={index}></div>
))}
{offset?.map((index) => <div key={index}></div>)}

{daysInMonthArray.map((index) => (
{daysInMonthArray?.map((index) => (
<CalendarDayItem
key={index}
label={index.toString()}
Expand Down
4 changes: 2 additions & 2 deletions src/widget/Challenge/ui/CalendarManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ export const CalendarManager = ({
</div>

<Calendar
streak={progress.map((el) => el.checkpointDate) ?? []}
streak={progress?.map((el) => el.checkpointDate) ?? []}
onDayClick={onDayClick}
isCompleted={!challengeBaseInfo.isActive}
/>

{challengeBaseInfo.isActive ?? (
<Timer streak={progress.map((el) => el.checkpointDate) ?? []} />
<Timer streak={progress?.map((el) => el.checkpointDate) ?? []} />
)}
</div>
);
Expand Down

0 comments on commit 5846675

Please sign in to comment.