chore: deno fmt

This commit is contained in:
Max Richter
2025-11-02 21:58:02 +01:00
parent 21124dfe00
commit c13420c3ab
41 changed files with 324 additions and 254 deletions

View File

@@ -64,7 +64,8 @@ const Image = (
style={props.style} style={props.style}
srcset={responsiveAttributes.srcset} srcset={responsiveAttributes.srcset}
sizes={responsiveAttributes.sizes} sizes={responsiveAttributes.sizes}
src={`/api/images?image=${asset(props.src)}${props.width ? `&width=${props.width}` : "" src={`/api/images?image=${asset(props.src)}${
props.width ? `&width=${props.width}` : ""
}${props.height ? `&height=${props.height}` : ""}`} }${props.height ? `&height=${props.height}` : ""}`}
width={props.width} width={props.width}
height={props.height} height={props.height}

View File

@@ -20,7 +20,8 @@ function Wrapper(
) { ) {
return ( return (
<div <div
class={`flex justify-between flex-col relative w-full ${image ? "min-h-[400px]" : "min-h-[200px]" class={`flex justify-between flex-col relative w-full ${
image ? "min-h-[400px]" : "min-h-[200px]"
} rounded-3xl overflow-hidden`} } rounded-3xl overflow-hidden`}
> >
<HeroContext.Provider value={{ image }}> <HeroContext.Provider value={{ image }}>
@@ -51,7 +52,8 @@ function Title(
return ( return (
<OuterTag <OuterTag
href={link} href={link}
class={`${ctx.image ? "noisy-gradient" : "" class={`${
ctx.image ? "noisy-gradient" : ""
} after:opacity-90 flex gap-4 items-center ${ctx.image ? "pt-12" : ""}`} } after:opacity-90 flex gap-4 items-center ${ctx.image ? "pt-12" : ""}`}
> >
<h2 <h2
@@ -81,7 +83,8 @@ function EditLink({ href }: { href: string }) {
const ctx = useContext(HeroContext); const ctx = useContext(HeroContext);
return ( return (
<a <a
class={`px-4 py-2 ${ctx.image ? "bg-gray-300 text-gray-800" : "text-gray-200" class={`px-4 py-2 ${
ctx.image ? "bg-gray-300 text-gray-800" : "text-gray-200"
} rounded-lg flex gap-1 items-center`} } rounded-lg flex gap-1 items-center`}
href={href} href={href}
> >

View File

@@ -73,4 +73,4 @@ export const IngredientsList: FunctionalComponent<
</tbody> </tbody>
</table> </table>
); );
}; };

View File

@@ -6,7 +6,7 @@ type IconKey = keyof typeof icons;
export type MenuState = { export type MenuState = {
activeMenu: Signal<string>; activeMenu: Signal<string>;
activeState: Signal<"input" | "error" | "normal" | "loading">; activeState: Signal<"input" | "error" | "normal" | "loading">;
loadingText:Signal<string>; loadingText: Signal<string>;
commandInput: Signal<string>; commandInput: Signal<string>;
visible: Signal<boolean>; visible: Signal<boolean>;
menus: Record<string, Menu>; menus: Record<string, Menu>;

View File

@@ -283,4 +283,3 @@ export default function useDebouncedCallback<
return debounced; return debounced;
} }

View File

@@ -52,4 +52,3 @@ const useThrottledCallback = (
}; };
export default useThrottledCallback; export default useThrottledCallback;

View File

@@ -35,7 +35,8 @@ export async function summarize(content: string) {
{ {
role: "user", role: "user",
content: content:
`Please summarize the article in one sentence as short as possible: ${content.slice(0, 2000) `Please summarize the article in one sentence as short as possible: ${
content.slice(0, 2000)
}`, }`,
}, },
], ],
@@ -102,7 +103,8 @@ export async function createGenres(
{ {
role: "system", role: "system",
content: content:
`you create some keywords that can be used in a recommendation system. The keywords are based on a ${type} description or title. If you do not know the title, take into account the description aswell. Create a range of keywords from very specific ones that describe the general vibe. ${title ? `The name of the ${type} is ${title}` : "" `you create some keywords that can be used in a recommendation system. The keywords are based on a ${type} description or title. If you do not know the title, take into account the description aswell. Create a range of keywords from very specific ones that describe the general vibe. ${
title ? `The name of the ${type} is ${title}` : ""
}. Return a list of around 20 keywords seperated by commas`, }. Return a list of around 20 keywords seperated by commas`,
}, },
{ {
@@ -166,7 +168,8 @@ export const getMovieRecommendations = async (
${keywords} ${keywords}
The movies should be similar to but not include ${exclude.join(", ") The movies should be similar to but not include ${
exclude.join(", ")
} or remakes of that. } or remakes of that.
respond with a plain unordered list each item starting with the year the movie was released and then the title of the movie seperated by a -`, respond with a plain unordered list each item starting with the year the movie was released and then the title of the movie seperated by a -`,

View File

@@ -48,7 +48,8 @@ export async function endTask(chatId: string): Promise<string | null> {
finalNote += "**[Voice message could not be transcribed]**\n\n"; finalNote += "**[Voice message could not be transcribed]**\n\n";
} }
} else if (entry.type === "photo") { } else if (entry.type === "photo") {
const photoUrl = `${task.noteName.replace(/\.md$/, "") const photoUrl = `${
task.noteName.replace(/\.md$/, "")
}/photo-${photoIndex++}.jpg`; }/photo-${photoIndex++}.jpg`;
finalNote += `**Photo**:\n ${photoUrl}\n\n`; finalNote += `**Photo**:\n ${photoUrl}\n\n`;

View File

@@ -62,7 +62,8 @@ function parseParams(reqUrl: URL): ImageParams | string {
// Helper function to generate ETag // Helper function to generate ETag
async function generateETag(content: ArrayBuffer): Promise<string> { async function generateETag(content: ArrayBuffer): Promise<string> {
const hashBuffer = await crypto.subtle.digest("SHA-256", content); const hashBuffer = await crypto.subtle.digest("SHA-256", content);
return `"${Array.from(new Uint8Array(hashBuffer)) return `"${
Array.from(new Uint8Array(hashBuffer))
.map((b) => b.toString(16).padStart(2, "0")) .map((b) => b.toString(16).padStart(2, "0"))
.join("") .join("")
}"`; }"`;

View File

@@ -70,7 +70,8 @@ async function processCreateRecipeFromUrl(
if (newRecipe?.image && newRecipe.image.length > 5) { if (newRecipe?.image && newRecipe.image.length > 5) {
const extension = fileExtension(new URL(newRecipe.image).pathname); const extension = fileExtension(new URL(newRecipe.image).pathname);
const finalPath = `resources/recipes/images/${safeFileName(id) const finalPath = `resources/recipes/images/${
safeFileName(id)
}_cover.${extension}`; }_cover.${extension}`;
streamResponse.enqueue("downloading image"); streamResponse.enqueue("downloading image");
try { try {

View File

@@ -42,7 +42,8 @@ async function processUpdateRecommendations(
} }
done++; done++;
streamResponse.enqueue( streamResponse.enqueue(
`${Math.floor((done / total) * 100)}% [${done + 1 `${Math.floor((done / total) * 100)}% [${
done + 1
}/${total}] ${movie.name}`, }/${total}] ${movie.name}`,
); );
})).catch((err) => { })).catch((err) => {

View File

@@ -12,7 +12,8 @@ import { MetaTags } from "@components/MetaTags.tsx";
import { fetchResource } from "@lib/marka/index.ts"; import { fetchResource } from "@lib/marka/index.ts";
import { ArticleResource } from "@lib/marka/schema.ts"; import { ArticleResource } from "@lib/marka/schema.ts";
export const handler: Handlers<{ article: ArticleResource; session: unknown }> = { export const handler: Handlers<{ article: ArticleResource; session: unknown }> =
{
async GET(_, ctx) { async GET(_, ctx) {
const article = await fetchResource(`articles/${ctx.params.name}.md`); const article = await fetchResource(`articles/${ctx.params.name}.md`);
if (!article) { if (!article) {
@@ -20,7 +21,7 @@ export const handler: Handlers<{ article: ArticleResource; session: unknown }> =
} }
return ctx.render({ article, session: ctx.state.session }); return ctx.render({ article, session: ctx.state.session });
}, },
}; };
export default function Greet( export default function Greet(
props: PageProps<{ article: Article; session: Record<string, string> }>, props: PageProps<{ article: Article; session: Record<string, string> }>,

View File

@@ -22,7 +22,8 @@ export default function Home(props: PageProps) {
<Card <Card
title={`${m.name}`} title={`${m.name}`}
backgroundSize={80} backgroundSize={80}
image={`${m.emoji.endsWith(".png") image={`${
m.emoji.endsWith(".png")
? `/emojis/${encodeURIComponent(m.emoji)}` ? `/emojis/${encodeURIComponent(m.emoji)}`
: "/placeholder.svg" : "/placeholder.svg"
}`} }`}

View File

@@ -24,7 +24,7 @@ export default async function Greet(
return ctx.renderNotFound(); return ctx.renderNotFound();
} }
const { author = "", datePublished = "",reviewBody } = movie.content; const { author = "", datePublished = "", reviewBody } = movie.content;
const content = renderMarkdown( const content = renderMarkdown(
removeImage(reviewBody || "", movie.content.image), removeImage(reviewBody || "", movie.content.image),

View File

@@ -2,7 +2,7 @@
<browserconfig> <browserconfig>
<msapplication> <msapplication>
<tile> <tile>
<square150x150logo src="/mstile-150x150.png"/> <square150x150logo src="/mstile-150x150.png" />
<TileColor>#da532c</TileColor> <TileColor>#da532c</TileColor>
</tile> </tile>
</msapplication> </msapplication>

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,19 @@
<svg width="40" height="40" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="40" height="40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M34.092 8.845C38.929 20.652 34.092 27 30 30.5c1 3.5-2.986 4.222-4.5 2.5-4.457 1.537-13.512 1.487-20-5C2 24.5 4.73 16.714 14 11.5c8-4.5 16-7 20.092-2.655Z" fill="#FFDB1E"/> <path
<path d="M14 11.5c6.848-4.497 15.025-6.38 18.368-3.47C37.5 12.5 21.5 22.612 15.5 25c-6.5 2.587-3 8.5-6.5 8.5-3 0-2.5-4-5.183-7.75C2.232 23.535 6.16 16.648 14 11.5Z" fill="#fff" stroke="#FFDB1E"/> d="M34.092 8.845C38.929 20.652 34.092 27 30 30.5c1 3.5-2.986 4.222-4.5 2.5-4.457 1.537-13.512 1.487-20-5C2 24.5 4.73 16.714 14 11.5c8-4.5 16-7 20.092-2.655Z"
<path d="M28.535 8.772c4.645 1.25-.365 5.695-4.303 8.536-3.732 2.692-6.606 4.21-7.923 4.83-.366.173-1.617-2.252-1.617-1 0 .417-.7 2.238-.934 2.326-1.365.512-4.223 1.29-5.835 1.29-3.491 0-1.923-4.754 3.014-9.122.892-.789 1.478-.645 2.283-.645-.537-.773-.534-.917.403-1.546C17.79 10.64 23 8.77 25.212 8.42c.366.014.82.35.82.629.41-.14 2.095-.388 2.503-.278Z" fill="#FFE600"/> fill="#FFDB1E"
<path d="M14.297 16.49c.985-.747 1.644-1.01 2.099-2.526.566.121.841-.08 1.29-.701.324.466 1.657.608 2.453.701-.715.451-1.057.852-1.452 2.106-1.464-.611-3.167-.302-4.39.42Z" fill="#fff"/> />
<path
d="M14 11.5c6.848-4.497 15.025-6.38 18.368-3.47C37.5 12.5 21.5 22.612 15.5 25c-6.5 2.587-3 8.5-6.5 8.5-3 0-2.5-4-5.183-7.75C2.232 23.535 6.16 16.648 14 11.5Z"
fill="#fff"
stroke="#FFDB1E"
/>
<path
d="M28.535 8.772c4.645 1.25-.365 5.695-4.303 8.536-3.732 2.692-6.606 4.21-7.923 4.83-.366.173-1.617-2.252-1.617-1 0 .417-.7 2.238-.934 2.326-1.365.512-4.223 1.29-5.835 1.29-3.491 0-1.923-4.754 3.014-9.122.892-.789 1.478-.645 2.283-.645-.537-.773-.534-.917.403-1.546C17.79 10.64 23 8.77 25.212 8.42c.366.014.82.35.82.629.41-.14 2.095-.388 2.503-.278Z"
fill="#FFE600"
/>
<path
d="M14.297 16.49c.985-.747 1.644-1.01 2.099-2.526.566.121.841-.08 1.29-.701.324.466 1.657.608 2.453.701-.715.451-1.057.852-1.452 2.106-1.464-.611-3.167-.302-4.39.42Z"
fill="#fff"
/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,7 +1,35 @@
<svg width="387" height="387" viewBox="0 0 387 387" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg
<rect width="387" height="387" fill="#2B2930"/> width="387"
<circle cx="212.471" cy="154.8" r="15.5559" stroke="#39363F" stroke-width="3.03529"/> height="387"
<path d="M110.978 249.463L155.261 205.18C161.188 199.253 170.797 199.253 176.724 205.18L221.007 249.463" stroke="#39363F" stroke-width="3.03529"/> viewBox="0 0 387 387"
<path d="M192.362 220.628L207.81 205.18C213.737 199.253 223.346 199.253 229.273 205.18L273.556 249.463" stroke="#39363F" stroke-width="3.03529"/> fill="none"
<rect x="86.1265" y="86.1265" width="214.747" height="214.747" rx="13.6588" stroke="#39363F" stroke-width="3.03529"/> xmlns="http://www.w3.org/2000/svg"
>
<rect width="387" height="387" fill="#2B2930" />
<circle
cx="212.471"
cy="154.8"
r="15.5559"
stroke="#39363F"
stroke-width="3.03529"
/>
<path
d="M110.978 249.463L155.261 205.18C161.188 199.253 170.797 199.253 176.724 205.18L221.007 249.463"
stroke="#39363F"
stroke-width="3.03529"
/>
<path
d="M192.362 220.628L207.81 205.18C213.737 199.253 223.346 199.253 229.273 205.18L273.556 249.463"
stroke="#39363F"
stroke-width="3.03529"
/>
<rect
x="86.1265"
y="86.1265"
width="214.747"
height="214.747"
rx="13.6588"
stroke="#39363F"
stroke-width="3.03529"
/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 652 B

After

Width:  |  Height:  |  Size: 758 B

View File

@@ -7,10 +7,10 @@ code[class*="language-"],
pre[class*="language-"] { pre[class*="language-"] {
color: white; color: white;
background: none; background: none;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
font-size: 1em; font-size: 1em;
text-align: left; text-align: left;
text-shadow: 0 -.1em .2em black; text-shadow: 0 -0.1em 0.2em black;
white-space: pre; white-space: pre;
word-spacing: normal; word-spacing: normal;
word-break: normal; word-break: normal;
@@ -34,10 +34,10 @@ pre[class*="language-"],
/* Code blocks */ /* Code blocks */
pre[class*="language-"] { pre[class*="language-"] {
border-radius: .5em; border-radius: 0.5em;
border: .3em solid hsl(0, 0%, 33%); /* #282A2B */ border: 0.3em solid hsl(0, 0%, 33%); /* #282A2B */
box-shadow: 1px 1px .5em black inset; box-shadow: 1px 1px 0.5em black inset;
margin: .5em 0; margin: 0.5em 0;
overflow: auto; overflow: auto;
padding: 1em; padding: 1em;
} }
@@ -53,24 +53,28 @@ pre[class*="language-"]::selection {
} }
/* Text Selection colour */ /* Text Selection colour */
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, pre[class*="language-"]::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
text-shadow: none; text-shadow: none;
background: hsla(0, 0%, 93%, 0.15); /* #EDEDED */ background: hsla(0, 0%, 93%, 0.15); /* #EDEDED */
} }
pre[class*="language-"]::selection, pre[class*="language-"] ::selection, pre[class*="language-"]::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection { pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
text-shadow: none; text-shadow: none;
background: hsla(0, 0%, 93%, 0.15); /* #EDEDED */ background: hsla(0, 0%, 93%, 0.15); /* #EDEDED */
} }
/* Inline code */ /* Inline code */
:not(pre) > code[class*="language-"] { :not(pre) > code[class*="language-"] {
border-radius: .3em; border-radius: 0.3em;
border: .13em solid hsl(0, 0%, 33%); /* #545454 */ border: 0.13em solid hsl(0, 0%, 33%); /* #545454 */
box-shadow: 1px 1px .3em -.1em black inset; box-shadow: 1px 1px 0.3em -0.1em black inset;
padding: .15em .2em .05em; padding: 0.15em 0.2em 0.05em;
white-space: normal; white-space: normal;
} }
@@ -82,11 +86,11 @@ code[class*="language-"]::selection, code[class*="language-"] ::selection {
} }
.token.punctuation { .token.punctuation {
opacity: .7; opacity: 0.7;
} }
.token.namespace { .token.namespace {
opacity: .7; opacity: 0.7;
} }
.token.tag, .token.tag,
@@ -155,7 +159,11 @@ code[class*="language-"]::selection, code[class*="language-"] ::selection {
.line-highlight.line-highlight { .line-highlight.line-highlight {
background: hsla(0, 0%, 33%, 0.25); /* #545454 */ background: hsla(0, 0%, 33%, 0.25); /* #545454 */
background: linear-gradient(to right, hsla(0, 0%, 33%, .1) 70%, hsla(0, 0%, 33%, 0)); /* #545454 */ background: linear-gradient(
to right,
hsla(0, 0%, 33%, 0.1) 70%,
hsla(0, 0%, 33%, 0)
); /* #545454 */
border-bottom: 1px dashed hsl(0, 0%, 33%); /* #545454 */ border-bottom: 1px dashed hsl(0, 0%, 33%); /* #545454 */
border-top: 1px dashed hsl(0, 0%, 33%); /* #545454 */ border-top: 1px dashed hsl(0, 0%, 33%); /* #545454 */
margin-top: 0.75em; /* Same as .prisms padding-top */ margin-top: 0.75em; /* Same as .prisms padding-top */

View File

@@ -1,15 +1,25 @@
<?xml version="1.0" standalone="no"?> <?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" <svg
width="256.000000pt" height="256.000000pt" viewBox="0 0 256.000000 256.000000" version="1.0"
preserveAspectRatio="xMidYMid meet"> xmlns="http://www.w3.org/2000/svg"
<metadata> width="256.000000pt"
height="256.000000pt"
viewBox="0 0 256.000000 256.000000"
preserveAspectRatio="xMidYMid meet"
>
<metadata
>
Created by potrace 1.14, written by Peter Selinger 2001-2017 Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata> </metadata>
<g transform="translate(0.000000,256.000000) scale(0.100000,-0.100000)" <g
fill="#000000" stroke="none"> transform="translate(0.000000,256.000000) scale(0.100000,-0.100000)"
<path d="M1404 2075 c-16 -7 -75 -60 -131 -116 -55 -57 -130 -133 -166 -167 fill="#000000"
stroke="none"
>
<path
d="M1404 2075 c-16 -7 -75 -60 -131 -116 -55 -57 -130 -133 -166 -167
l-64 -64 0 122 c0 91 -3 124 -13 130 -19 12 -192 12 -210 0 -11 -7 -15 -34 l-64 -64 0 122 c0 91 -3 124 -13 130 -19 12 -192 12 -210 0 -11 -7 -15 -34
-16 -117 -1 -59 -3 -110 -3 -113 -1 -3 -20 -11 -43 -17 -67 -18 -126 -76 -164 -16 -117 -1 -59 -3 -110 -3 -113 -1 -3 -20 -11 -43 -17 -67 -18 -126 -76 -164
-160 -33 -72 -34 -73 -108 -108 -41 -19 -87 -50 -102 -68 -64 -76 -82 -169 -160 -33 -72 -34 -73 -108 -108 -41 -19 -87 -50 -102 -68 -64 -76 -82 -169
@@ -19,6 +29,7 @@ l-64 -64 0 122 c0 91 -3 124 -13 130 -19 12 -192 12 -210 0 -11 -7 -15 -34
-59 15 -9 -2 -12 10 -9 45 6 72 -17 145 -62 196 -13 16 -16 60 -16 318 0 164 -59 15 -9 -2 -12 10 -9 45 6 72 -17 145 -62 196 -13 16 -16 60 -16 318 0 164
3 299 6 299 3 0 18 -13 34 -30 39 -41 75 -52 113 -33 36 18 53 57 40 93 -5 14 3 299 6 299 3 0 18 -13 34 -30 39 -41 75 -52 113 -33 36 18 53 57 40 93 -5 14
-82 96 -171 183 -89 87 -282 277 -429 423 -146 145 -270 264 -275 265 -4 0 -82 96 -171 183 -89 87 -282 277 -429 423 -146 145 -270 264 -275 265 -4 0
-15 2 -24 4 -8 1 -29 -3 -45 -10z"/> -15 2 -24 4 -8 1 -29 -3 -45 -10z"
</g> />
</g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB