generated from ics-software-engineering/nextjs-application-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
1,037 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
[![ci-nextjs-application-template](https://github.com/ics-software-engineering/nextjs-application-template/actions/workflows/ci.yml/badge.svg)](https://github.com/ics-software-engineering/nextjs-application-template/actions/workflows/ci.yml) | ||
|
||
For details, please see http://ics-software-engineering.github.io/nextjs-application-template/. | ||
# bowfolios-nextjs |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* eslint-disable import/extensions */ | ||
import { Container } from 'react-bootstrap'; | ||
import { getServerSession } from 'next-auth'; | ||
import { prisma } from '@/lib/prisma'; | ||
import AddProjectForm from '@/components/AddProjectForm'; | ||
import { loggedInProtectedPage } from '@/lib/page-protection'; | ||
import { authOptions } from '../api/auth/[...nextauth]/route'; | ||
|
||
const AddProjectPage = async () => { | ||
const session = await getServerSession(authOptions); | ||
loggedInProtectedPage( | ||
session as { | ||
user: { email: string; id: string; randomKey: string }; | ||
} | null | ||
); | ||
const interests = await prisma.interest.findMany(); | ||
const participants = await prisma.user.findMany(); | ||
|
||
return ( | ||
<Container> | ||
<h1 className="text-center">Add Project</h1> | ||
<AddProjectForm interests={interests} participants={participants} /> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default AddProjectPage; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable import/extensions */ | ||
import { getServerSession } from 'next-auth'; | ||
import { Container } from 'react-bootstrap'; | ||
import { prisma } from '@/lib/prisma'; | ||
import FilterProfileForm from '@/components/FilterProfileForm'; | ||
import { loggedInProtectedPage } from '@/lib/page-protection'; | ||
import { authOptions } from '../api/auth/[...nextauth]/route'; | ||
|
||
const FilterPage = async () => { | ||
const session = await getServerSession(authOptions); | ||
loggedInProtectedPage( | ||
session as { | ||
user: { email: string; id: string; randomKey: string }; | ||
} | null | ||
); | ||
const allInterests = await prisma.interest.findMany(); | ||
const allProfiles = await prisma.profile.findMany(); | ||
const allProfileInterests = await prisma.profileInterest.findMany(); | ||
const allProjects = await prisma.project.findMany(); | ||
const allProfileProjects = await prisma.profileProject.findMany(); | ||
return ( | ||
<Container> | ||
<FilterProfileForm | ||
interests={allInterests} | ||
profiles={allProfiles} | ||
profileInterests={allProfileInterests} | ||
profileProjects={allProfileProjects} | ||
projects={allProjects} | ||
/> | ||
</Container> | ||
); | ||
}; | ||
export default FilterPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { Container, Col } from 'react-bootstrap'; | ||
import { PageIDs } from '../../utilities/ids'; | ||
import pageStyle from '../../utilities/pageStyle'; | ||
|
||
const HomePage = () => ( | ||
<Container id={PageIDs.homePage} className="justify-content-center" style={pageStyle}> | ||
<Col> | ||
<Col className="justify-content-center text-center"> | ||
<h2>Your Profile</h2> | ||
</Col> | ||
</Col> | ||
</Container> | ||
); | ||
|
||
export default HomePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-disable import/extensions */ | ||
import React from 'react'; | ||
import { getServerSession } from 'next-auth'; | ||
import { prisma } from '@/lib/prisma'; | ||
import { loggedInProtectedPage } from '@/lib/page-protection'; | ||
import { authOptions } from '../api/auth/[...nextauth]/route'; | ||
import HomePage from './HomePage'; | ||
|
||
const HomePageHelper = async () => { | ||
const session = await getServerSession(authOptions); | ||
// console.log(session); | ||
loggedInProtectedPage( | ||
session as { | ||
user: { email: string; id: string; randomKey: string }; | ||
} | null | ||
); | ||
const email = (session && session.user && session.user.email) || ''; | ||
const profile = await prisma.profile.findUnique({ | ||
where: { email }, | ||
}); | ||
const interests = await prisma.interest.findMany(); | ||
// const allInterestNames = interests.map((interest) => interest.name); | ||
const projects = await prisma.project.findMany(); | ||
// const allProjectNames = projects.map((project) => project.name); | ||
const profileInterests = await prisma.profileInterest.findMany({ | ||
where: { profileId: profile!.id }, | ||
}); | ||
const profileInterestNames = profileInterests.map((profileInterest) => { | ||
const i = interests.find((interest) => interest.id === profileInterest.interestId); | ||
return i ? i.name : ''; | ||
}); | ||
console.log(profileInterestNames); | ||
const profileProjects = await prisma.profileProject.findMany({ | ||
where: { profileId: profile!.id }, | ||
}); | ||
const profileProjectNames = profileProjects.map((profileProject) => { | ||
const p = projects.find((project) => project.id === profileProject.projectId); | ||
return p ? p.name : ''; | ||
}); | ||
console.log( | ||
// interests, | ||
// projects, | ||
// profileInterests, | ||
// profileProjects, | ||
profileInterestNames, | ||
profileProjectNames | ||
); | ||
return <HomePage />; | ||
}; | ||
|
||
export default HomePageHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use client'; | ||
|
||
import { Card } from 'react-bootstrap'; | ||
// eslint-disable-next-line import/extensions | ||
import TooltipImage from '@/components/TooltipImage'; | ||
import { InterestCardData } from './InterestCardData'; | ||
|
||
const InterestCard = ({ interest }: { interest: InterestCardData }) => ( | ||
<Card> | ||
<Card.Body> | ||
<Card.Title style={{ marginTop: '0px' }}>{interest.name}</Card.Title> | ||
{interest.profilePictures.map((p) => ( | ||
<TooltipImage | ||
className="mx-1" | ||
key={`profile-${p!.name}`} | ||
src={p?.picture ? p.picture : ''} | ||
name={p!.name} | ||
width={50} | ||
roundedCircle | ||
/> | ||
))} | ||
{interest.projectPictures.map((p) => ( | ||
<TooltipImage | ||
className={undefined} | ||
key={`project-${p!.name}`} | ||
src={p?.picture ? p.picture : ''} | ||
name={p!.name} | ||
width={50} | ||
roundedCircle | ||
/> | ||
))} | ||
</Card.Body> | ||
</Card> | ||
); | ||
export default InterestCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export type PictureInfo = { | ||
name: string; | ||
picture: string | null; | ||
}; | ||
|
||
export type InterestCardData = { | ||
name: string; | ||
profilePictures: (PictureInfo | null)[]; | ||
projectPictures: (PictureInfo | null)[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Interest } from '@prisma/client'; | ||
// eslint-disable-next-line import/extensions | ||
import { prisma } from '@/lib/prisma'; | ||
import InterestCard from './InterestCard'; | ||
|
||
const InterestCardHelper = async ({ interest }: { interest: Interest }) => { | ||
const profileInterests = await prisma.profileInterest.findMany({ | ||
where: { interestId: interest.id }, | ||
}); | ||
// console.log('profileInterests: ', profileInterests); | ||
const profiles = await prisma.profile.findMany({ | ||
where: { id: { in: profileInterests.map((profileInterest) => profileInterest.profileId) } }, | ||
}); | ||
// console.log('profiles: ', profiles); | ||
const profileImages = profiles.map((profile) => ({ name: profile.email, picture: profile.picture })); | ||
// console.log('profileImages: ', profileImages); | ||
const projectInterests = await prisma.projectInterest.findMany({ | ||
where: { interestId: interest.id }, | ||
}); | ||
const projects = await prisma.project.findMany({ | ||
where: { id: { in: projectInterests.map((projectInterest) => projectInterest.projectId) } }, | ||
}); | ||
// console.log('projects: ', projects); | ||
const projectImages = projects.map((project) => ({ name: project.name, picture: project.picture })); | ||
// console.log('projectImages: ', projectImages); | ||
const interestData = { | ||
name: interest.name, | ||
profilePictures: profileImages, | ||
projectPictures: projectImages, | ||
}; | ||
return <InterestCard interest={interestData} />; | ||
}; | ||
|
||
export default InterestCardHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { prisma } from '@/lib/prisma'; | ||
import { Container, Row } from 'react-bootstrap'; | ||
import { PageIDs } from '@/utilities/ids'; | ||
import { pageStyle } from '@/utilities/pageStyle'; | ||
import InterestCardHelper from './InterestCardHelper'; | ||
|
||
const InterestsPage = async () => { | ||
const interests = await prisma.interest.findMany(); | ||
interests.sort((a, b) => a.name.localeCompare(b.name)); | ||
console.log(interests); | ||
return ( | ||
<Container id={PageIDs.interestsPage} style={pageStyle}> | ||
<Row xs={1} md={2} lg={4} className="g-2"> | ||
{interests.map((interest) => (<InterestCardHelper key={interest.id} interest={interest} />))} | ||
</Row> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default InterestsPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Project } from '@prisma/client'; | ||
|
||
export type ProfileCardData = { | ||
email: string; | ||
bio: string | null; | ||
firstName: string | null; | ||
lastName: string | null; | ||
picture: string | null; | ||
title: string | null; | ||
projects: Project[]; | ||
interests: string[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Profile } from '@prisma/client'; | ||
|
||
export type ProjectCardData = { | ||
name: string; | ||
homepage: string | null; | ||
picture: string | null; | ||
description: string | null; | ||
interests: string[]; | ||
participants: Profile[]; | ||
}; |
Oops, something went wrong.