Skip to content

Commit

Permalink
Implement confetti and integral problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Arashfa0301 committed Mar 31, 2023
1 parent 3a63488 commit 44c1129
Show file tree
Hide file tree
Showing 11 changed files with 1,378 additions and 30 deletions.
Binary file added app/assets/impossible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/integral.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/ludvig.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/rick-roll.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/warn.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions app/components/SpecialDay/AprilFools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ class AprilFools extends Component<Props, State> {

static isCorrectDate() {
// The year doesn't matter, as it only check month and day of the month
const aprilFoolsDate = moment('2019-04-01');
const aprilFoolsDate = moment('2030-03-29 19:30', 'YYYY-MM-DD HH:mm');
const now = moment();
return (
aprilFoolsDate.date() === now.date() &&
aprilFoolsDate.month() === now.month()
);
return aprilFoolsDate.isBefore(now);
}

onQueueDone() {
Expand Down
121 changes: 121 additions & 0 deletions app/routes/events/components/Event.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,124 @@ html[data-theme='dark'] .eventWarning a {
.chartContainer {
overflow: hidden;
}

.modalBackground {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 1400px;
}

.registerButton {
position: absolute;
transition: 0.5s;
padding: 20px;
}

.pcTitle {
position: fixed;
top: 50%;
left: 25%;
font-size: 50px;
background-image: linear-gradient(
to left,
green,
orange,
red,
green,
orange,
red
);
-webkit-background-clip: text;
color: transparent;

display: none;

@media (--mobile-device) {
display: grid;
}
}

.madeBy {
position: fixed;
width: 500px;
height: 200px;
padding: 10px;
top: 76%;
left: 50%;
margin-top: -100px; /* Negative half of height. */
margin-left: -250px; /* Negative half of width. */
font-size: 16px;
background-image: linear-gradient(
to left,
green,
orange,
red,
green,
orange,
red
);
@media (--mobile-device) {
display: none;
}
-webkit-background-clip: text;
color: transparent;
}

.congrats {
position: fixed;
width: 500px;
height: 200px;
padding: 10px;
top: 60%;
left: 50%;
margin-top: -100px; /* Negative half of height. */
margin-left: -250px; /* Negative half of width. */
font-size: 50px;
background-image: linear-gradient(
to left,
green,
orange,
red,
green,
orange,
red
);
@media (--mobile-device) {
display: none;
}
-webkit-background-clip: text;
color: transparent;
}

.warning1 {
position: fixed;
left: -400px;
top: -400px;
scale: 0.15;
}
.warning2 {
position: fixed;
left: 400px;
top: -400px;
scale: 0.2;
}
.warning3 {
position: fixed;
left: -400px;
top: 400px;
scale: 0.2;
}
.warning4 {
position: fixed;
left: 400px;
top: 400px;
scale: 0.2;
}
.warning5 {
position: fixed;
left: 0px;
top: 0px;
scale: 0.2;
}
69 changes: 45 additions & 24 deletions app/routes/events/components/EventDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
import Admin from '../Admin';
import sharedStyles from '../Event.css';
import JoinEventForm from '../JoinEventForm';
import SpecialJoinEventForm from '../SpecialJoinEventForm';
import RegisteredSummary from '../RegisteredSummary';
import RegistrationMeta from '../RegistrationMeta';
import styles from './EventDetail.css';
Expand Down Expand Up @@ -137,6 +138,12 @@ export default class EventDetail extends Component<Props, State> {
mapIsOpen: false,
};
}
static isCorrectDate() {
// The year doesn't matter, as it only check month and day of the month
const aprilFoolsDate = moment('2023-03-01 11:00', 'YYYY-MM-DD HH:mm');
const now = moment();
return aprilFoolsDate.isBefore(now);
}

handleRegistration = ({
captchaResponse,
Expand Down Expand Up @@ -418,7 +425,6 @@ export default class EventDetail extends Component<Props, State> {
</Button>
)}
</div>

{event.isPriced && (
<TextWithIcon
iconName="cash-outline"
Expand Down Expand Up @@ -466,21 +472,23 @@ export default class EventDetail extends Component<Props, State> {
/>
)}
{loggedIn && (
<RegistrationMeta
useConsent={event.useConsent}
hasOpened={moment(event.activationTime).isBefore(
currentMoment
)}
photoConsents={event.photoConsents}
eventSemester={getEventSemesterFromStartTime(
event.startTime
)}
hasEnded={moment(event.endTime).isBefore(currentMoment)}
registration={currentRegistration}
isPriced={event.isPriced}
registrationIndex={currentRegistrationIndex}
hasSimpleWaitingList={hasSimpleWaitingList}
/>
<>
<RegistrationMeta
useConsent={event.useConsent}
hasOpened={moment(event.activationTime).isBefore(
currentMoment
)}
photoConsents={event.photoConsents}
eventSemester={getEventSemesterFromStartTime(
event.startTime
)}
hasEnded={moment(event.endTime).isBefore(currentMoment)}
registration={currentRegistration}
isPriced={event.isPriced}
registrationIndex={currentRegistrationIndex}
hasSimpleWaitingList={hasSimpleWaitingList}
/>
</>
)}
{event.useContactTracing && !currentRegistration && (
<div>
Expand Down Expand Up @@ -509,6 +517,7 @@ export default class EventDetail extends Component<Props, State> {
Du kan svare på undersøkelsene dine ved å trykke på
følgende linker:
</p>

<ul>
{event.unansweredSurveys.map((surveyId, i) => (
<li key={surveyId}>
Expand All @@ -521,18 +530,30 @@ export default class EventDetail extends Component<Props, State> {
</div>
) : (
<div>
<JoinEventForm
event={event}
registration={currentRegistration}
currentUser={currentUser}
pendingRegistration={pendingRegistration}
createPaymentIntent={this.handlePaymentMethod}
onSubmit={this.handleRegistration}
/>
{EventDetail.isCorrectDate() ? (
<SpecialJoinEventForm
event={event}
registration={currentRegistration}
currentUser={currentUser}
pendingRegistration={pendingRegistration}
createPaymentIntent={this.handlePaymentMethod}
onSubmit={this.handleRegistration}
/>
) : (
<JoinEventForm
event={event}
registration={currentRegistration}
currentUser={currentUser}
pendingRegistration={pendingRegistration}
createPaymentIntent={this.handlePaymentMethod}
onSubmit={this.handleRegistration}
/>
)}
</div>
)}
</Flex>
)}

{deadlines.some((d) => d !== null) && (
<>
<Line />
Expand Down
Loading

0 comments on commit 44c1129

Please sign in to comment.