Skip to content

Commit

Permalink
feat: created post login user profile component
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonNotJson committed Nov 7, 2023
1 parent 1b206e3 commit cd6b478
Show file tree
Hide file tree
Showing 12 changed files with 592 additions and 60 deletions.
84 changes: 41 additions & 43 deletions apps/career/src/components/common/SchoolFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React, { useEffect, useState } from "react";
import React, { useEffect, useState } from "react"
import {
gradSchools,
otherSchools,
undergradSchools,
} from "@app/constants/schools";
import { School } from "@app/constants/schools";
import getSchoolIconPath from "@app/utils/get-school-icon-path";
import { useRecoilState } from "recoil";
import { currentSchoolState } from "@app/recoil/atoms";
} from "@app/constants/schools"
import { School } from "@app/constants/schools"
import getSchoolIconPath from "@app/utils/get-school-icon-path"

const schoolsByCategory = [
{
Expand All @@ -25,40 +23,40 @@ const schoolsByCategory = [
title: "Other",
schools: otherSchools,
},
];
]

type SchoolBlockProps = {
school: School;
};
school: School
}

type SchoolFilterFormProps = {
isOpen: boolean;
setOpen: (isOpen: boolean) => void;
setSchool: (school: string) => void;
};
isOpen: boolean
setOpen: (isOpen: boolean) => void
setSchool: (school: string) => void
}

type TabMenuProps = {
activeTab: number;
onClickTab: (itemId: number) => void;
};
activeTab: number
onClickTab: (itemId: number) => void
}

type TabItemProps = {
title: string;
isActive: boolean;
onClick: () => void;
};
title: string
isActive: boolean
onClick: () => void
}

const TabItem = ({ title, isActive, onClick }: TabItemProps) => (
<li className="mr-2" onClick={onClick}>
<a href="#" className={isActive ? "tab-item-active" : "tab-item"}>
{title}
</a>
</li>
);
)

const TabMenu = ({ activeTab, onClickTab }: TabMenuProps) => (
<div className="text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 dark:border-gray-700 standard-style">
<ul className="flex flex-wrap -mb-px">
<div className="standard-style border-b border-gray-200 text-center text-sm font-medium text-gray-500 dark:border-gray-700 dark:text-gray-400">
<ul className="-mb-px flex flex-wrap">
{schoolsByCategory.map((schoolsSlugPair, i) => (
<TabItem
key={schoolsSlugPair.slug}
Expand All @@ -69,7 +67,7 @@ const TabMenu = ({ activeTab, onClickTab }: TabMenuProps) => (
))}
</ul>
</div>
);
)

// const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
// event.preventDefault();
Expand All @@ -83,73 +81,73 @@ const SchoolFilterForm = ({
setOpen,
setSchool,
}: SchoolFilterFormProps) => {
const [schoolsCategoryId, setSchoolsCategoryId] = useState(0);
const [tempSelectedSchool, setTempSelectedSchool] = useState("");
const [schoolsCategoryId, setSchoolsCategoryId] = useState(0)
const [tempSelectedSchool, setTempSelectedSchool] = useState("")

const toggleGroup = (school: string) => {
if (tempSelectedSchool === school) {
setTempSelectedSchool(""); // Deselect
setTempSelectedSchool("") // Deselect
} else {
setTempSelectedSchool(school); // Select
setTempSelectedSchool(school) // Select
}
};
}

const applySelection = () => {
setSchool(tempSelectedSchool); // Update the state using setSchool
setTempSelectedSchool(""); // Clear the temporary state
setOpen(false);
};
setSchool(tempSelectedSchool) // Update the state using setSchool
setTempSelectedSchool("") // Clear the temporary state
setOpen(false)
}

const SchoolBlock = ({ school }: SchoolBlockProps) => (
<div
className={
(tempSelectedSchool === school
? "border-light-main dark:border-dark-main"
: "border-light-bgMain dark:border-dark-bgMain") +
" border-2 rounded grow-0 shrink-0 m-2 cursor-pointer standard-style-schoolfilter"
" standard-style-schoolfilter m-2 shrink-0 grow-0 cursor-pointer rounded border-2"
}
onClick={() => toggleGroup(school)}
>
<img src={getSchoolIconPath(school, "en")} width={70} height={70} />
</div>
);
)

return (
<div
className={
!isOpen
? "hidden "
: "fixed top-0 left-0 right-0 w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-modal md:h-full z-40"
: "h-modal fixed top-0 left-0 right-0 z-40 w-full overflow-y-auto overflow-x-hidden p-4 md:inset-0 md:h-full"
}
>
<div
className="fixed top-0 bottom-0 left-0 right-0 bg-zinc-500 opacity-50 z-0"
className="fixed top-0 bottom-0 left-0 right-0 z-0 bg-zinc-500 opacity-50"
onClick={() => setOpen(false)}
/>
<div
className="fixed rounded-lg top-1/4 left-8 right-8 md:left-36 md:right-36 lg:left-1/4 lg:right-1/4 bg-light-bgMain dark:bg-dark-bgMain z-10"
className="fixed top-1/4 left-8 right-8 z-10 rounded-lg bg-light-bgMain dark:bg-dark-bgMain md:left-36 md:right-36 lg:left-1/4 lg:right-1/4"
onClick={(e) => e.stopPropagation()}
>
<TabMenu
activeTab={schoolsCategoryId}
onClickTab={setSchoolsCategoryId}
/>
<div className="flex flex-row flex-wrap standard-style">
<div className="standard-style flex flex-row flex-wrap">
{schoolsByCategory[schoolsCategoryId].schools.map((school, i) => (
<SchoolBlock key={i} school={school} />
))}
</div>
{tempSelectedSchool && (
<button
className="bg-light-main text-white rounded-lg px-4 py-2 m-2 text-4xl"
className="m-2 rounded-lg bg-light-main px-4 py-2 text-4xl text-white"
onClick={applySelection}
>
Apply
</button>
)}
</div>
</div>
);
};
)
}

export default SchoolFilterForm;
export default SchoolFilterForm
6 changes: 2 additions & 4 deletions apps/career/src/components/jobdetail/CompanyOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CompanyOverview = ({ job }: Props) => {

return (
<>
<div className="mt-14 rounded border border-gray-100/50 dark:border-neutral-600">
<div className="standard-style mt-14 rounded border">
<h1 className="p-6 text-center text-4xl font-bold">Company Overview</h1>
<div className="text-center">
<div className="mx-auto h-[55px] w-[55px] rounded-full">
Expand All @@ -45,9 +45,7 @@ const CompanyOverview = ({ job }: Props) => {
</div>
{jobInformation.map((info, index) => (
<div key={index} className="mt-4">
<h3 className="mb-0 text-3xl text-gray-900 dark:text-gray-50">
{info.label}
</h3>
<h3 className="mb-0 text-3xl ">{info.label}</h3>
{info.isLink ? (
<a
href={
Expand Down
2 changes: 1 addition & 1 deletion apps/career/src/components/jobdetail/JobOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const JobOverview = ({ job }: Props) => {

return (
<>
<div className="mt-14 rounded border border-gray-100/30 dark:border-neutral-600/80">
<div className="standard-style mt-14 rounded border">
<div className="p-6">
<h1 className="m-2 text-2xl font-bold">Job Overview</h1>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion apps/career/src/components/joblist/JobCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const JobCard: React.FC<JobCardProps> = ({
// Include additional props as necessary
}) => {
return (
<div className="job-card-standard h-full">
<div className="job-card-standard standard-style h-full">
<div className="p-4">
<div className="grid h-auto w-full grid-cols-12 items-center gap-x-11 sm:h-36 sm:gap-24">
{/* Logo Section */}
Expand Down
4 changes: 2 additions & 2 deletions apps/career/src/components/joblist/JobCardFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface JobFooterProps {
const JobCardFooter: React.FC<JobFooterProps> = ({ jobID }) => {
return (
<Link to={`/${jobID}`}>
<div className=" bg-gray-50 px-4 py-4 dark:bg-neutral-700">
<div className="col-span-12 text-right lg:col-span-6 lg:mt-0">
<div className="bg-gray-100 px-4 py-4 dark:bg-neutral-700">
<div className="col-span-12 text-right text-light-text1 dark:text-dark-text1 lg:col-span-6 lg:mt-0">
<span>Apply</span>
<KeyboardDoubleArrowRightIcon />
</div>
Expand Down
146 changes: 138 additions & 8 deletions apps/career/src/components/joblist/Profile.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,145 @@
import React from "react"
import React, { useState } from "react"
import getSchoolIconPath from "@app/utils/get-school-icon-path"
import PersonIcon from "@mui/icons-material/Person"
import EmailIcon from "@mui/icons-material/Email"
import GradeIcon from "@mui/icons-material/Grade"
import LanguageIcon from "@mui/icons-material/Language"
import StarBorderIcon from "@mui/icons-material/StarBorder"
import SchoolIcon from "@mui/icons-material/School"

type Props = {}
type UserProfile = {
name: string
school: string
email: string
grade: string
classOf: string
languages: Array<{ language: string; level: string }>
interests: string[]
}

const Profile = (props: Props) => {
const Profile = () => {
const [profile, setProfile] = useState<UserProfile>({
name: "Alex Johnson",
school: "SILS",
email: "[email protected]",
grade: "3",
classOf: "2025",
languages: [
{ language: "English", level: "Fluent" },
{ language: "Japanese", level: "N4" },
// Add more as needed
],
interests: ["Marketing", "IT"],
// Add more as needed
})
const profileInformation = [
{
label: "Name",
content: profile.name,
icon: (
<PersonIcon
fontSize="large"
className="rounded-full bg-blue-300 p-2 text-blue-900"
/>
),
},
{
label: "Email",
content: profile.email,
icon: (
<EmailIcon
fontSize="large"
className="rounded-full bg-blue-300 p-2 text-blue-900"
/>
),
},
{
label: "Year",
content: profile.grade,
icon: (
<GradeIcon
fontSize="large"
className="rounded-full bg-blue-300 p-2 text-blue-900"
/>
),
},
{
label: "Class Of",
content: profile.classOf,
icon: (
<SchoolIcon
fontSize="large"
className="rounded-full bg-blue-300 p-2 text-blue-900"
/>
),
},
{
label: "Languages",
content: (
<ul className="list-disc pl-4">
{profile.languages.map((lang, index) => (
<li key={index}>{`${lang.language} - ${lang.level}`}</li>
))}
</ul>
),
icon: (
<LanguageIcon
fontSize="large"
className="rounded-full bg-blue-300 p-2 text-blue-900"
/>
),
},
{
label: "Interests",
content: (
<ul className="list-disc pl-4">
{profile.interests.map((interest, index) => (
<li key={index}>{interest}</li>
))}
</ul>
),
icon: (
<StarBorderIcon
fontSize="large"
className="rounded-full bg-blue-300 p-2 text-blue-900"
/>
),
},
// Add more sections as needed
]
return (
<>
<div className="mt-4 rounded border border-gray-100/50 dark:border-neutral-600">
<h1 className="p-6 text-center text-2xl font-bold">Profile</h1>
<div className="text-center"></div>
<div className="standard-style mt-4 rounded border">
<h1 className="p-6 text-center text-2xl font-bold">Profile</h1>
<div className="ml-2">
<div className="text-center">
<div className="inline-flex w-full justify-center">
<img
className="flex h-[55px] w-[55px] object-cover p-2"
alt={`${profile.school} Icon`}
src={getSchoolIconPath("SILS", "en")}
/>
</div>
</div>
</div>
<div className="p-4">
<ul>
{profileInformation.map((info, index) => (
<li key={index} className="mt-6 flex items-center">
<i className="text-gray-500">{info.icon}</i>
<div className="ml-4">
<h2 className="mb-2 text-2xl font-bold">{info.label}</h2>
<h2 className="text-2xl">{info.content}</h2>
</div>
</li>
))}
</ul>
<div className="mt-8 space-y-2">
<div className="btn w-full border-transparent bg-blue-300 p-2 text-xl capitalize text-blue-900 hover:-translate-y-1.5">
Edit Profile
</div>
</div>
</div>
</>
</div>
)
}

Expand Down
Loading

0 comments on commit cd6b478

Please sign in to comment.