Files
djalim 49bcc3083a
Check Deno code / Check Deno code (push) Has been cancelled
Tests / Unit tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
fix: faculty users are now recognized as employees
2026-05-05 15:29:02 +02:00

57 lines
1.4 KiB
TypeScript

import {
getPartialsConfig,
makePartials,
} from "$root/defaults/makePartials.tsx";
import { FreshContext } from "$fresh/server.ts";
import { isEmployee, State } from "$root/defaults/interfaces.ts";
// deno-lint-ignore require-await
export async function Index(
_request: Request,
context: FreshContext<State>,
) {
const employeeCheck = isEmployee(
(context.state as unknown as { session: Record<string, string> }).session,
);
return (
<div class="page-content">
<h2 class="page-title">PolyNotes</h2>
<p>
Bienvenue{" "}
<strong>
{(context.state as unknown as { session: Record<string, string> })
.session.displayName}
</strong>
.
</p>
{employeeCheck
? (
<p>
Consultez les{" "}
<a href="/notes/courses" f-partial="/notes/partials/courses">
notes des élèves
</a>{" "}
ou gérez les{" "}
<a href="/notes/ues" f-partial="/notes/partials/ues">
UEs
</a>
.
</p>
)
: (
<p>
Consultez vos{" "}
<a href="/notes/notes" f-partial="/notes/partials/notes">
notes
</a>
.
</p>
)}
</div>
);
}
export const config = getPartialsConfig();
export default makePartials(Index);