π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add starter staff app
Manav Rathi384ec365e89b
diff --git a/web/apps/payments/README.md b/web/apps/payments/README.mdindex eeac0a397b..959bedabe8 100644--- a/web/apps/payments/README.md+++ b/web/apps/payments/README.md@@ -1,3 +1,5 @@+# Payments+Code that runs on `payments.ente.io`. It brokers between our services andStripe's API for payments.diff --git a/web/apps/staff/.eslintrc.cjs b/web/apps/staff/.eslintrc.cjsnew file mode 100644index 0000000000..99b4b9226c--- /dev/null+++ b/web/apps/staff/.eslintrc.cjs@@ -0,0 +1,3 @@+module.exports = {+ extends: ["@/build-config/eslintrc-vite"],+};diff --git a/web/apps/staff/README.md b/web/apps/staff/README.mdnew file mode 100644index 0000000000..90423e499c--- /dev/null+++ b/web/apps/staff/README.md@@ -0,0 +1,3 @@+## Staff dashboard++Web app for staff members to help with support etc.diff --git a/web/apps/staff/index.html b/web/apps/staff/index.htmlnew file mode 100644index 0000000000..5600e3a53f--- /dev/null+++ b/web/apps/staff/index.html@@ -0,0 +1,12 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width" />+ <title>Staff | ente.io</title>+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="/src/main.tsx"></script>+ </body>+</html>diff --git a/web/apps/staff/package.json b/web/apps/staff/package.jsonnew file mode 100644index 0000000000..2c7c01998b--- /dev/null+++ b/web/apps/staff/package.json@@ -0,0 +1,22 @@+{+ "name": "staff",+ "version": "0.0.0",+ "private": true,+ "type": "module",+ "scripts": {+ "build": "tsc && vite build",+ "dev": "vite",+ "preview": "vite preview"+ },+ "dependencies": {+ "react": "^18",+ "react-dom": "^18"+ },+ "devDependencies": {+ "@/build-config": "*",+ "@types/react": "^18",+ "@types/react-dom": "^18",+ "@vitejs/plugin-react": "^4.2",+ "vite": "^5.2"+ }+}diff --git a/web/apps/staff/src/App.tsx b/web/apps/staff/src/App.tsxnew file mode 100644index 0000000000..f3f0a9f150--- /dev/null+++ b/web/apps/staff/src/App.tsx@@ -0,0 +1,11 @@+import React from "react";+import S from "./utils/strings";++export const App: React.FC = () => {+ return (+ <div>+ <h1>{S.hello}</h1>+ <a href="https://help.ente.io">help.ente.io</a>+ </div>+ );+};diff --git a/web/apps/staff/src/components/Container.tsx b/web/apps/staff/src/components/Container.tsxnew file mode 100644index 0000000000..bf8c57b5dc--- /dev/null+++ b/web/apps/staff/src/components/Container.tsx@@ -0,0 +1,5 @@+import React from "react";++export const Container: React.FC<React.PropsWithChildren> = ({ children }) => (+ <div className="container">{children}</div>+);diff --git a/web/apps/staff/src/main.tsx b/web/apps/staff/src/main.tsxnew file mode 100644index 0000000000..4ed8c32054--- /dev/null+++ b/web/apps/staff/src/main.tsx@@ -0,0 +1,13 @@+import React from "react";+import ReactDOM from "react-dom/client";+import { App } from "./App";+import "./styles/globals.css";++const root = document.getElementById("root");+if (!root) throw new Error("Could not load root element to render onto");++ReactDOM.createRoot(root).render(+ <React.StrictMode>+ <App />+ </React.StrictMode>,+);diff --git a/web/apps/staff/src/services/support-service.ts b/web/apps/staff/src/services/support-service.tsnew file mode 100644index 0000000000..4898e1ee56--- /dev/null+++ b/web/apps/staff/src/services/support-service.ts@@ -0,0 +1,17 @@+const apiOrigin = import.meta.env.VITE_ENTE_ENDPOINT ?? "https://api.ente.io";++/** Fetch details of the user associated with the given {@link authToken}. */+export const getUserDetails = async (authToken: string) => {+ const url = `${apiOrigin}/users/details/v2`;+ const res = await fetch(url, {+ headers: {+ "X-Auth-Token": authToken,+ },+ });+ if (!res.ok) throw new Error(`Failed to fetch ${url}: HTTP ${res.status}`);+ const json: unknown = await res.json();+ if (json && typeof json === "object") {+ return json;+ }+ throw new Error(`Unexpected response for ${url}: ${JSON.stringify(json)}`);+};diff --git a/web/apps/staff/src/styles/globals.css b/web/apps/staff/src/styles/globals.cssnew file mode 100644index 0000000000..158d0e10ce--- /dev/null+++ b/web/apps/staff/src/styles/globals.css@@ -0,0 +1,38 @@+:root {+ color-scheme: light dark;+ color: #213547;+ background-color: #ffffff;+}++body {+ font-family: system-ui, sans-serif;++ margin: 0;+ display: flex;+ justify-content: center;+ text-align: center;+ min-height: 100svh;+}++a {+ color: green;+}++a:hover {+ color: darkgreen;+}++@media (prefers-color-scheme: dark) {+ :root {+ color: rgba(255, 255, 255, 0.87);+ background-color: #242424;+ }++ a {+ color: lightgreen;+ }++ a:hover {+ color: chartreuse;+ }+}diff --git a/web/apps/staff/src/utils/strings.ts b/web/apps/staff/src/utils/strings.tsnew file mode 100644index 0000000000..39b22fcd76--- /dev/null+++ b/web/apps/staff/src/utils/strings.ts@@ -0,0 +1,13 @@+/**+ * User facing strings in the app.+ *+ * By keeping them separate, we make our lives easier if/when we need to+ * localize the corresponding pages. Right now, these are just the values in the+ * default language, English.+ */+const S = {+ hello: "Hello Ente!",+ error_generic: "Oops, something went wrong.",+};++export default S;diff --git a/web/apps/staff/src/vite-env.d.ts b/web/apps/staff/src/vite-env.d.tsnew file mode 100644index 0000000000..b49bd06d07--- /dev/null+++ b/web/apps/staff/src/vite-env.d.ts@@ -0,0 +1,18 @@+/* Type shims provided by vite, e.g. for asset imports+ https://vitejs.dev/guide/features.html#client-types */++/// <reference types="vite/client" />++/** Types for the vite injected environment variables */+interface ImportMetaEnv {+ /**+ * Override the origin (scheme://host:port) of Ente's API to connect to.+ *+ * This is useful when testing or connecting to alternative installations.+ */+ readonly VITE_ENTE_ENDPOINT: string | undefined;+}++interface ImportMeta {+ env: ImportMetaEnv;+}diff --git a/web/apps/staff/tsconfig.json b/web/apps/staff/tsconfig.jsonnew file mode 100644index 0000000000..291fed6caf--- /dev/null+++ b/web/apps/staff/tsconfig.json@@ -0,0 +1,5 @@+{+ "extends": "@/build-config/tsconfig-vite.json",+ "include": ["src"],+ "references": [{ "path": "./tsconfig.node.json" }]+}diff --git a/web/apps/staff/tsconfig.node.json b/web/apps/staff/tsconfig.node.jsonnew file mode 100644index 0000000000..a8d6e3fc8f--- /dev/null+++ b/web/apps/staff/tsconfig.node.json@@ -0,0 +1,4 @@+{+ "extends": "@/build-config/tsconfig-vite.node.json",+ "include": ["vite.config.ts"]+}diff --git a/web/apps/staff/vite.config.ts b/web/apps/staff/vite.config.tsnew file mode 100644index 0000000000..d89c4f4453--- /dev/null+++ b/web/apps/staff/vite.config.ts@@ -0,0 +1,7 @@+import react from "@vitejs/plugin-react";+import { defineConfig } from "vite";++// https://vitejs.dev/config/+export default defineConfig({+ plugins: [react()],+});diff --git a/web/package.json b/web/package.jsonindex d27f9a6cbe..3b8697bd8c 100644--- a/web/package.json+++ b/web/package.json@@ -13,6 +13,7 @@"build:cast": "yarn workspace cast next build","build:payments": "yarn workspace payments build","build:photos": "yarn workspace photos next build",+ "build:staff": "yarn workspace staff build","deploy:accounts": "open 'https://github.com/ente-io/ente/compare/deploy/accounts...main?quick_pull=1&title=[web]+Deploy+accounts&body=Deploy+accounts.ente.io'","deploy:auth": "open 'https://github.com/ente-io/ente/compare/deploy/auth...main?quick_pull=1&title=[web]+Deploy+auth&body=Deploy+auth.ente.io'","deploy:cast": "open 'https://github.com/ente-io/ente/compare/deploy/cast...main?quick_pull=1&title=[web]+Deploy+cast&body=Deploy+cast.ente.io'",@@ -25,6 +26,7 @@"dev:cast": "yarn workspace cast next dev -p 3001","dev:payments": "yarn workspace payments dev","dev:photos": "yarn workspace photos next dev",+ "dev:staff": "yarn workspace staff dev","lint": "yarn prettier --check . && yarn workspaces run eslint --report-unused-disable-directives","lint-fix": "yarn prettier --write . && yarn workspaces run eslint --fix .","preview": "yarn preview:photos",@@ -32,7 +34,8 @@"preview:auth": "yarn build:auth && python3 -m http.server -d apps/auth/out 3000","preview:cast": "yarn build:cast && python3 -m http.server -d apps/accounts/out 3001","preview:payments": "yarn workspace payments preview",- "preview:photos": "yarn build:photos && python3 -m http.server -d apps/photos/out 3000"+ "preview:photos": "yarn build:photos && python3 -m http.server -d apps/photos/out 3000",+ "preview:staff": "yarn workspace staff preview"},"resolutions": {"libsodium": "0.7.9"