feat(web): licence banner, settings page and feature gating

This commit is contained in:
2026-07-24 15:25:29 +01:00
parent ee4dff09c9
commit 8626898e5e
8 changed files with 217 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
"use client";
import { useQuery } from "@tanstack/react-query";
import { licence, type LicenseInfo } from "@/lib/api";
export function useLicense() {
const { data, isLoading } = useQuery<LicenseInfo>({
queryKey: ["license"],
queryFn: licence.get,
staleTime: 60_000,
});
return {
license: data,
isLoading,
isActive: data?.state === "valid",
// Features render disabled rather than hidden, so treat "unknown while
// loading" as available to avoid a flash of disabled controls.
hasFeature: (name: string) => (data ? Boolean(data.features?.[name]) : true),
};
}