Skip to content

Commit

Permalink
fix: prettierr formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
qamarq committed Nov 14, 2024
1 parent 1ad0538 commit b90e516
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 151 deletions.
15 changes: 9 additions & 6 deletions frontend/src/app/(homepage)/_components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"
"use client";

import { useState } from "react";
import Image from "next/image";
import { useState } from "react";

const Logo = () => {
return (
Expand All @@ -24,8 +24,8 @@ export const Navbar = () => {
setIsMenuOpen(!isMenuOpen);
};
return (
<div className="relative z-50 h-20 backdrop-blur-[12px] border-b border-white/10">
<div className="flex items-center justify-between container mx-auto">
<div className="relative z-50 h-20 border-b border-white/10 backdrop-blur-[12px]">
<div className="container mx-auto flex items-center justify-between">
<Logo />

<nav className="hidden h-20 flex-row items-center gap-10 pr-10 text-white md:flex lg:pr-40">
Expand Down Expand Up @@ -54,7 +54,10 @@ export const Navbar = () => {

{/* Mobile Menu Icon */}
<div className="flex items-center md:hidden">
<button onClick={toggleMenu} className="text-white focus:outline-none">
<button
onClick={toggleMenu}
className="text-white focus:outline-none"
>
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-8 w-8"
Expand Down Expand Up @@ -101,4 +104,4 @@ export const Navbar = () => {
</div>
</div>
);
};
};
4 changes: 3 additions & 1 deletion frontend/src/app/(homepage)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Image from "next/image";
import { Navbar } from "./_components/navbar";

import { Footer } from "@/components/footer";

import { Navbar } from "./_components/navbar";

export default function LayoutHomePage({
children,
}: Readonly<{ children: React.ReactNode }>) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/(homepage)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client"
"use client";

import { useQuery } from "@tanstack/react-query";
import { motion } from "framer-motion";
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/app/api/data/[facultyId]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ interface PageProps {
params: Promise<{ facultyId: string }>;
}

export async function GET(
_request: Request,
{ params }: PageProps,
) {
export async function GET(_request: Request, { params }: PageProps) {
const { facultyId } = await params;
const service = await createUsosService();
return NextResponse.json(
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/app/api/login/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cookies } from "next/headers";
import { cookies as cookiesPromise } from "next/headers";
import { redirect } from "next/navigation";

import { USOS_APPS_URL } from "@/env.mjs";
Expand All @@ -11,6 +11,7 @@ export async function GET() {
return redirect(`/`);
}
const token = await getRequestToken();
const cookies = await cookiesPromise();

if (typeof token.token !== "string" || typeof token.secret !== "string") {
return Response.json(
Expand All @@ -23,13 +24,13 @@ export async function GET() {
);
}

cookies().set("oauth_token", token.token, {
cookies.set("oauth_token", token.token, {
path: "/",
maxAge: 60 * 60 * 24 * 7,
httpOnly: true,
});

cookies().set("oauth_token_secret", token.secret, {
cookies.set("oauth_token_secret", token.secret, {
path: "/",
maxAge: 60 * 60 * 24 * 7,
httpOnly: true,
Expand Down
10 changes: 2 additions & 8 deletions frontend/src/app/api/profile/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ export const GET = async () => {
const usos = await createUsosService();
await usos.getProfile();

return NextResponse.json(
{ msg: "Authorized" },
{ status: 200 }
);
return NextResponse.json({ msg: "Authorized" }, { status: 200 });
} catch (e) {
return NextResponse.json(
{ msg: "Unauthorized" },
{ status: 401 }
);
return NextResponse.json({ msg: "Unauthorized" }, { status: 401 });
}
};
39 changes: 31 additions & 8 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type React from "react";
import type { Metadata } from "next";
import { Space_Grotesk } from "next/font/google";
import type React from "react";

import ClientProviders from "@/components/Providers";
import { env } from "@/env.mjs";
import { cn } from "@/lib/utils";
Expand All @@ -13,14 +14,24 @@ export const metadata: Metadata = {
template: "%s | Planer Solvro",
default: "Planer - utwórz swój plan zajęć na PWR!",
},
icons: "/favicon.ico",
icons: [
{
url: "/favicon.ico",
type: "image/x-icon",
},
{
sizes: "32x32",
type: "image/png",
url: "/favicon-32x32.png",
},
{
sizes: "16x16",
type: "image/png",
url: "/favicon-16x16.png",
},
],
description:
"Planer to strona stworzona z myślą o studentach PWR, którzy pragną w prosty i intuicyjny sposób zarządzać swoimi zapisami na kursy (za darmo!).",
authors: {
url: "https://kamilmarczak.pl",
name: "Kamil Marczak",
},
creator: "Kamil Marczak",
robots: "index, follow",
keywords: [
"planer",
Expand All @@ -42,7 +53,7 @@ export const metadata: Metadata = {
title: "Planer - utwórz swój plan zajęć na PWR!",
description:
"Planer to strona stworzona z myślą o studentach PWR, którzy pragną w prosty i intuicyjny sposób zarządzać swoimi zapisami na kursy (za darmo!).",
url: `https://kamilmarczak.pl/`,
url: `https://planer.solvro.pl/`,
images: [
{
url: "/og-image.png",
Expand All @@ -54,6 +65,18 @@ export const metadata: Metadata = {
locale: "pl_PL",
type: "website",
},
twitter: {
card: "summary_large_image",
title: "Planer - utwórz swój plan zajęć na PWR!",
description: "https://planer.solvro.pl/",
images: ["/og_image.png"],
},
appleWebApp: {
statusBarStyle: "black",
title: "Planer - utwórz swój plan zajęć na PWR!",
startupImage: "/apple_startup_image.png",
},
manifest: "/site.webmanifest",
};

const inter = Space_Grotesk({ subsets: ["latin"] });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use client";

import { useQuery } from "@tanstack/react-query";
import Link from "next/link";
import { useRef, useState } from "react";
import { MdArrowBack } from "react-icons/md";

import type { ApiFacultyDataGet } from "@/app/api/data/[facultyId]/route";
import { type ExtendedGroup } from "@/atoms/planFamily";
Expand All @@ -10,6 +12,7 @@ import { GroupsAccordionItem } from "@/components/GroupsAccordion";
import { PlanDisplayLink } from "@/components/PlanDisplayLink";
import { RegistrationCombobox } from "@/components/RegistrationCombobox";
import { Accordion } from "@/components/ui/accordion";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import {
Expand All @@ -24,9 +27,6 @@ import { faculties, lessonTypeToName } from "@/constants";
import { usePlan } from "@/lib/usePlan";
import { registrationReplacer } from "@/lib/utils";
import { Day, Frequency, LessonType } from "@/services/usos/types";
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { MdArrowBack } from "react-icons/md";

export default function CreateNewPlanPage({ planId }: { planId: string }) {
const plan = usePlan({
Expand Down Expand Up @@ -106,9 +106,11 @@ export default function CreateNewPlanPage({ planId }: { planId: string }) {
<div className="flex w-full max-w-[350px] flex-col items-center justify-center gap-2 px-2 md:ml-4 md:w-4/12 md:flex-col">
<div className="flex flex-col justify-start gap-3 md:w-full">
<div className="flex w-full items-end gap-2">
<div className="flex gap-2 items-end">
<div className="flex items-end gap-2">
<Link href="/plans">
<Button variant="outline" size="icon"><MdArrowBack size={20} /></Button>
<Button variant="outline" size="icon">
<MdArrowBack size={20} />
</Button>
</Link>
<form
className="flex w-full items-center justify-center"
Expand All @@ -127,7 +129,9 @@ export default function CreateNewPlanPage({ planId }: { planId: string }) {
name="name"
id="name"
placeholder="Wolne poniedziałki"
defaultValue={typeof window === "undefined" ? "" : plan.name}
defaultValue={
typeof window === "undefined" ? "" : plan.name
}
onChange={(e) => {
plan.changeName(e.currentTarget.value);
}}
Expand Down
21 changes: 10 additions & 11 deletions frontend/src/app/plans/create/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import React from 'react'
import type { Metadata } from 'next';
import { notFound } from 'next/navigation';
import CreateNewPlanPage from './_components/CreateNewPlanPage';
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import React from "react";

import CreateNewPlanPage from "./_components/CreateNewPlanPage";

interface PageProps {
params: Promise<{ id: string }>;
}

export const metadata: Metadata = {
title: "Kreator planu"
}
title: "Kreator planu",
};

export default async function CreateNewPlan({ params }: PageProps) {
const { id } = await params;
if (!id || typeof id !== 'string' || id.length === 0) {
return notFound()
if (!id || typeof id !== "string" || id.length === 0) {
return notFound();
}

return (
<CreateNewPlanPage planId={id} />
)
return <CreateNewPlanPage planId={id} />;
}
2 changes: 1 addition & 1 deletion frontend/src/app/plans/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function PlansLayout({

{children}

<div className="flex w-full py-10 items-center justify-center bg-mainbutton7 p-2">
<div className="flex w-full items-center justify-center bg-mainbutton7 p-2 py-10">
<p className="text-center text-white">
Made with ❤️ by{" "}
<a
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/app/plans/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";

import { atom, useAtom } from "jotai";
import { PlusIcon } from "lucide-react";
import { useRouter } from "next/navigation";

import { planFamily } from "@/atoms/planFamily";
import { plansIds } from "@/atoms/plansIds";
import { Plan } from "@/components/Plan";
import { PlusIcon } from "lucide-react";

const plansAtom = atom(
(get) => get(plansIds).map((id) => get(planFamily(id))),
Expand All @@ -27,15 +27,18 @@ const Plans = () => {
numberOfPlans: plans.length,
});

router.push(`/plans/create/${newPlan.id}`)
router.push(`/plans/create/${newPlan.id}`);
setPlans([...plans, newPlan]);
};

return (
<div className="container mx-auto max-h-full flex-1 flex-grow overflow-y-auto p-4">
<div className="flex flex-wrap items-center justify-center gap-4 sm:justify-start">
<button onClick={addNewPlan} className="flex h-[200px] w-[200px] items-center justify-center rounded-lg border-2 border-dashed border-gray-400 p-4 shadow-xl group hover:border-primary hover:bg-primary/5 transition-colors">
<PlusIcon className="w-24 h-24 text-gray-400 group-hover:text-primary transition-colors" />
<button
onClick={addNewPlan}
className="group flex h-[200px] w-[200px] items-center justify-center rounded-lg border-2 border-dashed border-gray-400 p-4 shadow-xl transition-colors hover:border-primary hover:bg-primary/5"
>
<PlusIcon className="h-24 w-24 text-gray-400 transition-colors group-hover:text-primary" />
</button>
{plans.map((plan) => (
<Plan key={plan.id} id={plan.id} name={plan.name} />
Expand Down
21 changes: 10 additions & 11 deletions frontend/src/app/plans/preview/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import React from 'react'
import type { Metadata } from 'next';
import { notFound } from 'next/navigation';
import SharePlanPage from './_components/SharePlanPage';
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import React from "react";

import SharePlanPage from "./_components/SharePlanPage";

interface PageProps {
params: Promise<{ id: string }>;
}

export const metadata: Metadata = {
title: "Podgląd planu"
}
title: "Podgląd planu",
};

export default async function SharePlan({ params }: PageProps) {
const { id } = await params;
if (!id || typeof id !== 'string' || id.length === 0) {
return notFound()
if (!id || typeof id !== "string" || id.length === 0) {
return notFound();
}

return (
<SharePlanPage planId={id} />
)
return <SharePlanPage planId={id} />;
}
15 changes: 9 additions & 6 deletions frontend/src/components/GroupsAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
import { cn } from "@/lib/utils";

import { buttonVariants } from "./ui/button";
import { Checkbox } from "./ui/checkbox";
import { cn } from "@/lib/utils";

export const GroupsAccordionItem = ({
registrationName,
Expand All @@ -36,15 +36,18 @@ export const GroupsAccordionItem = ({
onDelete?.();
}}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
if (e.key === "Enter" || e.key === " ") {
e.stopPropagation();
onDelete?.();
}
}}
className={cn(buttonVariants({
size: "icon",
variant: "outline",
}), "min-h-10 min-w-10")}
className={cn(
buttonVariants({
size: "icon",
variant: "outline",
}),
"min-h-10 min-w-10",
)}
>
<XIcon className="min-h-4 min-w-6" />
</div>
Expand Down
Loading

0 comments on commit b90e516

Please sign in to comment.