diff --git a/components/layouts/main.tsx b/components/layouts/main.tsx index 0dd509c..361b83a 100644 --- a/components/layouts/main.tsx +++ b/components/layouts/main.tsx @@ -3,6 +3,7 @@ import { resources } from "@lib/resources.ts"; import { CSS, KATEX_CSS } from "https://deno.land/x/gfm@0.2.5/mod.ts"; import { Head } from "$fresh/runtime.ts"; import Search, { RedirectSearchHandler } from "@islands/Search.tsx"; +import { KMenu } from "@islands/KMenu.tsx"; export type Props = { children: ComponentChildren; @@ -27,6 +28,8 @@ export const MainLayout = ({ children, url, title, context }: Props) => { {title && {title}} + + -
{ if (!getCookie("session_cookie")) return false; + if ( + !globalThis?.location?.pathname?.includes("article") && + globalThis?.location?.pathname !== "/" + ) return false; return true; }, }; diff --git a/islands/KMenu/commands/create_movie.ts b/islands/KMenu/commands/create_movie.ts index 0af2a70..7bbf597 100644 --- a/islands/KMenu/commands/create_movie.ts +++ b/islands/KMenu/commands/create_movie.ts @@ -69,6 +69,10 @@ export const createNewMovie: MenuEntry = { }, visible: () => { if (!getCookie("session_cookie")) return false; + if ( + !globalThis?.location?.pathname?.includes("movie") && + globalThis?.location?.pathname !== "/" + ) return false; return true; }, }; diff --git a/routes/articles/[name].tsx b/routes/articles/[name].tsx index f46a774..e05268d 100644 --- a/routes/articles/[name].tsx +++ b/routes/articles/[name].tsx @@ -23,14 +23,17 @@ export default function Greet(props: PageProps
) { const content = renderMarkdown(article.content); return ( - ${article.name}`}> + ${article.name}`} + context={article} + > - {article.tags.length > 0 && ( <>
diff --git a/routes/articles/index.tsx b/routes/articles/index.tsx index 8dcdf65..7277614 100644 --- a/routes/articles/index.tsx +++ b/routes/articles/index.tsx @@ -27,8 +27,6 @@ export default function Greet(props: PageProps) {

📝 Articles

- - {props.data?.map((doc) => { return ( diff --git a/routes/index.tsx b/routes/index.tsx index a044397..bb89640 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -3,7 +3,6 @@ import { MainLayout } from "@components/layouts/main.tsx"; import { Card } from "@components/Card.tsx"; import { PageProps } from "$fresh/server.ts"; import { resources } from "@lib/resources.ts"; -import { KMenu } from "@islands/KMenu.tsx"; export default function Home(props: PageProps) { return ( @@ -11,7 +10,6 @@ export default function Home(props: PageProps) { app -
{Object.values(resources).map((m) => { diff --git a/routes/movies/[name].tsx b/routes/movies/[name].tsx index f0e68ae..ff193d6 100644 --- a/routes/movies/[name].tsx +++ b/routes/movies/[name].tsx @@ -2,7 +2,6 @@ import { Handlers, PageProps } from "$fresh/server.ts"; import { MainLayout } from "@components/layouts/main.tsx"; import { getMovie, Movie } from "@lib/resource/movies.ts"; import { RecipeHero } from "@components/RecipeHero.tsx"; -import { KMenu } from "@islands/KMenu.tsx"; import { HashTags } from "@components/HashTags.tsx"; import { renderMarkdown } from "@lib/documents.ts"; @@ -21,14 +20,13 @@ export default function Greet(props: PageProps) { const content = renderMarkdown(movie.description || ""); return ( - ${movie.name}`}> + ${movie.name}`} context={movie}> - {movie.tags.length > 0 && ( <>
diff --git a/routes/movies/index.tsx b/routes/movies/index.tsx index fcef159..e59c645 100644 --- a/routes/movies/index.tsx +++ b/routes/movies/index.tsx @@ -16,7 +16,6 @@ export const handler: Handlers = { export default function Greet(props: PageProps) { return ( -
) { ].filter(Boolean); return ( - ${recipe.name}`}> + ${recipe.name}`} + context={recipe} + >