diff --git a/src/pages/auth/register.jsx b/src/pages/auth/register.jsx
index 5cd64cd..c4a72f6 100644
--- a/src/pages/auth/register.jsx
+++ b/src/pages/auth/register.jsx
@@ -74,7 +74,7 @@ const Register = () => {
}
};
- useTitle("Register | Bashaway");
+ useTitle("Register | Tech Events");
return (
<>
diff --git a/src/pages/auth/reset-password.jsx b/src/pages/auth/reset-password.jsx
index 15f7d11..0611a85 100644
--- a/src/pages/auth/reset-password.jsx
+++ b/src/pages/auth/reset-password.jsx
@@ -26,7 +26,7 @@ const ResetPassword = () => {
});
};
- useTitle("Reset Password | Bashaway");
+ useTitle("Reset Password | Tech Events");
return (
diff --git a/src/pages/question-details.jsx b/src/pages/challenge-details.jsx
similarity index 67%
rename from src/pages/question-details.jsx
rename to src/pages/challenge-details.jsx
index c66997a..f3d1a55 100644
--- a/src/pages/question-details.jsx
+++ b/src/pages/challenge-details.jsx
@@ -1,5 +1,4 @@
import { useMemo, useState } from "react";
-import { useEffect } from "react";
import { CheckCircle2 } from "lucide-react";
import { default as ReactMarkdown } from "react-markdown";
import { useSelector } from "react-redux";
@@ -7,29 +6,29 @@ import { useParams } from "react-router-dom";
import { default as isEmpty } from "lodash/isEmpty";
import { default as startCase } from "lodash/startCase";
import { twMerge } from "tailwind-merge";
-import { ActionButtons } from "@/components/question-details";
+import { ActionButtons } from "@/components/challenge-details";
import { useEffectOnce, useTitle } from "@/hooks";
-import { tracker, uploadSubmission } from "@/services";
+import { uploadSubmission } from "@/services";
import { store } from "@/store";
import {
- selectQuestionById,
+ selectEventById,
submissionApi,
- updateQuestionStateById,
+ updateEventStateById,
useAddSubmissionMutation,
- useGetQuestionByIdQuery
+ useGetChallengeByIdQuery
} from "@/store/api";
import { challengeColor } from "@/utils";
import { AnimatedSwitcher, Badge, BreadCrumbs, Skeleton, toast } from "@sliit-foss/bashaway-ui/components";
import { Body3, Footnote } from "@sliit-foss/bashaway-ui/typography";
-export default function QuestionDetails() {
- const { id } = useParams();
+export default function ChallengeDetails() {
+ const { challenge_id: challengeId } = useParams();
const [uploading, setUploading] = useState(false);
- const questionFromStore = useSelector(selectQuestionById(id));
+ const challengeFromStore = useSelector(selectEventById(challengeId));
- const { data: { data: question = questionFromStore } = {}, isSuccess } = useGetQuestionByIdQuery(id);
+ const { data: { data: challenge = challengeFromStore } = {} } = useGetChallengeByIdQuery(challengeId);
const [addSubmission, { isLoading }] = useAddSubmissionMutation();
@@ -43,12 +42,12 @@ export default function QuestionDetails() {
if (!["zip"].includes(file.name?.split(".").pop()))
return toast({ variant: "destructive", title: "Submission should be a zip archive" });
const url = await uploadSubmission(file);
- await addSubmission({ question: id, link: url })
+ await addSubmission({ challenge: challengeId, link: url })
.unwrap()
.then(() => {
toast({ title: "Submission added successfully" });
- updateQuestionStateById(store, id, {
- total_submissions: !question.submitted ? question.total_submissions + 1 : question.total_submissions,
+ updateEventStateById(store, challengeId, {
+ total_submissions: !challenge.submitted ? challenge.total_submissions + 1 : challenge.total_submissions,
submitted: true
});
store.dispatch(submissionApi.util.resetApiState());
@@ -62,46 +61,37 @@ export default function QuestionDetails() {
}
};
- useTitle("Challenge | Bashaway");
+ useTitle("Challenge | Tech Events");
- const cardStyles = useMemo(() => challengeColor(question), [question]);
+ const cardStyles = useMemo(() => challengeColor(challenge), [challenge]);
useEffectOnce(() => {
window.scroll({ top: 0, behavior: "smooth" });
});
- useEffect(() => {
- if (isSuccess && question?._id)
- tracker.event("challenge_view", {
- challenge_id: question._id,
- challenge_name: question.name,
- challenge_difficulty: question.difficulty
- });
- }, [question, isSuccess]);
-
return (
<>
- {!isEmpty(question) ? question?.total_submissions : }{" "}
- {question?.total_submissions === 1 ? "team " : "teams "}
+ {!isEmpty(challenge) ? challenge?.total_submissions : }{" "}
+ {challenge?.total_submissions === 1 ? "team " : "teams "}
submitted
- {question?.name}
- {question?.description}
+ {challenge?.name}
+ {challenge?.description}
- {startCase(question?.difficulty?.toLowerCase())}
- {question?.max_score}PT
- {question?.constraints?.length && {question?.constraints?.join(", ")}}
+ {startCase(challenge?.difficulty?.toLowerCase())}
+ {challenge?.max_score}PT
+ {challenge?.constraints?.length && {challenge?.constraints?.join(", ")}}
-
+
}
alternateComponent={
@@ -120,7 +110,7 @@ export default function QuestionDetails() {
count={3}
shade="dark"
/>
-
+
}
/>
diff --git a/src/pages/challenges.jsx b/src/pages/challenges.jsx
new file mode 100644
index 0000000..6414dbc
--- /dev/null
+++ b/src/pages/challenges.jsx
@@ -0,0 +1,77 @@
+import { useState } from "react";
+import { default as Lottie } from "react-lottie";
+import { twMerge } from "tailwind-merge";
+import { Challenge, ChallengeGridSkeleton } from "@/components/challenges";
+import { challengeFilters, challengeSorts } from "@/filters";
+import { useBreakpoint, useTitle } from "@/hooks";
+import { useGetChallengesQuery } from "@/store/api";
+import { AnimatedSwitcher, Filters, NoRecords, Pagination, Sorts } from "@sliit-foss/bashaway-ui/components";
+import { computeFilterQuery, computeSortQuery } from "@sliit-foss/bashaway-ui/utils";
+import { default as teamwork } from "../../public/assets/animations/teamwork.json";
+
+const gridStyles = "w-full h-full grid grid-cols-1 lg:grid-cols-2 justify-start items-center gap-5";
+
+const Challenges = () => {
+ const [page, setPage] = useState(1);
+ const [filters, setFilters] = useState(computeFilterQuery(challengeFilters));
+ const [sorts, setSorts] = useState(computeSortQuery(challengeSorts));
+
+ const { data: challenges, isFetching, isError } = useGetChallengesQuery({ filters, sorts, page });
+
+ const { xs, sm } = useBreakpoint();
+
+ useTitle("Home | Tech Events");
+
+ return (
+ <>
+
+
+
+
+
+
}
+ className={twMerge(
+ "grow flex flex-col",
+ !challenges?.data?.docs?.length && "justify-center pointer-events-none"
+ )}
+ alternateComponent={
+ challenges?.data?.docs?.length ? (
+
+ {challenges?.data?.docs?.map((challenge) => (
+
+ ))}
+
+ ) : (
+ <>
+
+
+ >
+ )
+ }
+ />
+
+
setPage(newPage)}
+ totalPages={challenges?.data?.totalPages}
+ />
+
+
+ >
+ );
+};
+
+export default Challenges;
diff --git a/src/pages/change-password.jsx b/src/pages/change-password.jsx
index 4c1df4d..c022e5a 100644
--- a/src/pages/change-password.jsx
+++ b/src/pages/change-password.jsx
@@ -23,7 +23,7 @@ const ChangePassword = () => {
});
};
- useTitle("Change Password | Bashaway");
+ useTitle("Change Password | Tech Events");
return (
diff --git a/src/pages/event-details.jsx b/src/pages/event-details.jsx
new file mode 100644
index 0000000..acde329
--- /dev/null
+++ b/src/pages/event-details.jsx
@@ -0,0 +1,117 @@
+import { useSelector } from "react-redux";
+import { useParams } from "react-router-dom";
+import { default as isEmpty } from "lodash/isEmpty";
+import { FAQ } from "@/components/event-details";
+import { useEffectOnce, useTitle } from "@/hooks";
+import { selectEventById, useGetEventByIdQuery } from "@/store/api";
+import { AnimatedSwitcher, Skeleton } from "@sliit-foss/bashaway-ui/components";
+
+export default function EventDetails() {
+ const { event_id: eventId } = useParams();
+
+ const eventFromStore = useSelector(selectEventById(eventId));
+
+ const { data: { data: event = eventFromStore } = {} } = useGetEventByIdQuery(eventId);
+
+ useTitle(`${event?.name ?? "Event"} | Tech Events`);
+
+ useEffectOnce(() => {
+ window.scroll({ top: 0, behavior: "smooth" });
+ });
+
+ return (
+ <>
+
+
+
+
+
+
+
+
DevFest 2023
+ Sri Lanka’s Largest Developer Event in 2023
+
+
+
+ 09 Dec 2023
+
+
+ 09:00AM
+
+
+ Informatics Institute of Technology, 10 Trelawney Pl
+
+
+ 09 Dec 2023
+
+
+ 09 Dec 2023
+
+
+ Musaeus College Auditorium, Colombo 07
+
+
+
+
+
+
+
GDG Sri Lanka
+
+
+
This event includes
+
+ 👍🏻 Direct interaction with the instructor
+ 🖥 Access on mobile and web
+ 🎥 Session recording after the workshop
+ ⌛️ 1 hour live session
+
+
+
+
About the event
+
+
+ DevFest Sri Lanka is Google’s annual developer conference in the country. Does this sound
+ interesting to you? Do you believe in helping others as you grow? Having trouble in debugging is
+ something that many people face. So, do you prefer to learn from professionals? Then you are just
+ at the right place.
+
+
+
+
+
+
Frequently Asked Questions
+ Find all your answers related to this event.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
GDG Sri Lanka
+ @GDGLK
+
+
+
GDG Sri Lanka is a community driven by technology enthusiasts, it’s Google supported.
+
+
+
+ }
+ alternateComponent={
+
+ }
+ />
+
+ >
+ );
+}
diff --git a/src/pages/home.jsx b/src/pages/home.jsx
index 401a624..b7d7983 100644
--- a/src/pages/home.jsx
+++ b/src/pages/home.jsx
@@ -1,10 +1,10 @@
import { useState } from "react";
import { default as Lottie } from "react-lottie";
import { twMerge } from "tailwind-merge";
-import { Question, QuestionGridSkeleton } from "@/components/home";
-import { questionFilters, questionSorts } from "@/filters";
+import { Event, EventGridSkeleton } from "@/components/home";
+import { eventFilters, eventSorts } from "@/filters";
import { useBreakpoint, useTitle } from "@/hooks";
-import { useGetQuestionsQuery } from "@/store/api";
+import { useGetEventsQuery } from "@/store/api";
import { AnimatedSwitcher, Filters, NoRecords, Pagination, Sorts } from "@sliit-foss/bashaway-ui/components";
import { computeFilterQuery, computeSortQuery } from "@sliit-foss/bashaway-ui/utils";
import { default as teamwork } from "../../public/assets/animations/teamwork.json";
@@ -13,34 +13,31 @@ const gridStyles = "w-full h-full grid grid-cols-1 lg:grid-cols-2 justify-start
const Home = () => {
const [page, setPage] = useState(1);
- const [filters, setFilters] = useState(computeFilterQuery(questionFilters));
- const [sorts, setSorts] = useState(computeSortQuery(questionSorts));
+ const [filters, setFilters] = useState(computeFilterQuery(eventFilters));
+ const [sorts, setSorts] = useState(computeSortQuery(eventSorts));
- const { data: questions, isFetching, isError } = useGetQuestionsQuery({ filters, sorts, page });
+ const { data: events, isFetching, isError } = useGetEventsQuery({ filters, sorts, page });
const { xs, sm } = useBreakpoint();
- useTitle("Home | Bashaway");
+ useTitle("Home | Tech Events");
return (
<>
-
-
+ *:nth-child(1)]:w-full" }} />
+
}
- className={twMerge(
- "grow flex flex-col",
- !questions?.data?.docs?.length && "justify-center pointer-events-none"
- )}
+ component={
}
+ className={twMerge("grow flex flex-col", !events?.data?.docs?.length && "justify-center pointer-events-none")}
alternateComponent={
- questions?.data?.docs?.length ? (
+ events?.data?.docs?.length ? (
- {questions?.data?.docs?.map((question) => (
-
+ {events?.data?.docs?.map((event) => (
+
))}
) : (
@@ -57,7 +54,7 @@ const Home = () => {
height={200}
width={sm ? 400 : xs ? 300 : 250}
/>
-
+
>
)
}
@@ -66,7 +63,7 @@ const Home = () => {
setPage(newPage)}
- totalPages={questions?.data?.totalPages}
+ totalPages={events?.data?.totalPages}
/>
diff --git a/src/pages/index.jsx b/src/pages/index.jsx
index f614845..c8feaa7 100644
--- a/src/pages/index.jsx
+++ b/src/pages/index.jsx
@@ -2,7 +2,9 @@ export { default as NotFound } from "./404";
export { default as ChangePassword } from "./change-password";
export { default as Home } from "./home";
export { default as Profile } from "./profile";
-export { default as QuestionDetails } from "./question-details";
+export { default as Challenges } from "./challenges";
+export { default as ChallengeDetails } from "./challenge-details";
export { default as Submissions } from "./submissions";
+export { default as EventDetails } from "./event-details";
export * from "./auth";
diff --git a/src/pages/profile.jsx b/src/pages/profile.jsx
index dcffa18..bca5047 100644
--- a/src/pages/profile.jsx
+++ b/src/pages/profile.jsx
@@ -6,7 +6,7 @@ import { BreadCrumbs, Button } from "@sliit-foss/bashaway-ui/components";
const Profile = () => {
const { data: { data: team } = {}, isLoading } = useAuthUserQuery();
- useTitle("Profile | Bashaway");
+ useTitle("Profile | Tech Events");
useEffectOnce(() => {
window.scroll({ top: 0, behavior: "smooth" });
diff --git a/src/pages/submissions.jsx b/src/pages/submissions.jsx
index c915048..95e33e4 100644
--- a/src/pages/submissions.jsx
+++ b/src/pages/submissions.jsx
@@ -17,7 +17,7 @@ import { Body2 } from "@sliit-foss/bashaway-ui/typography";
import { computeFilterQuery, computeSortQuery } from "@sliit-foss/bashaway-ui/utils";
const Submissions = () => {
- const { id: questionId } = useParams();
+ const { challenge_id: challengeId } = useParams();
const [page, setPage] = useState(1);
const [filters, setFilters] = useState(computeFilterQuery(submissionFilters));
@@ -29,9 +29,9 @@ const Submissions = () => {
data: submissions,
isFetching,
isError
- } = useGetMySubmissionsQuery({ filters: `filter[question]=${questionId}&${filters}`, sorts, page });
+ } = useGetMySubmissionsQuery({ filters: `filter[challenge]=${challengeId}&${filters}`, sorts, page });
- useTitle("Submissions | Bashaway");
+ useTitle("Submissions | Tech Events");
return (
<>
@@ -40,7 +40,7 @@ const Submissions = () => {
"Home",
{
label: "Challenge",
- path: `/questions/${questionId}`
+ path: `/challenges/${challengeId}`
},
"Submissions"
]}
diff --git a/src/routes/index.jsx b/src/routes/index.jsx
index 590d0b0..c2552d1 100644
--- a/src/routes/index.jsx
+++ b/src/routes/index.jsx
@@ -1,14 +1,15 @@
import { Route, Routes, useLocation } from "react-router-dom";
import { AnimatePresence } from "framer-motion";
-import { useIdentification } from "@/hooks";
import {
+ ChallengeDetails,
+ Challenges,
ChangePassword,
+ EventDetails,
ForgotPassword,
Home,
Login,
NotFound,
Profile,
- QuestionDetails,
Register,
ResetPassword,
Submissions
@@ -16,15 +17,16 @@ import {
const AnimatedRoutes = () => {
const location = useLocation();
- useIdentification();
return (