Skip to content

web search done right

don't show alice when disabled

Mikkel Denker4f4f97eb8c5a
diff --git a/frontend/components/Header.tsx b/frontend/components/Header.tsx
index 611c64e9..972a29c7 100644
--- a/frontend/components/Header.tsx
+++ b/frontend/components/Header.tsx
@@ -61,37 +61,28 @@ export const IndexBar = (
{ url: "/chat", title: "Chat" },
] satisfies { url: string; title: Section }[];
+ let availableLinks: { url: string; title: Section }[] = [];
+ if (withAlice) {
+ availableLinks = links;
+ } else {
+ availableLinks = links.filter((l) => l.title != "Chat");
+ }
+
return (
<>
- {links.map((l) => (
- l.url == "/chat" &&
- (withAlice && (
- <div class="inline relative z-0">
- <a
- class="link px-2 py-1 rounded-full text-sm"
- href={`${l.url}${query ? "?" + query : ""}`}
- >
- {l.title}
- </a>
- {active === l.title && (
- <div class="w-full h-[1px] absolute left-0 right-0 bottom-[-11px] bg-brand_contrast">
- </div>
- )}
+ {availableLinks.map((l) => (
+ <div class="inline relative z-0">
+ <a
+ class="link px-2 py-1 rounded-full text-sm"
+ href={`${l.url}${query ? "?" + query : ""}`}
+ >
+ {l.title}
+ </a>
+ {active === l.title && (
+ <div class="w-full h-[1px] absolute left-0 right-0 bottom-[-11px] bg-brand_contrast">
</div>
- )) || (
- <div class="inline relative z-0">
- <a
- class="link px-2 py-1 rounded-full text-sm"
- href={`${l.url}${query ? "?" + query : ""}`}
- >
- {l.title}
- </a>
- {active === l.title && (
- <div class="w-full h-[1px] absolute left-0 right-0 bottom-[-11px] bg-brand_contrast">
- </div>
- )}
- </div>
- )
+ )}
+ </div>
))}
</>
);
diff --git a/frontend/routes/chat.tsx b/frontend/routes/chat.tsx
index 51be08ca..aaad3522 100644
--- a/frontend/routes/chat.tsx
+++ b/frontend/routes/chat.tsx
@@ -9,24 +9,29 @@ export const config = DEFAULT_ROUTE_CONFIG;
export default defineRoute((req) => {
const withAlice = false;
- return (
- <>
- <div class="relative grid h-full grid-rows-[auto_1fr_auto]">
- <div id="header" class="row-start-1">
- <Header
- withAlice={withAlice}
- showDivider={true}
- active="Chat"
- queryUrlPart={new URL(req.url).searchParams.toString()}
- />
+ if (withAlice) {
+ return (
+ <>
+ <div class="relative grid h-full grid-rows-[auto_1fr_auto]">
+ <div id="header" class="row-start-1">
+ <Header
+ withAlice={withAlice}
+ showDivider={true}
+ active="Chat"
+ queryUrlPart={new URL(req.url).searchParams.toString()}
+ />
+ </div>
+ <div class="flex flex-col row-start-2 mt-10 px-2 items-center">
+ <Chat />
+ </div>
+ <div id="footer" class="row-start-3">
+ <Footer />
+ </div>
</div>
- <div class="flex flex-col row-start-2 mt-10 px-2 items-center">
- <Chat />
- </div>
- <div id="footer" class="row-start-3">
- <Footer />
- </div>
- </div>
- </>
- );
+ </>
+ );
+ } else {
+ // 404
+ return new Response("Not found", { status: 404 });
+ }
});