Commit ad1a7854 authored by Grant's avatar Grant
Browse files

canvas resizing (related #12)

- updated client to allow for canvas size to change
- added API routes for admin UI to change size
- added isAdmin flag to user accounts
parent 8559aea7
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
@@ -16242,7 +16242,9 @@
      "dependencies": {
        "@prisma/client": "^5.3.1",
        "@sc07-canvas/lib": "^1.0.0",
        "body-parser": "^1.20.2",
        "connect-redis": "^7.1.1",
        "cors": "^2.8.5",
        "express": "^4.18.2",
        "express-session": "^1.17.3",
        "openid-client": "^5.6.5",
@@ -16253,6 +16255,7 @@
      },
      "devDependencies": {
        "@tsconfig/recommended": "^1.0.2",
        "@types/cors": "^2.8.17",
        "@types/express": "^4.17.17",
        "@types/express-session": "^1.17.7",
        "@typescript-eslint/eslint-plugin": "^7.1.0",
@@ -16455,6 +16458,42 @@
        "url": "https://opencollective.com/typescript-eslint"
      }
    },
    "packages/server/node_modules/body-parser": {
      "version": "1.20.2",
      "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
      "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
      "dependencies": {
        "bytes": "3.1.2",
        "content-type": "~1.0.5",
        "debug": "2.6.9",
        "depd": "2.0.0",
        "destroy": "1.2.0",
        "http-errors": "2.0.0",
        "iconv-lite": "0.4.24",
        "on-finished": "2.4.1",
        "qs": "6.11.0",
        "raw-body": "2.5.2",
        "type-is": "~1.6.18",
        "unpipe": "1.0.0"
      },
      "engines": {
        "node": ">= 0.8",
        "npm": "1.2.8000 || >= 1.4.16"
      }
    },
    "packages/server/node_modules/body-parser/node_modules/debug": {
      "version": "2.6.9",
      "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
      "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
      "dependencies": {
        "ms": "2.0.0"
      }
    },
    "packages/server/node_modules/body-parser/node_modules/ms": {
      "version": "2.0.0",
      "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
      "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
    },
    "packages/server/node_modules/brace-expansion": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
@@ -16501,6 +16540,20 @@
      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
      "dev": true
    },
    "packages/server/node_modules/raw-body": {
      "version": "2.5.2",
      "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
      "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
      "dependencies": {
        "bytes": "3.1.2",
        "http-errors": "2.0.0",
        "iconv-lite": "0.4.24",
        "unpipe": "1.0.0"
      },
      "engines": {
        "node": ">= 0.8"
      }
    }
  }
}
+9 −0
Original line number Diff line number Diff line
import { Spinner } from "@nextui-org/react";

export const LoadingOverlay = () => {
  return (
    <div className="absolute top-0 left-0 w-full h-full z-[9999] backdrop-blur-sm bg-black/30 text-white flex items-center justify-center">
      <Spinner label="Loading..." />
    </div>
  );
};
+2 −2
Original line number Diff line number Diff line
@@ -124,10 +124,10 @@ export const SidebarWrapper = () => {
                href="/chat/rooms"
              />
              <SidebarItem
                isActive={pathname === "/chat/settings"}
                isActive={pathname === "/service/settings"}
                title="Settings"
                icon={<FontAwesomeIcon icon={faCog} />}
                href="/chat/settings"
                href="/service/settings"
              />
            </SidebarMenu>
          </div>
+34 −0
Original line number Diff line number Diff line
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const api = async <T = any>(
  endpoint: string,
  method: "GET" | "POST" = "GET",
  body?: unknown
): Promise<{
  status: number;
  data: ({ success: true } & T) | { success: false; error: string };
}> => {
  const API_HOST = import.meta.env.VITE_API_ROOT || "";

  const req = await fetch(API_HOST + endpoint, {
    method,
    credentials: "include",
    headers: {
      ...(body ? { "Content-Type": "application/json" } : {}),
    },
    body: JSON.stringify(body),
  });

  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  let data: any;

  try {
    data = await req.json();
  } catch (e) {
    /* empty */
  }

  return {
    status: req.status,
    data,
  };
};
+5 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ import { RouterProvider, createBrowserRouter } from "react-router-dom";
import { Root } from "./Root.tsx";
import { HomePage } from "./pages/Home/page.tsx";
import { AccountsPage } from "./pages/Accounts/Accounts/page.tsx";
import { ServiceSettingsPage } from "./pages/Service/settings.tsx";

const router = createBrowserRouter(
  [
@@ -22,6 +23,10 @@ const router = createBrowserRouter(
          path: "/accounts",
          element: <AccountsPage />,
        },
        {
          path: "/service/settings",
          element: <ServiceSettingsPage />,
        },
      ],
    },
  ],
Loading