-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : register only app implementation
- Loading branch information
1 parent
a915837
commit 5c1f805
Showing
14 changed files
with
365 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import styles from "./LoginButton.module.css"; | ||
import React from "react"; | ||
import googleIcon from "../../../assets/google.png"; | ||
|
||
interface LogoutButtonProps { | ||
onClick: () => void; | ||
text: String; | ||
iconVisible: boolean; | ||
} | ||
const LogoutButton: React.FC<LogoutButtonProps> = ({ | ||
onClick, | ||
text, | ||
iconVisible, | ||
}) => { | ||
return ( | ||
<div onClick={onClick} className={styles.loginButton}> | ||
{iconVisible && ( | ||
<div className={styles.icon}> | ||
<img src={googleIcon} /> | ||
</div> | ||
)} | ||
<div className={styles.text}> | ||
<span>{text}</span> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LogoutButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.eventCard { | ||
width: calc(100% - 60px); | ||
min-height: 100px; | ||
background: #15252c; | ||
border-radius: 10px; | ||
padding: 10px 20px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin: 10px; | ||
.left { | ||
.time { | ||
font-size: 13px; | ||
color: #747c80; | ||
} | ||
.description { | ||
font-size: 12px; | ||
} | ||
} | ||
.right { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import style from "./EventCardSmall.module.css"; | ||
import { _Event } from "../../utils/types"; | ||
import { registerEvent } from "../../apis/eventApi"; | ||
import { useLoader } from "../toploader/useLoader"; | ||
import { useToast } from "../toast/useToast"; | ||
import { useState, useEffect } from "react"; | ||
import { ResponseStatus } from "../../apis/api"; | ||
interface EventCardSmallProps { | ||
event: _Event; | ||
} | ||
|
||
const EventCardSmall: React.FC<EventCardSmallProps> = ({ event }) => { | ||
var { addLoader } = useLoader(); | ||
var { setToastStatus } = useToast(); | ||
const [buttonText, setButtonText] = useState<string>("Register"); | ||
|
||
useEffect(() => { | ||
console.log(event); | ||
if (event.closed) setButtonText("Registration Closed"); | ||
else if (!event.is_reg) setButtonText("OPEN"); | ||
else if (event.participate_in) setButtonText("Registered"); | ||
// else if (event.gctian_only) | ||
// setButtonText("You cant register for this event"); | ||
else setButtonText("Register"); | ||
}, []); | ||
return ( | ||
<div className={style.eventCard}> | ||
<div className={style.left}> | ||
<p className={style.time}> | ||
{event.date}, {event.time} | ||
</p> | ||
<h3>{event.name}</h3> | ||
<p className={style.description}>{event.description}</p> | ||
</div> | ||
<div className={style.right}> | ||
<a | ||
onClick={async () => { | ||
if (!event.closed && event.is_reg && !event.participate_in) { | ||
var res = await registerEvent( | ||
event.id, | ||
addLoader, | ||
setToastStatus | ||
); | ||
res.status == ResponseStatus.SUCCESS && | ||
setButtonText("Registered"); | ||
} | ||
}} | ||
href="#" | ||
className={ | ||
"primary-button" + | ||
(!event.closed && event.is_reg && !event.participate_in | ||
? " clr2" | ||
: " clr1") | ||
} | ||
> | ||
{buttonText} | ||
</a> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EventCardSmall; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import style from "./EventListSmall.module.css"; | ||
import { useEffect, useState } from "react"; | ||
import { getEvents } from "../../apis/eventApi"; | ||
import { _Event } from "../../utils/types"; | ||
import { useLoader } from "../toploader/useLoader"; | ||
import { useToast } from "../toast/useToast"; | ||
import EventCardSmall from "../eventcardsmall/EventCardSmall"; | ||
interface EventListSmallProps { | ||
limit?: number; | ||
gctian: boolean; | ||
} | ||
|
||
const EventListSmall: React.FC<EventListSmallProps> = ({ | ||
limit = undefined, | ||
gctian, | ||
}) => { | ||
var { addLoader } = useLoader(); | ||
var { setToastStatus } = useToast(); | ||
const [events, setEvents] = useState<Array<_Event>>([]); | ||
useEffect(() => { | ||
getEvents(null, addLoader, setToastStatus, limit, gctian).then((e) => { | ||
if (e) setEvents(e); | ||
else console.log("error : no event data got"); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<div className={style.eventlist}> | ||
{events.map((event) => { | ||
return <EventCardSmall event={event} />; | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default EventListSmall; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.