diff --git a/webui2/src/components/code/FileTree.tsx b/webui2/src/components/code/FileTree.tsx
index 6b847c1bb250d5de61a69d9567d14e0cb86146e2..fa5daa21c53a538c33f8a3a403080f844d3eafcf 100644
--- a/webui2/src/components/code/FileTree.tsx
+++ b/webui2/src/components/code/FileTree.tsx
@@ -2,7 +2,7 @@ import { Link } from "@tanstack/react-router";
import { formatDistanceToNow } from "date-fns";
import { Folder, File } from "lucide-react";
-import type { GitTreeEntry } from "@/__generated__/graphql";
+import { GitObjectType, type GitTreeEntry } from "@/__generated__/graphql";
import { Skeleton } from "@/components/ui/skeleton";
import { useRepo } from "@/lib/repo";
@@ -27,8 +27,8 @@ interface FileTreeProps {
// name, last-commit message (linked to commit detail), and relative date.
export function FileTree({ entries, path, loading, onNavigate, onNavigateUp }: FileTreeProps) {
// Directories first, then files — each group alphabetical
- const sorted = [...entries].sort((a, b) => {
- if (a.type !== b.type) return a.type === "TREE" ? -1 : 1;
+ const sorted = entries.toSorted((a, b) => {
+ if (a.type !== b.type) return a.type === GitObjectType.Tree ? -1 : 1;
return a.name.localeCompare(b.name);
});
@@ -64,7 +64,7 @@ function FileTreeRow({
entry: TreeEntryWithCommit;
onNavigate: (entry: TreeEntryWithCommit) => void;
}) {
- const isDir = entry.type === "TREE";
+ const isDir = entry.type === GitObjectType.Tree;
const repo = useRepo();
return (
diff --git a/webui2/src/components/code/RefSelector.tsx b/webui2/src/components/code/RefSelector.tsx
index 2db3bc0e376ca29dfed587cff9376ae443a7b5f3..642ad7d33beb3b266a9d8daca4441394b2aa92e2 100644
--- a/webui2/src/components/code/RefSelector.tsx
+++ b/webui2/src/components/code/RefSelector.tsx
@@ -1,7 +1,7 @@
import { GitBranch, Tag, Check, ChevronsUpDown } from "lucide-react";
import { useState } from "react";
-import type { GitRef } from "@/__generated__/graphql";
+import { GitRefType, type GitRef } from "@/__generated__/graphql";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
@@ -20,8 +20,8 @@ export function RefSelector({ refs, currentRef, onSelect }: RefSelectorProps) {
const [filter, setFilter] = useState("");
const filtered = refs.filter((r) => r.shortName.toLowerCase().includes(filter.toLowerCase()));
- const branches = filtered.filter((r) => r.type === "BRANCH");
- const tags = filtered.filter((r) => r.type === "TAG");
+ const branches = filtered.filter((r) => r.type === GitRefType.Branch);
+ const tags = filtered.filter((r) => r.type === GitRefType.Tag);
return (
@@ -102,7 +102,7 @@ function RefItem({
active && "font-medium",
)}
>
- {ref_.type === "BRANCH" ? (
+ {ref_.type === GitRefType.Branch ? (
) : (
diff --git a/webui2/src/components/layout/Header.tsx b/webui2/src/components/layout/Header.tsx
index 5a3a43345233101c76bbd2f77c09be8afdc4c60e..0ed2677d468dded56886288dee076e0707fb19d3 100644
--- a/webui2/src/components/layout/Header.tsx
+++ b/webui2/src/components/layout/Header.tsx
@@ -17,12 +17,13 @@ import { useTheme } from "@/lib/theme";
// SignOutButton sends a POST to /auth/logout and reloads the page.
// A full reload is the simplest way to reset all Apollo cache + React state.
+function handleSignOut() {
+ void fetch("/auth/logout", { method: "POST", credentials: "include" }).finally(() =>
+ window.location.assign("/"),
+ );
+}
+
function SignOutButton() {
- function handleSignOut() {
- void fetch("/auth/logout", { method: "POST", credentials: "include" }).finally(() =>
- window.location.assign("/"),
- );
- }
return (