Skip to content

Commit

Permalink
Fixes in logic
Browse files Browse the repository at this point in the history
  • Loading branch information
aweell committed Nov 26, 2024
1 parent d3869fa commit 32c778d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/pages/advent-calendar-2024/components/calendar-card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,20 @@ const CalendarCard = ({
const handleEndDay = () => {
dialogRef.current.close();
document.body.style.overflow = "auto";

onEndDay(); // Notify the parent to update the state
};

const handleCloseModal = () => {
dialogRef.current.close(); // Close the modal
document.body.style.overflow = "auto";

onEndDay(); // Notify the parent to update the state
};

const handleDismiss = () => {
dialogRef.current.close();
document.body.style.overflow = "auto";
};

let cardStatusStyles;

switch (status) {
Expand Down Expand Up @@ -254,7 +257,7 @@ const CalendarCard = ({
: content
}
onClose={handleEndDay}
onCancel={repeatable ? handleEndDay : null}
onCancel={repeatable ? handleEndDay : handleDismiss}
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/advent-calendar-2024/components/modal-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { DecorationSnake } from "../assets/decorations/decorations";

const ModalView = forwardRef(
({ title, day, dayOfWeek, description, content, onCancel }, ref) => {
({ title, day, dayOfWeek, description, content, onCancel, repeatable }, ref) => {
const { isMobile } = useScreenSize();

return (
Expand Down
3 changes: 1 addition & 2 deletions src/pages/advent-calendar-2024/utils/achievement-config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export const achievementsConfig = [
name: "Advent Champion",
description: "Unlock all days in the advent calendar",
icon: IconSnowflakeRegular,
check: (newCompletedDays) =>
newCompletedDays.length === TOTAL_CALENDAR_DAYS,
check: (newCompletedDays) => newCompletedDays.length === 18,
message: "You have unlocked all days!",
isSecret: true,
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/advent-calendar-2024/utils/constants.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const RELEASE_DATE = "2024-10-25T00:00:01";

export const TOTAL_CALENDAR_DAYS = 18;
export const TOTAL_CALENDAR_DAYS = 24;

export const CARD_STATES = {
COMPLETED: "completed",
Expand Down

0 comments on commit 32c778d

Please sign in to comment.