Skip to content

Commit

Permalink
Merge pull request #23 from nulzo/python-testing
Browse files Browse the repository at this point in the history
Python testing
  • Loading branch information
nulzo authored Nov 1, 2023
2 parents 766a9de + cb80bcf commit 3f1e6e3
Show file tree
Hide file tree
Showing 11 changed files with 275 additions and 83 deletions.
5 changes: 5 additions & 0 deletions backend/src/api/models/roles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.db import models


class Role(models.Model):
pass
43 changes: 43 additions & 0 deletions frontend-ts/src/components/assets/UNO.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
export default function UNO({
width,
height,
}: {
width: string;
height: string;
}) {
return (
<svg
id="svg"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
width={width}
height={height}
viewBox="0, 0, 400,391"
className={"mr-1 hidden lg:flex"}
>
<g id="svg">
<path
id="path0"
d="M248.000 17.893 C 173.695 22.060,130.572 45.361,116.400 89.000 C 114.727 94.151,72.656 277.733,71.636 284.333 C 67.898 308.519,94.750 323.728,142.667 324.564 C 165.997 324.972,196.000 321.088,196.000 317.662 C 196.000 316.685,195.246 316.634,186.320 317.007 C 134.048 319.190,104.934 302.760,110.111 274.000 C 110.628 271.129,149.156 101.939,150.342 97.333 C 157.630 69.028,191.668 53.138,250.340 50.654 C 307.985 48.214,346.667 68.110,346.667 100.201 C 346.667 105.394,346.665 105.400,321.294 215.801 C 307.731 274.816,296.712 323.303,296.807 323.551 C 297.188 324.544,298.756 323.900,303.225 320.917 C 322.858 307.807,338.410 288.261,344.990 268.427 C 346.578 263.642,380.494 117.214,381.858 109.256 C 391.442 53.346,332.550 13.151,248.000 17.893 M64.833 318.000 C 65.549 318.733,66.210 319.333,66.302 319.333 C 66.394 319.333,65.883 318.733,65.167 318.000 C 64.451 317.267,63.790 316.667,63.698 316.667 C 63.606 316.667,64.117 317.267,64.833 318.000 "
stroke="none"
fill="#eb242c"
fillRule="evenodd"
></path>
<path
id="path1"
d="M239.000 66.702 C 221.771 67.828,204.000 71.205,204.000 73.352 C 204.000 74.313,204.757 74.365,213.627 74.002 C 262.431 72.005,290.201 85.369,290.156 110.833 L 290.146 116.833 269.885 205.500 C 249.050 296.681,248.941 297.130,246.630 301.758 C 235.964 323.123,209.139 335.381,164.064 339.488 C 99.450 345.374,55.285 326.737,53.438 292.805 C 53.107 286.716,53.131 286.605,78.830 175.236 C 92.455 116.194,103.526 67.687,103.432 67.443 C 103.070 66.501,101.588 67.107,97.291 69.955 C 77.023 83.392,61.744 102.686,54.888 123.500 C 53.652 127.251,19.125 276.269,18.163 282.000 C 9.024 336.471,64.582 376.078,146.241 373.305 C 227.584 370.543,274.585 343.751,285.946 293.667 C 286.507 291.192,296.193 248.736,307.470 199.320 C 331.322 94.793,329.680 103.106,327.845 96.167 C 322.304 75.212,287.147 63.553,239.000 66.702 "
stroke="none"
fill="#0c0c0c"
fillRule="evenodd"
></path>
<path
id="path2"
d="M254.000 0.199 C 149.752 4.442,57.077 56.339,37.676 121.339 C 36.319 125.886,1.864 274.877,0.908 280.333 C 0.025 285.373,-0.172 301.530,0.596 306.000 C 11.859 371.609,89.438 404.109,191.500 385.976 C 277.553 370.687,346.269 323.860,362.494 269.449 C 363.923 264.659,398.068 116.485,399.046 110.833 C 400.050 105.029,400.292 92.456,399.517 86.367 C 392.605 32.063,333.342 -3.030,254.000 0.199 M277.167 18.007 C 346.819 23.054,390.159 60.829,381.858 109.256 C 380.494 117.214,346.578 263.642,344.990 268.427 C 338.410 288.261,322.858 307.807,303.225 320.917 C 298.756 323.900,297.188 324.544,296.807 323.551 C 296.712 323.303,307.731 274.816,321.294 215.801 C 346.665 105.400,346.667 105.394,346.667 100.201 C 346.667 68.110,307.985 48.214,250.340 50.654 C 191.668 53.138,157.630 69.028,150.342 97.333 C 149.156 101.939,110.628 271.129,110.111 274.000 C 104.934 302.760,134.048 319.190,186.320 317.007 C 195.246 316.634,196.000 316.685,196.000 317.662 C 196.000 321.088,165.997 324.972,142.667 324.564 C 94.750 323.728,67.898 308.519,71.636 284.333 C 72.656 277.733,114.727 94.151,116.400 89.000 C 130.572 45.361,173.695 22.060,248.000 17.893 C 252.746 17.627,273.009 17.706,277.167 18.007 M267.057 66.676 C 310.253 69.577,332.481 84.724,328.189 108.333 C 327.716 110.934,286.543 291.684,285.289 296.667 C 273.241 344.513,226.166 370.508,146.500 373.305 C 64.028 376.201,8.345 336.112,18.293 281.000 C 19.614 273.679,53.734 126.746,54.983 123.000 C 61.080 104.706,74.356 86.891,91.500 73.999 C 99.158 68.240,103.021 66.123,103.512 67.417 C 103.599 67.646,92.498 116.243,78.843 175.411 C 53.282 286.166,53.124 286.891,53.442 292.500 C 55.393 327.000,99.572 345.488,165.354 339.331 C 212.586 334.911,240.394 320.715,248.638 296.815 C 249.592 294.049,289.199 121.126,289.978 116.327 C 294.694 87.261,264.353 71.337,209.586 74.135 C 203.986 74.421,203.276 74.232,204.230 72.705 C 205.237 71.091,222.283 67.956,235.167 67.015 C 237.917 66.814,240.767 66.604,241.500 66.547 C 244.964 66.282,262.506 66.371,267.057 66.676 M237.667 92.504 C 258.425 95.293,267.968 104.724,266.035 120.540 C 265.621 123.928,232.769 268.247,231.633 271.667 C 225.868 289.027,208.088 298.517,180.000 299.228 C 147.067 300.060,131.534 290.353,133.965 270.459 C 134.333 267.448,167.175 122.711,168.219 119.500 C 173.406 103.544,190.247 93.494,214.500 91.880 C 219.155 91.571,233.619 91.960,237.667 92.504 "
stroke="none"
fill="#fbfbfb"
fillRule="evenodd"
></path>
</g>
</svg>
);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 21 additions & 53 deletions frontend-ts/src/components/navigation/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
TicketIcon,
UserIcon,
UsersIcon,
SearchIcon,
SettingsIcon,
HomeIcon,
MegaphoneIcon,
Expand Down Expand Up @@ -60,16 +59,16 @@ export function Sidebar() {
/>
<Navlink
className="w-full justify-start"
isActive={path === "/search" ? true : false}
onClick={() => navigate("/search")}
text="Search"
isActive={path === "/create" ? true : false}
onClick={() => navigate("/create")}
text="Create Ticket"
icon={
<SearchIcon
viewBox="0 0 24 24"
<TicketIcon
width={20}
height={20}
strokeWidth={stroke_width}
shapeRendering={shape_rendering}
viewBox={"0 0 24 24"}
/>
}
/>
Expand All @@ -86,8 +85,8 @@ export function Sidebar() {
<div className="space-y-1">
<Navlink
className="w-full justify-start"
isActive={path === "/admin-dashboard" ? true : false}
onClick={() => navigate("/admin-dashboard")}
isActive={path === "/admin/dashboard" ? true : false}
onClick={() => navigate("/admin/dashboard")}
text="Dashboard"
icon={
<LayoutIcon
Expand All @@ -101,8 +100,8 @@ export function Sidebar() {
/>
<Navlink
className="w-full justify-start"
isActive={path === "/announcements" ? true : false}
onClick={() => navigate("/announcements")}
isActive={path === "/admin/announcements" ? true : false}
onClick={() => navigate("/admin/announcements")}
text="Announcements"
icon={
<MegaphoneIcon
Expand All @@ -116,8 +115,8 @@ export function Sidebar() {
/>
<Navlink
className="w-full justify-start"
isActive={path === "/download" ? true : false}
onClick={() => navigate("/download")}
isActive={path === "/admin/download" ? true : false}
onClick={() => navigate("/admin/download")}
text="Extract Data"
icon={
<DownloadIcon
Expand All @@ -131,8 +130,8 @@ export function Sidebar() {
/>
<Navlink
className="w-full justify-start"
isActive={path === "/blame" ? true : false}
onClick={() => navigate("/blame")}
isActive={path === "/admin/blame" ? true : false}
onClick={() => navigate("/admin/blame")}
text="Preen"
icon={
<BirdIcon
Expand All @@ -146,8 +145,8 @@ export function Sidebar() {
/>
<Navlink
className="w-full justify-start"
isActive={path === "/admin-settings" ? true : false}
onClick={() => navigate("/admin-settings")}
isActive={path === "/admin/settings" ? true : false}
onClick={() => navigate("/admin/settings")}
text="Admin Settings"
icon={
<SettingsIcon
Expand All @@ -172,22 +171,6 @@ export function Sidebar() {
</h2>
<div className="space-y-1">
<Navlink
className="w-full justify-start"
isActive={path === "/create" ? true : false}
onClick={() => navigate("/create")}
text="Create Ticket"
icon={
<TicketIcon
width={20}
height={20}
strokeWidth={stroke_width}
shapeRendering={shape_rendering}
viewBox={"0 0 24 24"}
/>
}
/>
<Navlink
// className="w-full justify-start [&>div>svg]:hover:stroke-zoom"
className="w-full justify-start"
isActive={path === "/zoom" ? true : false}
onClick={() => navigate("/zoom")}
Expand Down Expand Up @@ -216,21 +199,6 @@ export function Sidebar() {
/>
}
/>
{/* <Navlink
className="w-full justify-start"
isActive={path === "/tutors" ? true : false}
onClick={() => navigate("/tutors")}
text="CSLC Tutors"
icon={
<UsersIcon
width={20}
height={20}
strokeWidth={stroke_width}
shapeRendering={shape_rendering}
viewBox={"0 0 24 24"}
/>
}
/> */}
</div>
</div>
);
Expand All @@ -244,8 +212,8 @@ export function Sidebar() {
</h2>
<Navlink
className="w-full justify-start"
isActive={path === "/dashboard" ? true : false}
onClick={() => navigate("/dashboard")}
isActive={path === "/tutor/dashboard" ? true : false}
onClick={() => navigate("/tutor/dashboard")}
text="Dashboard"
icon={
<LayoutIcon
Expand All @@ -259,8 +227,8 @@ export function Sidebar() {
/>
<Navlink
className="w-full justify-start"
isActive={path === "/schedule" ? true : false}
onClick={() => navigate("/schedule")}
isActive={path === "/tutor/schedule" ? true : false}
onClick={() => navigate("/tutor/schedule")}
text="Schedule"
icon={
<CalendarIcon
Expand All @@ -274,8 +242,8 @@ export function Sidebar() {
/>
<Navlink
className="w-full justify-start"
isActive={path === "/tutors" ? true : false}
onClick={() => navigate("/tutors")}
isActive={path === "/tutor/tutors" ? true : false}
onClick={() => navigate("/tutor/tutors")}
text="Tutors"
icon={
<UsersIcon
Expand Down
69 changes: 39 additions & 30 deletions frontend-ts/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import Search from "./components/views/Search.tsx";
// import Search from "./components/views/Search.tsx";
import Root from "./Root.tsx";
import ErrorView from "./views/ErrorView.tsx";
import Zoom from "./views/ZoomView.tsx";
Expand All @@ -23,26 +23,31 @@ import HoursView from "./views/HoursView.tsx";
import AdminBlame from "./views/admin/AdminBlame.tsx";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import TutorView from "./views/tutor/TutorView.tsx";
import AdminRequired from "./routes/AdminRequired.tsx";
import TutorRequired from "./routes/TutorRequired.tsx";
import LoginRequired from "./routes/LoginRequired.tsx";
import LoginView from "./views/LoginView.tsx";
import LogoutRequired from "./routes/LogoutRequired.tsx";

const queryClient = new QueryClient();

const router = createBrowserRouter([
{
path: "/",
element: <Root />,
element: <LoginRequired view={<Root />} />,
errorElement: <ErrorView />,
children: [
{
path: "home/",
element: <HomeView />,
},
// {
// path: "search/",
// element: <Search />,
// },
{
path: "search/",
element: <Search />,
},
{
path: "admin-dashboard/",
element: <AdminDashboard />,
path: "create/",
element: <CreateTicketView />,
},
{
path: "zoom/",
Expand All @@ -53,48 +58,48 @@ const router = createBrowserRouter([
element: <HoursView />,
},
{
path: "create/",
element: <CreateTicketView />,
path: "profile/",
element: <ProfileView />,
},
{
path: "blame/",
element: <AdminBlame />,
path: "messages/",
element: <MessageView />,
},
{
path: "announcements/",
element: <AdminAnnouncements />,
path: "settings/",
element: <SettingsView />,
},
{
path: "admin-settings/",
element: <AdminSettings />,
path: "admin/dashboard/",
element: <AdminRequired view={<AdminDashboard />} />,
},
{
path: "download/",
element: <DownloadView />,
path: "admin/blame/",
element: <AdminRequired view={<AdminBlame />} />,
},
{
path: "settings/",
element: <SettingsView />,
path: "admin/announcements/",
element: <AdminRequired view={<AdminAnnouncements />} />,
},
{
path: "schedule/",
element: <ScheduleView />,
path: "admin/settings/",
element: <AdminRequired view={<AdminSettings />} />,
},
{
path: "tutors/",
element: <TutorView />,
path: "admin/download/",
element: <AdminRequired view={<DownloadView />} />,
},
{
path: "profile/",
element: <ProfileView />,
path: "tutor/schedule/",
element: <TutorRequired view={<ScheduleView />} />,
},
{
path: "messages/",
element: <MessageView />,
path: "tutor/tutors/",
element: <TutorRequired view={<TutorView />} />,
},
{
path: "dashboard/",
element: <TutorDashboard />,
path: "tutor/dashboard/",
element: <TutorRequired view={<TutorDashboard />} />,
},
{
path: "test-api/",
Expand All @@ -106,6 +111,10 @@ const router = createBrowserRouter([
},
],
},
{
path: "login/",
element: <LogoutRequired view={<LoginView />} />,
},
]);

ReactDOM.createRoot(document.getElementById("root")!).render(
Expand Down
10 changes: 10 additions & 0 deletions frontend-ts/src/routes/AdminRequired.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ReactNode } from "react";
import { Navigate } from "react-router-dom";

export default function AdminRequired({ view }: { view: ReactNode }) {
const isAdmin = false;
if (!isAdmin) {
return <Navigate to="/home" />;
}
return <>{view}</>;
}
10 changes: 10 additions & 0 deletions frontend-ts/src/routes/LoginRequired.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ReactNode } from "react";
import { Navigate } from "react-router-dom";

export default function LoginRequired({ view }: { view: ReactNode }) {
const isLoggedIn = true;
if (!isLoggedIn) {
return <Navigate to="/login" />;
}
return <>{view}</>;
}
10 changes: 10 additions & 0 deletions frontend-ts/src/routes/LogoutRequired.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ReactNode } from "react";
import { Navigate } from "react-router-dom";

export default function LogoutRequired({ view }: { view: ReactNode }) {
const loggedIn = true;
if (loggedIn) {
return <Navigate to="/home" />;
}
return <>{view}</>;
}
10 changes: 10 additions & 0 deletions frontend-ts/src/routes/TutorRequired.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ReactNode } from "react";
import { Navigate } from "react-router-dom";

export default function TutorRequired({ view }: { view: ReactNode }) {
const isTutor = true;
if (!isTutor) {
return <Navigate to="/home" />;
}
return <>{view}</>;
}
Loading

0 comments on commit 3f1e6e3

Please sign in to comment.