feat: fix some shit
This commit is contained in:
parent
6f650b568d
commit
f482ebcce0
@ -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>{title}</title>}
|
||||
</Head>
|
||||
<RedirectSearchHandler />
|
||||
<KMenu type="main" context={context} />
|
||||
<aside class="p-4 hidden md:block">
|
||||
<nav class="min-h-fit rounded-3xl p-3 grid gap-3 fixed t-0">
|
||||
{Object.values(resources).map((m) => {
|
||||
@ -43,7 +46,6 @@ export const MainLayout = ({ children, url, title, context }: Props) => {
|
||||
})}
|
||||
</nav>
|
||||
</aside>
|
||||
<RedirectSearchHandler />
|
||||
<main
|
||||
class="py-5"
|
||||
style={{ fontFamily: "Work Sans" }}
|
||||
|
@ -106,6 +106,7 @@ export const KMenu = (
|
||||
if (ev?.target?.nodeName == "INPUT") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!visible.value) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
|
@ -37,6 +37,10 @@ export const createNewArticle: MenuEntry = {
|
||||
},
|
||||
visible: () => {
|
||||
if (!getCookie("session_cookie")) return false;
|
||||
if (
|
||||
!globalThis?.location?.pathname?.includes("article") &&
|
||||
globalThis?.location?.pathname !== "/"
|
||||
) return false;
|
||||
return true;
|
||||
},
|
||||
};
|
||||
|
@ -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;
|
||||
},
|
||||
};
|
||||
|
@ -23,14 +23,17 @@ export default function Greet(props: PageProps<Article>) {
|
||||
const content = renderMarkdown(article.content);
|
||||
|
||||
return (
|
||||
<MainLayout url={props.url} title={`Article > ${article.name}`}>
|
||||
<MainLayout
|
||||
url={props.url}
|
||||
title={`Article > ${article.name}`}
|
||||
context={article}
|
||||
>
|
||||
<RecipeHero
|
||||
data={article}
|
||||
subline={[author, date.toString()]}
|
||||
editLink={`https://notes.max-richter.dev/Media/articles/${article.id}`}
|
||||
backlink="/articles"
|
||||
/>
|
||||
<KMenu type="main" context={article} />
|
||||
{article.tags.length > 0 && (
|
||||
<>
|
||||
<br />
|
||||
|
@ -27,8 +27,6 @@ export default function Greet(props: PageProps<Article[] | null>) {
|
||||
|
||||
<h3 class="text-2xl text-white font-light">📝 Articles</h3>
|
||||
</header>
|
||||
|
||||
<KMenu type="main" context={false} />
|
||||
<Grid>
|
||||
{props.data?.map((doc) => {
|
||||
return (
|
||||
|
@ -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) {
|
||||
<Head>
|
||||
<title>app</title>
|
||||
</Head>
|
||||
<KMenu type="main" context={null} />
|
||||
<MainLayout url={props.url}>
|
||||
<div class="flex flex-wrap items-center gap-4 px-4">
|
||||
{Object.values(resources).map((m) => {
|
||||
|
@ -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<Movie>) {
|
||||
const content = renderMarkdown(movie.description || "");
|
||||
|
||||
return (
|
||||
<MainLayout url={props.url} title={`Movie > ${movie.name}`}>
|
||||
<MainLayout url={props.url} title={`Movie > ${movie.name}`} context={movie}>
|
||||
<RecipeHero
|
||||
data={movie}
|
||||
subline={[author, date.toString()]}
|
||||
editLink={`https://notes.max-richter.dev/Media/movies/${movie.id}`}
|
||||
backlink="/movies"
|
||||
/>
|
||||
<KMenu type="main" context={movie} />
|
||||
{movie.tags.length > 0 && (
|
||||
<>
|
||||
<br />
|
||||
|
@ -16,7 +16,6 @@ export const handler: Handlers<Movie[] | null> = {
|
||||
export default function Greet(props: PageProps<Movie[] | null>) {
|
||||
return (
|
||||
<MainLayout url={props.url} title="Movies" context={{ type: "movie" }}>
|
||||
<KMenu type="main" context={false} />
|
||||
<header class="flex gap-4 items-center mb-5 md:hidden">
|
||||
<a
|
||||
class="px-4 ml-4 py-2 bg-gray-300 text-gray-800 rounded-lg flex items-center gap-1"
|
||||
|
@ -24,7 +24,11 @@ export default function Greet(props: PageProps<Recipe>) {
|
||||
].filter(Boolean);
|
||||
|
||||
return (
|
||||
<MainLayout url={props.url} title={`Recipes > ${recipe.name}`}>
|
||||
<MainLayout
|
||||
url={props.url}
|
||||
title={`Recipes > ${recipe.name}`}
|
||||
context={recipe}
|
||||
>
|
||||
<RecipeHero
|
||||
data={recipe}
|
||||
backlink="/recipes"
|
||||
|
Loading…
x
Reference in New Issue
Block a user