Separate admins' own content from managing other users

- Short links, Link pages and Overview now show only the admin's own
  namespace and root; other users' content moved to Administration
- Administration lists users with their link/page/click counts; each
  opens /~/admin/users/<name> with that user's pages and links and
  lets admins create content in their namespace
- other users' pages open under /~/admin/users/<name>/…, keep the
  Administration section active and link back to the user
- one PageTable component for all lists, so search and the namespace
  filter (All / mine / Root, admins only) behave the same everywhere
- the create dialog offers admins only their own namespace and root;
  the existing-link picker groups links by namespace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 16:52:22 +02:00
co-authored by Claude Opus 5.5
parent e44e56fd2d
commit 35cb7da929
13 changed files with 420 additions and 176 deletions
+5 -3
View File
@@ -6,6 +6,7 @@ import { CreatePageDialog } from "../components/CreatePageDialog.js";
import { Button, buttonClass } from "../components/ui/button.js";
import { DomainIcon, Link, Stat } from "../components/ui/misc.js";
import { Alert, Card, CardHeader, EmptyState, PageHeader, Skeleton } from "../components/ui/surface.js";
import { isMine } from "../lib/scope.js";
import { detailPath, navigate } from "../router.js";
function TopPages({ pages }: { pages: PageSummary[] }) {
@@ -47,11 +48,12 @@ export function OverviewScreen({ me }: { me: Me }) {
const conflicts = useApi<Conflict[]>(me.isAdmin ? "/conflicts" : null);
const [creating, setCreating] = useState<PageKind | null>(null);
const all = pages.data ?? [];
// Admins see their own and root content here; other users' content is under Administration.
const all = (pages.data ?? []).filter((p) => isMine(p, me));
const links = all.filter((p) => p.kind === "redirect");
const linkPages = all.filter((p) => p.kind === "linkpage");
const clicks = all.reduce((sum, p) => sum + p.totalClicks, 0);
const scope = me.isAdmin ? "all users" : `in /${me.username}/`;
const scope = me.isAdmin ? "yours & root" : `in /${me.username}/`;
return (
<>
@@ -76,7 +78,7 @@ export function OverviewScreen({ me }: { me: Me }) {
{conflicts.data.map((c, i) => (
<span key={c.pageId}>
{i > 0 && ", "}
<Link to={detailPath({ id: c.pageId, kind: "redirect" }, "settings")} className="font-mono underline">
<Link to={detailPath({ id: c.pageId, kind: "redirect", namespace: "" }, "settings")} className="font-mono underline">
/{c.username}
</Link>
</span>