Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22
24
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ API it calls) and `civfix-infra` (the edge that serves it).

```
civfix-admin/
apps/admin/ # the operator dashboard (Next.js 15 static-export SPA). See its source.
apps/admin/ # the operator dashboard (Next.js 16 static-export SPA). See its source.
.npmrc # @civfix:registry=https://repo.civfix.org/ (installs @civfix/contract and @civfix/tokens)
pnpm-workspace.yaml # workspace packages (apps/*) and every pnpm setting (overrides, build allow-list, supply-chain gates)
turbo.json # build/typecheck/lint task graph
Expand Down Expand Up @@ -55,7 +55,7 @@ Cookies, CSRF and `x-client: web` are sent exactly as the public web app sends t
## Deploy

Cloudflare Pages (Direct Upload). GitHub Actions builds the static export (a plain checkout +
`pnpm install`, which fetches `@civfix/contract` and `@civfix/tokens` from `repo.civfix.org`; pinned Node 22 + the pnpm that `packageManager` pins)
`pnpm install`, which fetches `@civfix/contract` and `@civfix/tokens` from `repo.civfix.org`; pinned Node 24 + the pnpm that `packageManager` pins)
and ships the prebuilt `apps/admin/out` via `wrangler pages deploy`. The Pages project name and output
dir come from the repo-root `wrangler.jsonc`
(`civfix-admin` -> `apps/admin/out`). A push to `main` deploys staging (`admin.civfix.dev`); a published
Expand Down
13 changes: 6 additions & 7 deletions apps/admin/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { dirname } from "node:path"
import { fileURLToPath } from "node:url"

import { FlatCompat } from "@eslint/eslintrc"
import vitest from "@vitest/eslint-plugin"
import nextCoreWebVitals from "eslint-config-next/core-web-vitals"
import nextTypescript from "eslint-config-next/typescript"
import jsxA11y from "eslint-plugin-jsx-a11y"
import reactHooks from "eslint-plugin-react-hooks"

const baseDirectory = dirname(fileURLToPath(import.meta.url))

// eslint-config-next 15.x ships only eslintrc presets; FlatCompat is the supported bridge until 16.
const compat = new FlatCompat({ baseDirectory })

const TEST_FILES = [
"src/**/*.test.{ts,tsx}",
"src/test/**",
Expand All @@ -23,8 +21,9 @@ const [, controlLabelOptions] = a11yRecommended["jsx-a11y/control-has-associated
// A list row's name is its title, which the shared .qrow markup nests four levels down.
const CONTROL_LABEL_DEPTH = 4

// eslint-config-next 15 depends on react-hooks v5, and which copy its preset loads is up to module
// resolution, so its plugin and rules are dropped here and the pinned v7 below is the only one.
// eslint-config-next's preset runs exhaustive-deps, incompatible-library and unsupported-syntax as warnings
// and leaves out void-use-memo, so its react-hooks rules are dropped here and the pinned plugin's full
// recommended set below is the only source of them.
function withoutReactHooks(entry) {
const { plugins, rules, ...rest } = entry
const { "react-hooks": _reactHooks, ...otherPlugins } = plugins ?? {}
Expand All @@ -48,7 +47,7 @@ const config = [
{
linterOptions: { reportUnusedDisableDirectives: "error" },
},
...compat.extends("next/core-web-vitals", "next/typescript").map(withoutReactHooks),
...[...nextCoreWebVitals, ...nextTypescript].map(withoutReactHooks),
// Every recommended rule at error, including the ones the preset ships as warnings.
{
plugins: reactHooksRecommended.plugins,
Expand Down
5 changes: 0 additions & 5 deletions apps/admin/knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ const config: KnipConfig = {
.flatMap(([, specifier]) => (specifier === undefined ? [] : [`import "${specifier}";`]))
.join("\n"),
},
ignoreDependencies: [
// Loaded by name through FlatCompat.extends("next/...") in eslint.config.mjs, which knip's ESLint
// plugin cannot see into.
"eslint-config-next",
],
}

export default config
20 changes: 10 additions & 10 deletions apps/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,35 @@
"@civfix/tokens": "^0.1.1",
"@tanstack/react-query": "^5.62.7",
"leaflet": "^1.9.4",
"next": "15.5.28",
"next": "16.4.3",
"react": "19.0.0",
"react-dom": "19.0.0",
"zustand": "^5.0.2"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.5",
"@tailwindcss/postcss": "^4.3.3",
"@testing-library/dom": "^10.4.2",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.7",
"@types/leaflet": "^1.9.15",
"@types/node": "^22.10.2",
"@types/node": "^24.19.2",
"@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2",
"@vitest/coverage-v8": "^4.1.12",
"@typescript/native": "npm:typescript@^7",
"@vitest/coverage-v8": "^5.0.5",
"@vitest/eslint-plugin": "1.6.27",
"autoprefixer": "^10.4.20",
"eslint": "^9.17.0",
"eslint-config-next": "15.5.28",
"eslint-config-next": "16.4.3",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react-hooks": "7.1.1",
"jscpd": "^5.3.2",
"jsdom": "^26.1.0",
"jsdom": "^30.1.3",
"knip": "^6.38.0",
"postcss": "^8.5.28",
"rimraf": "^6.0.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.2",
"vitest": "^4.1.12"
"tailwindcss": "^4.3.3",
"typescript": "npm:@typescript/typescript6@~6.0.2",
"vitest": "^5.0.5"
}
}
3 changes: 1 addition & 2 deletions apps/admin/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const config = {
plugins: {
tailwindcss: {},
autoprefixer: {},
"@tailwindcss/postcss": {},
},
}

Expand Down
101 changes: 89 additions & 12 deletions apps/admin/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,96 @@
@layer theme, base, components, utilities;

/*
* Global styles for the civfix admin / operator dashboard.
*
* Layering order matters:
* 1. Leaflet's stylesheet (the dashboard maps use Leaflet + CARTO raster tiles, matching the
* design prototype exactly - a deliberate design-fidelity choice for this internal tool; it does
* NOT use MapLibre like community-web).
* 2. Tailwind, which contributes only its base reset; the markup uses no intended Tailwind
* utilities. The dashboard's visual system is the ported design CSS imported in the root layout
* AFTER this file (src/styles/admin.css, which @imports src/styles/colors-and-type.css), so its
* component classes win over the reset wherever they overlap.
* 1. Leaflet's stylesheet, in the base layer ahead of Tailwind so Tailwind's reset still follows it (the
* dashboard maps use Leaflet + CARTO raster tiles, matching the design prototype exactly - a deliberate
* design-fidelity choice for this internal tool; it does NOT use MapLibre like community-web).
* 2. Tailwind, which contributes only its base reset; the markup uses no intended Tailwind utilities. The
* dashboard's visual system is the ported design CSS imported in the root layout AFTER this file
* (src/styles/admin.css, which @imports src/styles/colors-and-type.css). It is unlayered, so its rules
* win over every layer here wherever they overlap.
*
* Fonts: next/font assigns --font-display-next / --font-body-next / --font-mono-next on <html>
* (layout.tsx), exactly the names the ported design stylesheet (colors-and-type.css) aliases into the
* final --font-display / --font-body / --font-mono stacks. No bridge is needed (and a
* `--font-*-next: var(--font-*)` bridge would be CIRCULAR, invalidating font-family -> serif fallback).
* Tailwind's theme also declares --font-mono; the unlayered colors-and-type.css value is the one that holds.
*/

@import "leaflet/dist/leaflet.css";

@tailwind base;
@tailwind components;
@tailwind utilities;
@import "leaflet/dist/leaflet.css" layer(base);
@import "tailwindcss";

@layer base {
/*
* The dashboard was drawn against Tailwind 3's reset. These put back what Tailwind 4's reset changed
* and admin.css does not set itself; revert-layer hands a property back to the browser's default.
*/
*,
::before,
::after {
border-color: #e5e7eb;
}

input::placeholder,
textarea::placeholder {
color: #9ca3af;
}

[role="button"] {
cursor: pointer;
}

button,
input,
select,
optgroup,
textarea {
border-radius: revert-layer;
opacity: revert-layer;
}

input:where(:not([type="button"], [type="reset"], [type="submit"])),
select,
optgroup,
textarea {
background-color: revert-layer;
}

option {
padding: revert-layer;
}

::-webkit-date-and-time-value {
min-height: revert-layer;
text-align: revert-layer;
}

::-webkit-datetime-edit {
display: revert-layer;
}

::-webkit-datetime-edit-fields-wrapper {
padding: revert-layer;
}

::-webkit-datetime-edit,
::-webkit-datetime-edit-year-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-minute-field,
::-webkit-datetime-edit-second-field,
::-webkit-datetime-edit-millisecond-field,
::-webkit-datetime-edit-meridiem-field {
padding-block: revert-layer;
}

::-webkit-calendar-picker-indicator {
line-height: revert-layer;
}

html,
body,
#root {
Expand All @@ -42,6 +110,15 @@
}
}

/*
* Unlayered, like Tailwind 3's reset was: as a layered rule it would lose to admin.css's `button { cursor:
* pointer }`, which it outranks today, so disabled buttons without a cursor of their own would turn to a
* pointer.
*/
:disabled {
cursor: default;
}

/* Leaflet canvas should inherit the body font so attributions match the design. */
.leaflet-container {
font-family: var(--font-body);
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { tokens } from "@civfix/tokens"

import { Providers } from "@/components/providers"
import "./globals.css"
// After globals.css so the design system's component classes win over Tailwind's base reset where
// they overlap on the shell.
// Unlayered, so the design system's component classes win over Tailwind's layered base reset where
// they overlap on the shell; after globals.css so they also follow its few unlayered rules.
import "@/styles/admin.css"
// Last, so the app's own additions layer on top of the design system CSS.
import "@/styles/app.css"
Expand Down
9 changes: 8 additions & 1 deletion apps/admin/src/components/shared/page-primitives.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ export function FilterChips({
onClick={() => onChange(val)}
>
{label}
{count !== undefined && <span className="fchip-count">{count}</span>}
{/* The flex chip never renders this space; it keeps the accessible name "Open 3" without relying on
layout, which jsdom does not compute. */}
{count !== undefined && (
<>
{" "}
<span className="fchip-count">{count}</span>
</>
)}
</button>
)
})}
Expand Down
5 changes: 4 additions & 1 deletion apps/admin/src/components/shell/escape-owner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import { describe, expect, it } from "vitest"
import { ESCAPE_OWNER_SELECTOR, hasEscapeOwner, shellEscapeGoesHome } from "./escape-owner"

function doc(open: boolean): Pick<Document, "querySelector"> {
return {
// Typed by inference, not by the return type: no-deprecated matches a key typed as Document's
// querySelector against all of its overloads, one of which is deprecated.
const fake = {
querySelector: (selector: string) =>
open && selector === ESCAPE_OWNER_SELECTOR ? ({} as Element) : null,
}
return fake
}

describe("escape ownership", () => {
Expand Down
2 changes: 0 additions & 2 deletions apps/admin/src/features/auth/operator-login.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use client"

import * as React from "react"

import { BrandBug } from "@/components/shared/brand-bug"
import { useOperatorBootstrap, useOperatorSession } from "@/hooks/use-admin-auth"
import { SOURCE } from "@/lib/source"
Expand Down
1 change: 0 additions & 1 deletion apps/admin/src/features/inbox/inbox-views.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use client"

import * as React from "react"
import {
INBOUND_EMAIL_STATUS_LABELS,
MAIL_STATUS_LABELS,
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/src/features/orgs/org-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ function OrgDetailTabs({
onKeyDown={onTabKeyDown}
onClick={() => onTab(t)}
>
{TAB_LABEL[t]}
<TabBadge org={org} tab={t} />
{/* The flex tab never renders this space; it keeps the badge apart from the label in the tab's accessible name. */}
{TAB_LABEL[t]} <TabBadge org={org} tab={t} />
</button>
))}
</div>
Expand Down
2 changes: 2 additions & 0 deletions apps/admin/src/lib/access-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const ACCESS_LOGOUT_PATH = "/cdn-cgi/access/logout"
// silently re-authenticates from the still-valid Access cookie.
export function navigateToAccessLogout(): void {
if (typeof window === "undefined") return
// Cloudflare's own logout endpoint, not a Next.js page: only a full page load reaches it.
// eslint-disable-next-line @next/next/no-location-assign-relative-destination
window.location.assign(`${API_BASE_URL}${ACCESS_LOGOUT_PATH}`)
}
1 change: 0 additions & 1 deletion apps/admin/src/styles/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -3680,7 +3680,6 @@ button.prow-main {
padding: 0 22px;
background: rgba(251, 247, 240, 0.9);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-bottom: 1px solid var(--border-soft);
min-width: 0;
}
Expand Down
Loading
Loading