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