Skip to content

Commit

Permalink
Merge pull request #125 from ms-club-sliit/development
Browse files Browse the repository at this point in the history
Development changes
  • Loading branch information
stargazer39 authored Jul 30, 2023
2 parents 07daf59 + 295b3da commit 825beac
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
REACT_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
REACT_APP_EMAIL_ENDPOINT: ${{ secrets.REACT_APP_EMAIL_ENDPOINT }}
REACT_APP_SHARE_ENDPOINT: ${{ secrets.REACT_APP_SHARE_ENDPOINT }}
REACT_APP_FIREBASE_COLLECTION_PREFIX: ${{ secrets.REACT_APP_FIREBASE_COLLECTION_PREFIX }}
run: yarn build
- name: Upload a Build Artifact
uses: actions/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
REACT_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
REACT_APP_EMAIL_ENDPOINT: ${{ secrets.REACT_APP_EMAIL_ENDPOINT }}
REACT_APP_SHARE_ENDPOINT: ${{ secrets.REACT_APP_SHARE_ENDPOINT }}
REACT_APP_FIREBASE_COLLECTION_PREFIX: ${{ secrets.REACT_APP_FIREBASE_COLLECTION_PREFIX }}
run: yarn build
- name: Upload a Build Artifact
uses: actions/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
REACT_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
REACT_APP_EMAIL_ENDPOINT: ${{ secrets.REACT_APP_EMAIL_ENDPOINT }}
REACT_APP_SHARE_ENDPOINT: ${{ secrets.REACT_APP_SHARE_ENDPOINT }}
REACT_APP_FIREBASE_COLLECTION_PREFIX: ${{ secrets.REACT_APP_FIREBASE_COLLECTION_PREFIX }}
run: yarn build
- name: Upload a Build Artifact
uses: actions/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
REACT_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
REACT_APP_EMAIL_ENDPOINT: ${{ secrets.REACT_APP_EMAIL_ENDPOINT }}
REACT_APP_SHARE_ENDPOINT: ${{ secrets.REACT_APP_SHARE_ENDPOINT }}
REACT_APP_FIREBASE_COLLECTION_PREFIX: ${{ secrets.REACT_APP_FIREBASE_COLLECTION_PREFIX }}
- name: Deploy
uses: JamesIves/[email protected]
with:
Expand Down
3 changes: 2 additions & 1 deletion src/Firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ const FirebaseApp = initializeApp({

const Db = getFirestore(FirebaseApp);
const Storage = getStorage(FirebaseApp);
const colPrefix = process.env.REACT_APP_FIREBASE_COLLECTION_PREFIX || "dev";

export { FirebaseApp, Db, Storage };
export { FirebaseApp, Db, Storage, colPrefix };
14 changes: 7 additions & 7 deletions src/api/register/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Db, Storage } from "../../Firebase";
import { Db, Storage, colPrefix } from "../../Firebase";
import {
collection,
Timestamp,
Expand All @@ -11,10 +11,10 @@ import { EmailExists, TeamExist } from "../errors/errors";

export const registerAwarenessSession = async (member_details) => {
return await runTransaction(Db, async (transaction) => {
const counter_ref = doc(Db, "awareness_session", "--counter--");
const counter_ref = doc(Db, `awareness_session_${colPrefix}`, "--counter--");
let counter_doc = await transaction.get(counter_ref);

const doc_ref = doc(Db, "awareness_session", member_details.email);
const doc_ref = doc(Db, `awareness_session_${colPrefix}`, member_details.email);
const document = await transaction.get(doc_ref);

if (document.exists()) {
Expand Down Expand Up @@ -44,7 +44,7 @@ export const updateTicket = async (ref, ticket_url) => {

export const saveTicket = async (image_string) => {
let fileName = generateFileName();
const storageRef = ref(Storage, `/ticket-images/${fileName}`);
const storageRef = ref(Storage, `/ticket-images-${colPrefix}/${fileName}`);
let snapshot = await uploadBytes(storageRef, dataURItoBlob(image_string));
return await getDownloadURL(snapshot.ref);
};
Expand Down Expand Up @@ -78,13 +78,13 @@ export const registerTeam = async (teamInfo) => {
await Promise.all(tasks);

return await runTransaction(Db, async (transaction) => {
const doc_ref = doc(collection(Db, "teams"));
const counter_ref = doc(Db, "teams", "--counter--");
const doc_ref = doc(collection(Db, `teams-${colPrefix}`));
const counter_ref = doc(Db, `teams-${colPrefix}`, "--counter--");
const team_min_name = teamInfo
.team_name
.replace(/[ `!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?~]/gm, "")
.toLowerCase();
const team_name_index_doc_ref = doc(Db, "team_name_index", team_min_name);
const team_name_index_doc_ref = doc(Db, `team_name_index_${colPrefix}`, team_min_name);
const team_name_index_doc = await transaction.get(team_name_index_doc_ref);

if(team_name_index_doc.exists()){
Expand Down
17 changes: 4 additions & 13 deletions src/components/TeamTicket/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ const TeamTicket = (props, this_ref) => {
useEffect(() => {
if (onRender && ref.current) {
ref.current.style.transform = "none";

toPng(ref.current, { cacheBust: true })
.then((dataUrl) => {
ref.current.style.transform = "none";
onRender(dataUrl);
})
.catch((err) => {
isDebugModeOn && console.log(err);
console.error(err);
});
}
}, [ref, isDebugModeOn, onRender]);
Expand Down Expand Up @@ -110,17 +109,9 @@ const TeamTicket = (props, this_ref) => {
className="flex flex-row items-center mb-[14px]"
>
<div className="w-[40px] h-[40px] flex justify-center items-center flex-shrink-0 rounded-full bg-black mr-[8px] overflow-hidden">
{member.image === "default" ? (
<div className="text-white text-xl font-bold">
{member.name[0].toUpperCase()}
</div>
) : (
<img
src={member.image}
alt={member.name}
className="object-fill h-full w-full"
/>
)}
<div className="text-white text-xl font-bold">
{member.name[0].toUpperCase()}
</div>
</div>
<div className="ticket-team-member line-clamp-2">
{member.name}
Expand Down
8 changes: 4 additions & 4 deletions src/components/TicketPopup/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function TicketPopup({
(
<>
<h1 className="text-center font-bold text-2xl md:text-4xl mb-[2em] mt-[3em] text-white px-4">
You have successfully registered {isTeam ? "for the Mini Hackathon 2022" : "for the Awareness Session"}! <br></br>Here's your
You have successfully registered {isTeam ? "for the Mini Hackathon 2023" : "for the Awareness Session"}! <br></br>Here's your
ticket. Share everywhere!
</h1>
<h2 className="text-md text-white mb-[1em]">
Expand All @@ -86,7 +86,7 @@ function TicketPopup({
{ isTeam ?
<TeamTicket
headerImage={"/assets/ms_club_logo.png"}
title="Mini Hackathon 2022"
title="Mini Hackathon 2023"
subTitle="Team Registration 📣"
date={new Date()}
ticketNo={ticketNo}
Expand All @@ -99,7 +99,7 @@ function TicketPopup({
<Ticket
headerImage={"/assets/ms_club_logo.png"}
headerImage2={"/assets/fcsc_logo.png"}
title="Mini Hackathon 2022"
title="Mini Hackathon 2023"
subTitle="Awareness Session 📣"
date={moment("2022-07-30 19:00")}
ticketNo={ticketNo}
Expand All @@ -111,7 +111,7 @@ function TicketPopup({
/>
}
</div>
<Share url={getShareURL(ticketNo, isTeam ? "team" : "awareness")} title={isTeam ? "I got registered for the Mini Hackathon 2022!" : "I got registered for the Mini Hackathon Awareness Session!"}/>
<Share url={getShareURL(ticketNo, isTeam ? "team" : "awareness")} title={isTeam ? "I got registered for the Mini Hackathon 2023!" : "I got registered for the Mini Hackathon Awareness Session!"}/>
<div className="mt-5">
<button
onClick={saveTicket}
Expand Down
4 changes: 2 additions & 2 deletions src/components/TimelineCard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const TimelineComponent = (props) => (
📣 Book your tickets now
</a>
)} */}
{/* {props.data.id === 3 && (
{props.data.id === 3 && (
<a
href="/team/register"
target="_blank"
Expand All @@ -38,7 +38,7 @@ const TimelineComponent = (props) => (
>
✍🏼 Register your team
</a>
)} */}
)}
</div>
</VerticalTimelineElement>
);
Expand Down
2 changes: 1 addition & 1 deletion src/views/AwarenessSession/EmailTemplate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
export default function EmailTemplate({ image }) {
return (
<div>
<h1>You are now registered to the Mini Hackathon awareness session 2022!</h1>
<h1>You are now registered to the Mini Hackathon awareness session 2023!</h1>
<div>
<img src={image} alt="Your Ticket"></img>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/views/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CountdownTimer from "./CountdownTimer";
import Logo from "../../assets/logo/mini_hackathon_logo_2023.png";

const Countdown = () => {
// const isAwarenessSession = false;
const isAwarenessSession = false;
let myDate = "30-08-2023";
myDate = myDate.split("-");
let newDate = new Date(myDate[2], myDate[1] - 1, myDate[0]);
Expand Down Expand Up @@ -32,15 +32,15 @@ const Countdown = () => {
<div className="text-center mt-7">

<a
href="https://msclubsliit.org/"
href="https://bit.ly/minihackathonAwareness23"
target="_blank"
rel="noopener noreferrer"
className=" bg-black text-white border border-black hover:bg-gray-100 hover:text-black rounded lg:text-lg pl-4 pr-4 pt-1 pb-1 transition duration-0 hover:duration-500"
>
Awareness Session
</a>
</div>
{ /*<div className="text-center mt-7">
<div className="text-center mt-7">
{isAwarenessSession ? (
<a
href="/awareness-session/register"
Expand All @@ -60,7 +60,7 @@ const Countdown = () => {
✍🏼 Register your team
</a>
)}
</div> */}
</div>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/views/Register/EmailTemplate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";
export default function EmailTemplate({ image }) {
return (
<div>
<h1>You are now registered to the Mini Hackathon 2022!</h1>
<h1>You are now registered to the Mini Hackathon 2023!</h1>
<div>
<img src={image} alt="Your Ticket"></img>
</div>
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5819,7 +5819,7 @@ html-minifier-terser@^6.0.2:
relateurl "^0.2.7"
terser "^5.10.0"

html-to-image@^1.11.11:
html-to-image@^1.9.0:
version "1.11.11"
resolved "https://registry.yarnpkg.com/html-to-image/-/html-to-image-1.11.11.tgz#c0f8a34dc9e4b97b93ff7ea286eb8562642ebbea"
integrity sha512-9gux8QhvjRO/erSnDPv28noDZcPZmYE7e1vFsBLKLlRlKDSqNJYebj6Qz1TGd5lsRV+X+xYyjCKjuZdABinWjA==
Expand Down

0 comments on commit 825beac

Please sign in to comment.