Skip to content

Commit

Permalink
Fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
hkirat committed Aug 26, 2024
1 parent 35a00bc commit 20be52e
Show file tree
Hide file tree
Showing 17 changed files with 107 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug
about: Create a report to help us improve
title: "bug: "
labels: bug
labels: "bug,needs-triage"
assignees: ''
---

Expand Down
14 changes: 14 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:20-alpine
ARG DATABASE_URL

WORKDIR /usr/src/app

COPY . .
RUN npm install
RUN cd packages/db && DATABASE_URL=$DATABASE_URL npx prisma generate && cd ../..
RUN DATABASE_URL=$DATABASE_URL npm run build

EXPOSE 3000

CMD ["npm", "run", "start"]

3 changes: 2 additions & 1 deletion apps/web/app/auth/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Suspense } from "react";
import Signin from "../../components/Signin";

const SigninPage = async () => {
return <Signin />;
return <Suspense> <Signin /> </Suspense>;
};

export default SigninPage;
4 changes: 4 additions & 0 deletions apps/web/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat+Alternates:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;
Expand Down
38 changes: 23 additions & 15 deletions apps/web/app/pdf/[...pdfId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import { redirect } from "next/navigation";
import { Print } from "../../../components/Print";
import { getProblem, getTrack } from "../../../components/utils";
import { LessonView } from "../../../components/LessonView";
import { getServerSession } from "next-auth";
import { authOptions } from "../../../lib/auth";

const notion = new NotionAPI();

export default async function TrackComponent({ params }: { params: { pdfId: string[] } }) {
const trackId: string = params.pdfId[0] || "";
const problemId = params.pdfId[1];
let notionRecordMaps: any[] = [];
const session = await getServerSession(authOptions);
if (trackId === "43XrfL4n0LgSnTkSB4rO") {
redirect("/tracks/oAjvkeRNZThPMxZf4aX5");
}
Expand All @@ -23,25 +26,30 @@ export default async function TrackComponent({ params }: { params: { pdfId: stri
if (problemDetails?.notionDocId && trackDetails?.problems) {
// notionRecordMaps = await notion.getPage(problemDetails.notionDocId);
notionRecordMaps = await Promise.all(
trackDetails.problems.map(async (problem) => await notion.getPage((await getProblem(problem.id))?.notionDocId!))
trackDetails.problems.map(async (problem: any) => await notion.getPage((await getProblem(problem.id))?.notionDocId!))
);
}

if (!session?.user) {
const downloadUrl = `/pdf/${trackId}/${problemId}`;
return redirect("/auth?redirectUrl=" + encodeURIComponent(downloadUrl));
}
if (trackDetails && problemDetails) {
return (
<div>
{trackDetails?.problems.map((problem, i) => (
<LessonView
isPdfRequested={true}
track={trackDetails}
problem={{
...problemDetails,
notionRecordMap: notionRecordMaps[i],
}}
key={i}
/>
))}
<Print />
</div>
<div>
{trackDetails?.problems.map((problem: any, i: number) => (
<LessonView
isPdfRequested={true}
track={trackDetails}
problem={{
...problemDetails,
notionRecordMap: notionRecordMaps[i],
}}
key={i}
/>
))}
<Print />
</div>
);
}
}
2 changes: 1 addition & 1 deletion apps/web/components/Appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Appbar = () => {
>
<Link href={"/"} className="flex items-center gap-2 cursor-pointer">
<Image
src={"https://d2szwvl7yo497w.cloudfront.net/courseThumbnails/main.png"}
src={"https://appx-wsb-gcp.akamai.net.in/subject/2023-01-17-0.17044360120951185.jpg"}
alt="Logo"
width={300}
height={200}
Expand Down
1 change: 1 addition & 0 deletions apps/web/components/Blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ export const Blog = ({
</div>
);
};

2 changes: 1 addition & 1 deletion apps/web/components/BlogAppbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const BlogAppbar = ({
>
<Link href={"/"} className="hidden md:flex items-center gap-4 cursor-pointer">
<Image
src={"https://d2szwvl7yo497w.cloudfront.net/courseThumbnails/main.png"}
src={"https://appx-wsb-gcp.akamai.net.in/subject/2023-01-17-0.17044360120951185.jpg"}
alt="Logo"
width={200}
height={200}
Expand Down
34 changes: 31 additions & 3 deletions apps/web/components/Categories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import { useRecoilState } from "recoil";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@repo/ui";
import { Button, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@repo/ui";
import { category } from "@repo/store";

interface Category {
Expand All @@ -26,14 +26,20 @@ export const Categories = ({ categories }: { categories: Category[] }) => {

return (
<div>
<div className="flex gap-2 items-center w-full justify-end">
<span className="font-medium">Filter by:</span>
<div className="2.5xl:hidden block">
<SelectCategory
categories={categories}
selectedCategory={selectedCategory}
handleCategoryChange={handleCategoryChange}
/>
</div>
<div className="2.5xl:block hidden">
<ButtonCategory
categories={categories}
selectedCategory={selectedCategory}
handleCategoryChange={handleCategoryChange}
/>
</div>
</div>
);
};
Expand Down Expand Up @@ -68,3 +74,25 @@ const SelectCategory = ({ categories, selectedCategory, handleCategoryChange }:
</div>
);
};

const ButtonCategory = ({ categories, selectedCategory, handleCategoryChange }: CategoryProps) => {
return (
<div className="flex justify-evenly mx-auto border-2 rounded-full py-1 w-2/3">
<Button variant="ghost" className="rounded-full" onClick={() => handleCategoryChange("All")}>
All
</Button>
{categories.map((category) => (
<Button
key={category.category}
variant="ghost"
onClick={() => handleCategoryChange(category.category)}
className={
selectedCategory === category.category ? "bg-gray-300 dark:bg-slate-700 rounded-full" : "rounded-full"
}
>
{category.category}
</Button>
))}
</div>
);
};
12 changes: 12 additions & 0 deletions apps/web/components/CodeBlock.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.code_block {
display: flex;
justify-content: space-between;
position: relative;
padding: 10px;
font-size: 15px;
word-wrap: break-word;
white-space: pre-wrap;
background: #111827;
overflow: auto;
color: #564;
}
3 changes: 2 additions & 1 deletion apps/web/components/NotionRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const NotionRenderer = ({ recordMap }: { recordMap: any }) => {
const { resolvedTheme } = useTheme();

return (
<div className="w-full">
<div className=".notion_ w-full .notion-bg-black">
<style>
{`
:root {
Expand Down Expand Up @@ -43,6 +43,7 @@ export const NotionRenderer = ({ recordMap }: { recordMap: any }) => {
</style>
<div>
<NotionRendererLib
className="text-red-500 "
components={{
Code: CodeBlock,
}}
Expand Down
7 changes: 4 additions & 3 deletions apps/web/components/Signin.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import { signIn, useSession } from "next-auth/react";
import { useEffect, useRef } from "react";
import { useRouter } from "next/navigation";
import { useRouter, useSearchParams } from "next/navigation";
import Image from "next/image";
import { Button, Separator } from "@repo/ui";
import Link from "next/link";
Expand All @@ -10,11 +10,12 @@ import { motion } from "framer-motion";
const Signin = () => {
const session = useSession();
const router = useRouter();
const searchParams = useSearchParams();

const redirected = useRef(false);
useEffect(() => {
if (redirected.current === false && session.data?.user) {
const redirectUrl = localStorage.getItem("loginRedirectUrl");
const redirectUrl = localStorage.getItem("loginRedirectUrl") || searchParams.get("redirectUrl");
localStorage.removeItem("loginRedirectUrl");
router.replace(redirectUrl || "/");
redirected.current = true;
Expand Down Expand Up @@ -81,7 +82,7 @@ const Signin = () => {
<Separator className="w-full my-2" />
<Link href={"/"} className="flex items-center gap-2 cursor-pointer mx-auto">
<Image
src={"https://d2szwvl7yo497w.cloudfront.net/courseThumbnails/main.png"}
src={"https://appx-wsb-gcp.akamai.net.in/subject/2023-01-17-0.17044360120951185.jpg"}
alt="Logo"
width={300}
height={200}
Expand Down
1 change: 1 addition & 0 deletions apps/web/components/Tracks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const Tracks = ({ tracks, categories }: TracksWithCategoriesProps) => {
const [visibleTracks, setVisibleTracks] = useState<TrackPros[]>([]);
const [sortBy, setSortBy] = useState<string>("new");
const [cohort2, setCohort2] = useState<boolean>(false);
const [isSelectOpen, setIsSelectOpen] = useState<boolean>(false);
const [cohort3, setCohort3] = useState<boolean>(false);
const [currentPage, setCurrentPage] = useState<number>(1);
const tracksPerPage = 10;
Expand Down
1 change: 1 addition & 0 deletions apps/web/components/mcq/MCQPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ const MCQPanel = ({ problem }: { problem: Problem & { notionRecordMap: any } })
};

export default MCQPanel;

2 changes: 1 addition & 1 deletion apps/web/screens/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Footer = () => {
<div className="flex flex-col gap-12 text-primary">
<Link href={"/"} className="flex items-center gap-2 cursor-pointer">
<Image
src={"https://d2szwvl7yo497w.cloudfront.net/courseThumbnails/main.png"}
src={"https://appx-wsb-gcp.akamai.net.in/subject/2023-01-17-0.17044360120951185.jpg"}
alt="Logo"
width={300}
height={200}
Expand Down
8 changes: 8 additions & 0 deletions apps/web/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = {
],
prefix: "",
theme: {
fontFamily: {
"open-talk": ["Open Sans", " sans - serif"],
"open-poppins": ["Poppins", "sans-serif"],
"open-montserrat": ["Montserrat Alternates", "sans-serif"]
},
container: {
center: true,
padding: "2rem",
Expand All @@ -20,6 +25,9 @@ module.exports = {
},
},
extend: {
screens: {
"2.5xl": "1730px",
},
colors: {
border: "hsl(var(--border))",
input: "hsl(var(--input))",
Expand Down
Empty file.

0 comments on commit 20be52e

Please sign in to comment.