summaryrefslogtreecommitdiff
path: root/makima/frontend/src/components/NavStrip.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'makima/frontend/src/components/NavStrip.tsx')
-rw-r--r--makima/frontend/src/components/NavStrip.tsx27
1 files changed, 24 insertions, 3 deletions
diff --git a/makima/frontend/src/components/NavStrip.tsx b/makima/frontend/src/components/NavStrip.tsx
index 17013ac..a6e483d 100644
--- a/makima/frontend/src/components/NavStrip.tsx
+++ b/makima/frontend/src/components/NavStrip.tsx
@@ -1,5 +1,6 @@
import { useAuth } from "../contexts/AuthContext";
import { useSupervisorQuestions } from "../contexts/SupervisorQuestionsContext";
+import { useUserSettings } from "../hooks/useUserSettings";
import { RewriteLink } from "./RewriteLink";
interface NavLink {
@@ -7,14 +8,30 @@ interface NavLink {
href: string;
requiresAuth?: boolean;
external?: boolean;
+ /**
+ * When true the link is hidden once the user has flipped on the
+ * document-mode UI — those areas (Exec, Contracts) are subsumed by the
+ * directive-document interface and surfacing them just creates noise.
+ */
+ hideInDocumentMode?: boolean;
}
const NAV_LINKS: NavLink[] = [
{ label: "Listen", href: "/listen" },
{ label: "Directives", href: "/directives", requiresAuth: true },
{ label: "Orders", href: "/orders", requiresAuth: true },
- { label: "Contracts", href: "/contracts", requiresAuth: true },
- { label: "Exec", href: "/exec", requiresAuth: true },
+ {
+ label: "Contracts",
+ href: "/contracts",
+ requiresAuth: true,
+ hideInDocumentMode: true,
+ },
+ {
+ label: "Exec",
+ href: "/exec",
+ requiresAuth: true,
+ hideInDocumentMode: true,
+ },
{ label: "Daemons", href: "/daemons", requiresAuth: true },
{ label: "History", href: "/history", requiresAuth: true },
];
@@ -22,6 +39,8 @@ const NAV_LINKS: NavLink[] = [
export function NavStrip() {
const { isAuthenticated, isAuthConfigured, signOut, user } = useAuth();
const { pendingQuestions } = useSupervisorQuestions();
+ const { settings } = useUserSettings();
+ const documentMode = settings?.documentModeEnabled ?? false;
const directiveQuestionCount = pendingQuestions.filter(q => q.directiveId).length;
const handleSignOut = async () => {
@@ -41,7 +60,9 @@ export function NavStrip() {
NAV//
</span>
<div className="flex flex-wrap gap-2 items-center flex-1">
- {NAV_LINKS.map((link) => (
+ {NAV_LINKS.filter(
+ (link) => !(documentMode && link.hideInDocumentMode),
+ ).map((link) => (
<span key={link.label} className="relative inline-flex items-center">
<RewriteLink
to={link.href}