From 308fda97bb75163b6fa998159873734fe8b6cd45 Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Mon, 9 Jun 2025 15:14:30 +0200 Subject: [PATCH] refactor(tabs): remove console logs --- app/components/Tabs.tsx | 3 --- app/libs/navigation.ts | 8 +++--- app/pages/+data.ts | 59 ++++++++++++++++++++--------------------- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/app/components/Tabs.tsx b/app/components/Tabs.tsx index 4f072d7..5fe8eb6 100644 --- a/app/components/Tabs.tsx +++ b/app/components/Tabs.tsx @@ -39,8 +39,6 @@ export default function Tabs(props: { const [tabs, setTabs] = createSignal([]); const addTab = (tab: TabType) => { - console.log("Adding tab", tab); - setTabs((prevTabs) => { // Append to the end of the array and make sure it's unique if (prevTabs.some((t) => t.value === tab.value)) { @@ -113,7 +111,6 @@ Tabs.Item = (props: { } onMount(() => { - console.log("Mounting tab", props.label); tabsContext.addTab({ label: props.label, value: props.value }); }); diff --git a/app/libs/navigation.ts b/app/libs/navigation.ts index 2f7920b..f567961 100644 --- a/app/libs/navigation.ts +++ b/app/libs/navigation.ts @@ -127,10 +127,10 @@ export const navigation: NavigationSection[] = [ title: "Fonctions et portée", href: "/docs/javascript/fonctions-et-portee", }, - { - title: "Le DOM", - href: "/docs/javascript/dom", - }, + // { + // title: "Le DOM", + // href: "/docs/javascript/dom", + // }, ], }, { diff --git a/app/pages/+data.ts b/app/pages/+data.ts index 98db99e..873d355 100644 --- a/app/pages/+data.ts +++ b/app/pages/+data.ts @@ -7,40 +7,39 @@ import buildTitle from "./buildTitle"; export type Data = Awaited>; export async function data(pageContext: PageContext) { - const config = useConfig(); - await docCache.waitingForCache(20000); + const config = useConfig(); + await docCache.waitingForCache(20000); - const { - exports: { frontmatter }, - urlParsed, - } = pageContext; - const isRoot = urlParsed.pathname === "/"; + const { + exports: { frontmatter }, + urlParsed, + } = pageContext; + const isRoot = urlParsed.pathname === "/"; - config({ - title: buildTitle(isRoot ? undefined : frontmatter?.title), - description: frontmatter?.description, - }); + config({ + title: buildTitle(isRoot ? undefined : frontmatter?.title), + description: frontmatter?.description, + }); - let cachePathname = urlParsed.pathname.replace(/\/$/, "").replace(/^\//, ""); - if (cachePathname === "") cachePathname = "index"; + let cachePathname = urlParsed.pathname.replace(/\/$/, "").replace(/^\//, ""); + if (cachePathname === "") cachePathname = "index"; - const doc = docCache.get(cachePathname); - console.log(doc); + const doc = docCache.get(cachePathname); - if (!doc) { - console.error( - `DocCache: No doc found for ${cachePathname}. This is a bug!`, - "Please report it to the maintainers.", - ); - } + if (!doc) { + console.error( + `DocCache: No doc found for ${cachePathname}. This is a bug!`, + "Please report it to the maintainers.", + ); + } - return { - sections: doc?.sections || [], - frontmatter, - docs: docCache.orderByLastEdit({ - limit: 2, - includedBasePaths: ["docs", "certifications"], - excludedFileNames: [cachePathname, "docs", "certifications"], - }), - }; + return { + sections: doc?.sections || [], + frontmatter, + docs: docCache.orderByLastEdit({ + limit: 2, + includedBasePaths: ["docs", "certifications"], + excludedFileNames: [cachePathname, "docs", "certifications"], + }), + }; }