Skip to content

Commit

Permalink
chore: misc. improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 committed Nov 29, 2024
1 parent 0e08c51 commit 1286549
Show file tree
Hide file tree
Showing 21 changed files with 346 additions and 330 deletions.
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"lucide-react": "^0.303.0",
"next": "^14.0.2",
"lucide-react": "0.462.0",
"next": "^14.2.18",
"next-pwa": "^5.6.0",
"react": "^18.2.0",
"react-day-picker": "^8.10.0",
"react-dom": "^18.2.0",
"react-icons": "^4.12.0",
"react-lazy-load": "^4.0.1",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7"
Expand All @@ -38,16 +37,16 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@typescript-eslint/eslint-plugin": "8.16.0",
"@typescript-eslint/parser": "8.16.0",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint": "9.15.0",
"eslint-config-next": "14.0.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"postcss": "^8",
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.14",
"prettier-plugin-tailwindcss": "^0.6.9",
"tailwindcss": "^3.3.0",
"ts-node": "^10.9.2",
"typescript": "^5"
Expand Down
484 changes: 238 additions & 246 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";

import "./globals.css";
import Header from "@/components/Header";

import Footer from "@/components/Footer";
import GoogleAnalytics from "@/components/GoogleAnalytics";
import Header from "@/components/Header";
import { Toaster } from "@/components/ui/toaster";

const inter = Inter({ subsets: ["latin"], fallback: ["sans-serif"] });
Expand Down
12 changes: 5 additions & 7 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Button, buttonVariants } from "@/components/ui/button";

import { cn } from "@/lib/utils";
import { Search } from "lucide-react";
import Link from "next/link";

import ArticulableDefinition from "@/components/hero/ArticulableDefinition";
import Examples from "@/components/hero/Examples";
import Graphics from "@/components/hero/Graphics";
import ArticulableDefinition from "@/components/hero/ArticulableDefinition";
import { Button, buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { Search } from "lucide-react";

export default function Home() {
return (
Expand Down Expand Up @@ -54,7 +52,7 @@ export default function Home() {
buttonVariants({
size: "lg",
}),
"flex-center w-fit gap-2 text-lg text-white",
"flex-center w-fit gap-2 text-lg text-white"
)}
>
Discover Courses <Search className="h-5 w-5" />
Expand Down
6 changes: 3 additions & 3 deletions src/app/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Suspense } from "react";
import Search from "@/components/search/Search";
import React from "react";

const SearchPage = () => {
return (
<>
<Suspense>
<Search />
</>
</Suspense>
);
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { FaGithub } from "react-icons/fa6";
import { GithubIcon } from "lucide-react";

const Footer = () => {
return (
Expand All @@ -18,7 +18,7 @@ const Footer = () => {
referrerPolicy="no-referrer"
aria-label="GE-Z GitHub"
>
<FaGithub />
<GithubIcon />
</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Link from "next/link";
import React from "react";
import Link from "next/link";

const Header = () => {
return (
Expand Down
3 changes: 1 addition & 2 deletions src/components/hero/ArticulableDefinition.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import Link from "next/link";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { HelpCircle } from "lucide-react";

import Link from "next/link";

const ArticulableDefinition = () => {
return (
<Popover>
Expand Down
16 changes: 11 additions & 5 deletions src/components/hero/Examples.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use client";

import { useEffect, useState } from "react";
import Link from "next/link";
import {
Card,
CardDescription,
Expand All @@ -8,8 +10,6 @@ import {
CardTitle,
} from "@/components/ui/card";
import { DatabaseReturn, queryDatabase } from "@/lib/utils/query-db";
import Link from "next/link";
import { useEffect, useState } from "react";

interface Example {
name: string;
Expand Down Expand Up @@ -50,15 +50,18 @@ const ExampleCard = ({ example }: { example: Example }) => {
const fetchData = async () => {
const courses = await queryDatabase(
example.institution,
example.ge,
example.ge
);
setData(courses);
};
fetchData();
}, [example.name, example.ge]);

return (
<Link href={example.link} key={example.name + example.ge}>
<Link
href={example.link}
key={example.name + example.ge}
>
<Card className="w-[275px] drop-shadow-md hover:shadow-md sm:w-[300px]">
<CardHeader>
<CardTitle>{example.name}</CardTitle>
Expand All @@ -80,7 +83,10 @@ const Examples = () => {
return (
<div className="flex flex-wrap gap-4 px-6 sm:justify-center lg:px-8">
{EXAMPLES.map((example) => (
<ExampleCard key={example.institution + example.ge}example={example} />
<ExampleCard
key={example.institution + example.ge}
example={example}
/>
))}
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/search/Blurb.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useEffect, useState } from "react";

import { CourseObject, FilterValues } from "./Search";

interface BlurbProps {
filterData: (
data: CourseObject[],
filterValues: FilterValues,
filterValues: FilterValues
) => CourseObject[];
courses: CourseObject[] | undefined;
lastUpdated: number | undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/components/search/ScrollToTop.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import { FaChevronUp } from "react-icons/fa";
import { ChevronUpIcon } from "lucide-react";

const ScrollToTop = () => {
const [isVisible, setIsVisible] = useState(false);
Expand Down Expand Up @@ -36,7 +36,7 @@ const ScrollToTop = () => {
onClick={scrollToTop}
>
<div className="flex items-center justify-center">
<FaChevronUp style={{ color: "white" }} />
<ChevronUpIcon style={{ color: "white" }} />
<span className={"hidden px-2 group-hover:inline-flex"}>
<p className="line-clamp-1 overflow-hidden truncate text-clip font-medium tracking-wide text-white">
Back to top
Expand Down
32 changes: 16 additions & 16 deletions src/components/search/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"use client";

import React, { useEffect, useState } from "react";
import { SortDropdown } from "./filter/FilterComponents";
import Link from "next/link";
import { useRouter, useSearchParams } from "next/navigation";
import { queryDatabase } from "../../lib/utils/query-db";
import SearchResults from "./SearchResults";
import ScrollToTop from "./ScrollToTop";
import { FaFilter } from "react-icons/fa6";
import { SearchFilterPage, SearchFilters } from "./filter/Filters";
import Blurb from "./Blurb";
import { filterData } from "../../lib/utils/filter";
import { analyticsEnum, logAnalytics } from "@/lib/analytics";
import { UNIVERSITY_GE } from "@/lib/constants";
import { getDismissedRecently, getNumSearches } from "@/lib/utils/search";
import { ListFilterIcon } from "lucide-react";

import { analyticsEnum, logAnalytics } from "@/lib/analytics";
import { useToast } from "../ui/use-toast";
import { filterData } from "../../lib/utils/filter";
import { queryDatabase } from "../../lib/utils/query-db";
import { ToastAction } from "../ui/toast";
import Link from "next/link";
import { useToast } from "../ui/use-toast";
import Blurb from "./Blurb";
import { SortDropdown } from "./filter/FilterComponents";
import { SearchFilterPage, SearchFilters } from "./filter/Filters";
import ScrollToTop from "./ScrollToTop";
import SearchResults from "./SearchResults";
import { SearchSelect } from "./SearchSelect";
import { getDismissedRecently, getNumSearches } from "@/lib/utils/search";

export interface CourseObject {
sendingInstitution: string;
Expand Down Expand Up @@ -99,7 +99,7 @@ const Search = () => {
const searchGE = searchParams.get("ge");

const [university, setUniversity] = useState(
searchUniversity || Object.keys(UNIVERSITY_GE)[0],
searchUniversity || Object.keys(UNIVERSITY_GE)[0]
);
const [ge, setGE] = useState(searchGE || UNIVERSITY_GE[university][4]);

Expand Down Expand Up @@ -236,13 +236,13 @@ const Search = () => {

window.localStorage.setItem(
"enjoymentDismissalTime",
Date.now().toString(),
Date.now().toString()
);
}

window.localStorage.setItem(
"gezSearches",
(numSearches + 1).toString(),
(numSearches + 1).toString()
);
} catch (error) {
setLoading(false);
Expand Down Expand Up @@ -337,7 +337,7 @@ const Search = () => {
onClick={handleFilterButtonClick}
className="flex items-center gap-2 rounded-full border-2 bg-primary px-4 py-2 text-white transition-all active:border-primary active:bg-transparent active:text-primary xl:hidden"
>
<FaFilter />
<ListFilterIcon />
Search Filters
</button>

Expand Down
15 changes: 8 additions & 7 deletions src/components/search/SearchResults.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// import LazyLoad from "react-lazy-load";
import { FaUpRightFromSquare } from "react-icons/fa6";
import { format } from "date-fns";
import { ExternalLinkIcon } from "lucide-react";

import { CourseObject } from "./Search";
import Tags from "./Tags";
import { format } from "date-fns";

const formatTime = (date: number) => {
return format(new Date(date), "MMM d");
Expand Down Expand Up @@ -93,10 +94,10 @@ const SearchResults = (props: SearchResultsProps) => {
obj.category;

return category.includes(
":",
":"
)
? category.split(
": ",
": "
)[1]
: category;
})
Expand All @@ -109,7 +110,7 @@ const SearchResults = (props: SearchResultsProps) => {
</div>
<div className="flex flex-row gap-2 text-base font-light">
{result.articulatesTo.join(
", ",
", "
)}
</div>
</div>
Expand All @@ -132,7 +133,7 @@ const SearchResults = (props: SearchResultsProps) => {
className="flex flex-row items-center gap-2"
>
Assist
<FaUpRightFromSquare />
<ExternalLinkIcon />
</a>
</button>
<button className="rounded-lg border-2 px-4 py-1 text-primary transition-all active:border-primary active:bg-primary active:text-white">
Expand All @@ -143,7 +144,7 @@ const SearchResults = (props: SearchResultsProps) => {
className="flex flex-row items-center gap-2"
>
CVC
<FaUpRightFromSquare />
<ExternalLinkIcon />
</a>
</button>
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/components/search/SearchSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export const SearchSelect = (props: DropdownComponentProps) => {

return (
<div className="relative flex h-12 w-[300px] md:h-16">
<Select value={value} onValueChange={onChange}>
<Select
value={value}
onValueChange={onChange}
>
<SelectTrigger className="h-full w-full overflow-ellipsis rounded-xl border-2 border-gray px-4 text-left text-base md:text-2xl">
<SelectValue placeholder={placeholder} />
</SelectTrigger>
Expand Down
8 changes: 4 additions & 4 deletions src/components/search/Tags.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { FaChalkboard, FaAward, FaHandHoldingDollar } from "react-icons/fa6";
import { AwardIcon, HandCoinsIcon, PresentationIcon } from "lucide-react";

interface TagsProps {
tag: string;
Expand All @@ -12,7 +12,7 @@ const Tags = (props: TagsProps) => {
return (
<div className="flex w-fit flex-row items-center gap-2 whitespace-nowrap rounded-full border-2 border-gray px-4 py-1 font-medium text-gray">
<div className="text-black">
<FaChalkboard />
<PresentationIcon />
</div>
<div>Online Tutoring</div>
</div>
Expand All @@ -23,7 +23,7 @@ const Tags = (props: TagsProps) => {
return (
<div className="flex w-fit flex-row items-center gap-2 whitespace-nowrap rounded-full border-2 border-gray px-4 py-1 font-medium text-gray">
<div className="text-black">
<FaHandHoldingDollar />
<HandCoinsIcon />
</div>
<div>Zero Textbook Cost</div>
</div>
Expand All @@ -34,7 +34,7 @@ const Tags = (props: TagsProps) => {
return (
<div className="flex w-fit flex-row items-center gap-2 whitespace-nowrap rounded-full border-2 border-gray px-4 py-1 font-medium text-gray">
<div className="text-black">
<FaAward />
<AwardIcon />
</div>
<div>Quality Reviewed</div>
</div>
Expand Down
Loading

0 comments on commit 1286549

Please sign in to comment.