Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
576 changes: 0 additions & 576 deletions src/actions.js

This file was deleted.

1 change: 0 additions & 1 deletion src/actions/authorize.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/admin/layout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { auth } from "@/authentication";
import { auth } from "@/server/auth/config";

export default async function AdminLayout({ children }) {
const session = await auth();
Expand Down
3 changes: 2 additions & 1 deletion src/app/admin/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// import styles
import styles from "../../components/admin/semesters/semesters.module.css";
import Link from "next/link";
import { getFilteredUsers, getAllSemesters, getSemesterFromName, getFilteredThursdays } from "../../actions";
import { getFilteredUsers, getAllSemesters, getFilteredThursdays } from "@/server/shared";
import { getSemesterFromName } from "@/server/general";

import Header from "../../components/Header";

Expand Down
5 changes: 3 additions & 2 deletions src/app/admin/semesters/[id]/edit/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import SemesterForm from "../../../../../components/admin/semesters/SemesterForm";

import { getSemester, getAllUsers, editSemester } from "../../../../../actions";
import { getSemester, getAllUsers } from "@/server/general";
import { editSemester } from "@/server/admin";
import { redirect } from "next/navigation";

export default async function EditSemester({ params }) {
Expand All @@ -22,6 +23,6 @@ export default async function EditSemester({ params }) {

async function onSubmitEditSemester(data) {
"use server";
editSemester(data);
await editSemester(data);
redirect("/admin");
}
6 changes: 4 additions & 2 deletions src/app/admin/semesters/add/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import SemesterForm from "../../../../components/admin/semesters/SemesterForm";

import { getAllSemesters, getAllUsers, addSemester } from "../../../../actions";
import { getAllSemesters } from "@/server/shared";
import { getAllUsers } from "@/server/general";
import { addSemester } from "@/server/admin";
import { redirect } from "next/navigation";

export default async function AddSemester() {
Expand All @@ -27,7 +29,7 @@ export default async function AddSemester() {
async function onSubmitAddSemester(data) {
"use server";
data.dates = generateThursdays(data.dates);
addSemester(data);
await addSemester(data);
redirect("/admin");
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import { handlers } from "@/authentication";
import { handlers } from "@/server/auth/config";
export const { GET, POST } = handlers;
4 changes: 2 additions & 2 deletions src/app/api/token/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// /app/api/token/route.ts
import { auth } from "@/authentication";
import { prisma } from "../../../database";
import { auth } from "@/server/auth/config";
import { prisma } from "@/server/database";
import { NextResponse } from "next/server";

export async function GET() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "@ant-design/v5-patch-for-react-19";
import "antd/dist/reset.css";

import { auth } from "@/authentication";
import { auth } from "@/server/auth/config";

import "./globals.css";

Expand Down
4 changes: 3 additions & 1 deletion src/app/thursdays/[thursday_id]/edit/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { notFound, redirect } from "next/navigation";

import ThursdayForm from "../../../../components/thursdays/ThursdayForm";

import { getThursday, getAllGroups, getAllSemesters, editThursday } from "../../../../actions";
import { getAllGroups } from "@/server/general";
import { getThursday, getAllSemesters } from "@/server/shared";
import { editThursday } from "@/server/admin";

export default async function EditThursday({ params }) {
const { thursday_id } = await params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { notFound, redirect } from "next/navigation";

import GroupForm from "../../../../../../components/thursdays/groups/GroupForm";

import { getGroup, getAllUsers, getAllWorks, getAllSemesters, editGroup } from "../../../../../../actions";
import { getAllUsers, getAllWorks } from "@/server/general";
import { getGroup, getAllSemesters } from "@/server/shared";
import { editGroup } from "@/server/admin";

export default async function EditGroup({ params }) {
const { group_id } = await params;
Expand Down
4 changes: 3 additions & 1 deletion src/app/thursdays/[thursday_id]/groups/add/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import GroupForm from "../../../../../components/thursdays/groups/GroupForm";

import { getAllUsers, getAllWorks, getAllSemesters, addGroup, getThursday } from "../../../../../actions";
import { getAllUsers, getAllWorks } from "@/server/general";
import { getAllSemesters, getThursday } from "@/server/shared";
import { addGroup } from "@/server/admin";
import { redirect } from "next/navigation";

export default async function AddGroup({ params }) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/thursdays/[thursday_id]/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { notFound } from "next/navigation";

import { getThursday } from "../../../actions";
import { getThursday } from "@/server/shared";

import ThursdayCard from "../../../components/ThursdayCard";

Expand Down
3 changes: 1 addition & 2 deletions src/app/thursdays/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import styles from "../../components/thursdays/thursdays.module.css";
import Button from "@/components//Button";
import { getFilteredThursdays } from "../../actions";
import { getAllSemesters } from "../../actions";
import { getFilteredThursdays, getAllSemesters } from "@/server/shared";
import Header from "@/components/Header";
import Input from "@/components/Input";
import Select from "@/components/Select";
Expand Down
7 changes: 5 additions & 2 deletions src/app/users/[username]/edit/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { notFound, redirect } from "next/navigation";
import UserForm from "../../../../components/users/UserForm";
import Button from "@/components//Button";

import { auth } from "@/authentication";
import { auth } from "@/server/auth/config";

import { handleImageUpload, getUser, editUser, removeUser, getCurrentUser } from "../../../../actions";
import { handleImageUpload, editUser } from "@/server/general";
import { getUser } from "@/server/shared";
import { getCurrentUser } from "@/server/auth/context";
import { removeUser } from "@/server/admin";

export default async function EditUser({ params }) {
const { username } = await params;
Expand Down
3 changes: 2 additions & 1 deletion src/app/users/[username]/page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getUser, getCurrentUser } from "../../../actions";
import { getUser } from "@/server/shared";
import { getCurrentUser } from "@/server/auth/context";
import { notFound, redirect } from "next/navigation";
import Button from "@/components//Button";
import styles from "../../../components/users/User.module.css";
Expand Down
5 changes: 3 additions & 2 deletions src/app/users/add/page.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { redirect } from "next/navigation";
import UserForm from "@/components/users/UserForm";
import { addUser, handleImageUpload } from "../../../actions";
import { handleImageUpload } from "@/server/general";
import { addUser } from "@/server/admin";
import path from "path";
import { copyFile } from "fs/promises";

import { auth } from "@/authentication";
import { auth } from "@/server/auth/config";

export default async function AddUser() {
const session = await auth();
Expand Down
6 changes: 2 additions & 4 deletions src/app/users/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { getFilteredUsers } from "../../actions";

import { getAllSemesters } from "../../actions";
import { getFilteredUsers, getAllSemesters } from "@/server/shared";
import Header from "@/components/Header";
import Button from "@/components/Button";
import Input from "@/components/Input";
Expand All @@ -9,7 +7,7 @@ import Select from "@/components/Select";
import styles from "../../components/users/Users.module.css";
import UserCard from "../../components/users/UserCard";

import { auth } from "@/authentication";
import { auth } from "@/server/auth/config";

export default async function Users({ searchParams }) {
const filters = await searchParams;
Expand Down
2 changes: 1 addition & 1 deletion src/components/AuthenticationButtons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { logIn, logOut } from "@/actions/authenticate";
import { logIn, logOut } from "@/server/auth/actions";

import Button from "@/components/Button";

Expand Down
2 changes: 1 addition & 1 deletion src/components/GroupCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styles from "./thursdays/thursdaycard.module.css";
import Button from "./Button";
import Header from "./Header";
import PresentationCard from "./PresentationCard";
import { auth } from "@/authentication";
import { auth } from "@/server/auth/config";
export default async function GroupCard({ thursday, group }) {
const session = await auth();
var producers = group.producers.filter((user) => user.admin === false);
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styles from "./NavBar.module.css";
import Button from "@/components/Button";
import NavSelect from "./NavSelect";

import { auth } from "@/authentication";
import { auth } from "@/server/auth/config";

export default async function NavBar() {
const session = await auth();
Expand Down
2 changes: 1 addition & 1 deletion src/components/ThursdayCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styles from "./thursdays/thursdaycard.module.css";
import Button from "./Button";
import Header from "./Header";
import GroupCard from "./GroupCard";
import { auth } from "@/authentication";
import { auth } from "@/server/auth/config";

export default async function ThursdayCard({ thursday }) {
const session = await auth();
Expand Down
4 changes: 2 additions & 2 deletions src/components/admin/semesters/SemesterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function SemesterForm({ onSubmit, semester, usersFromCurrentSemes
};
return (
<FormWrapper
action={(formData) => {
action={async (formData) => {
const data = {
name: formData.get("name"),
dates: [dates[0].$d, dates[1].$d],
Expand All @@ -38,7 +38,7 @@ export default function SemesterForm({ onSubmit, semester, usersFromCurrentSemes
if (semester) {
data.id = semester.id;
}
onSubmit(data);
await onSubmit(data);
}}
button={semester ? "Edit Semester" : "Add Semester"}
>
Expand Down
4 changes: 1 addition & 3 deletions src/components/users/UserCard.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import Block from "..//Block";
import Image from "next/image";
import styles from "./UserCard.module.css";

export default function UserCard({ user }) {
return (
<Block as="a" href={`/users/${user.username}`} className={user.admin ? styles.UserCardAdmin : styles.UserCard}>
<div className={`${styles.faceContent}`}>
<div className={styles.imageWrapper}>
<Image
<img
src={user.image}
alt={`${user.name}'s face`}
fill
style={{
objectFit: "cover",
borderRadius: "5px",
Expand Down
7 changes: 7 additions & 0 deletions src/components/users/UserCard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
height: 11rem;
}

.imageWrapper img {
width: 100%;
height: 100%;
display: block;
object-fit: cover;
}

.name {
text-align: center;
font-weight: bolder;
Expand Down
Loading