Skip to content

Commit

Permalink
Merge pull request #37 from PHS-TSA/next
Browse files Browse the repository at this point in the history
Nationals
  • Loading branch information
lishaduck authored May 9, 2024
2 parents 8abb421 + 457b8e3 commit 0a0797c
Show file tree
Hide file tree
Showing 23 changed files with 137 additions and 217 deletions.
8 changes: 5 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json",
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"organizeImports": {
"enabled": true
},
Expand All @@ -17,11 +17,13 @@
"useImportRestrictions": "off",
"useSortedClasses": "off",
"noConsole": "off",
"useJsxKeyInIterable": "off"
"useDefaultSwitchClause": "off"
},
"style": {
"noImplicitBoolean": "off",
"noDefaultExport": "off"
"noDefaultExport": "off",
"useNamingConvention": "off",
"useFilenamingConvention": "off"
},
"complexity": {
"useLiteralKeys": "off"
Expand Down
63 changes: 32 additions & 31 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,65 @@
"test:coverage:genhtml": "genhtml -o cov/html cov/cov.lcov",
"manifest": "deno task cli manifest $(pwd)",
"start": "deno run --env -A --watch src/dev.ts",
"build": "deno task compile:mdx && deno run -A src/dev.ts build",
"build": "deno task compile:mdx && deno run --env -A src/dev.ts build",
"preview": "deno run --env -A src/main.ts",
"update": "deno run -A -r https://fresh.deno.dev/update .",
"esm": "deno run -A https://esm.sh/v135",
"esm:add": "deno task esm add",
"esm:update": "deno task esm update",
"esm:remove": "deno task esm remove",
"biome": "deno run -A npm:@biomejs/biome@1.6.1",
"biome": "deno run -A npm:@biomejs/biome@1.7.3",
"biome:ci": "deno task biome ci . --error-on-warnings",
"biome:check": "deno task biome check . --error-on-warnings",
"compile:mdx": "deno run -A tool/compile-mdx.ts"
},
"imports": {
"$std/": "https://deno.land/std@0.216.0/",
"$fresh/": "https://deno.land/x/fresh@1.6.5/",
"$gfm": "https://deno.land/x/gfm@0.6.0/mod.ts",
"openai": "https://deno.land/x/openai@v4.29.2/mod.ts",
"openai/": "https://deno.land/x/openai@v4.29.2/",
"$fresh/": "https://deno.land/x/fresh@1.6.8/",
"$tabler_icons/": "https://deno.land/x/tabler_icons_tsx@0.0.6/tsx/",
"zod": "https://deno.land/x/zod@v3.22.4/mod.ts",
"@deno/gfm": "https://deno.land/x/gfm@0.6.0/mod.ts",
"@headlessui/react": "https://esm.sh/v135/*@headlessui/react@1.7.17",
"@preact/signals-core": "https://esm.sh/v135/@preact/signals-core@1.5.1",
"@preact/signals": "https://esm.sh/v135/*@preact/signals@1.2.2",
"preact": "https://esm.sh/v135/preact@10.19.6",
"preact/": "https://esm.sh/v135/preact@10.19.6/",
"@headlessui/tailwindcss": "npm:@headlessui/tailwindcss@0.2.0",
"@mdx-js/mdx": "npm:@mdx-js/mdx@3.0.1",
"@preact/signals": "https://esm.sh/v135/*@preact/signals@1.2.3",
"@preact/signals-core": "https://esm.sh/v135/*@preact/signals-core@1.6.0",
"@std/assert": "jsr:@std/assert@^0.224.0",
"@std/path": "jsr:@std/path@^0.224.0",
"@tailwindcss/forms": "npm:@tailwindcss/forms@0.5.7",
"@tailwindcss/typography": "npm:@tailwindcss/typography@0.5.10",
"@tailwindcss/typography": "npm:@tailwindcss/typography@0.5.13",
"idb-keyval": "npm:idb-keyval@6.2.1",
"openai": "https://deno.land/x/openai@v4.43.0/mod.ts",
"openai/": "https://deno.land/x/openai@v4.43.0/",
"preact": "https://esm.sh/v135/preact@10.21.0",
"preact/": "https://esm.sh/v135/preact@10.21.0/",
"rehype-mathjax": "npm:rehype-mathjax@6.0.0",
"remark-frontmatter": "npm:remark-frontmatter@5.0.0",
"remark-lint-checkbox-content-indent": "npm:remark-lint-checkbox-content-indent@4.1.1",
"remark-lint-no-tabs": "npm:remark-lint-no-tabs@3.1.1",
"remark-lint-definition-spacing": "npm:remark-lint-definition-spacing@3.1.1",
"remark-lint-heading-increment": "npm:remark-lint-heading-increment@3.1.1",
"remark-lint-linebreak-style": "npm:remark-lint-linebreak-style@3.1.1",
"remark-lint-no-missing-blank-lines": "npm:remark-lint-no-missing-blank-lines@3.1.1",
"remark-lint-no-consecutive-blank-lines": "npm:remark-lint-no-consecutive-blank-lines@4.1.2",
"remark-lint-checkbox-content-indent": "npm:remark-lint-checkbox-content-indent@5.0.0",
"remark-lint-definition-spacing": "npm:remark-lint-definition-spacing@4.0.0",
"remark-lint-heading-increment": "npm:remark-lint-heading-increment@4.0.0",
"remark-lint-linebreak-style": "npm:remark-lint-linebreak-style@4.0.0",
"remark-lint-no-consecutive-blank-lines": "npm:remark-lint-no-consecutive-blank-lines@5.0.0",
"remark-lint-no-missing-blank-lines": "npm:remark-lint-no-missing-blank-lines@4.0.0",
"remark-lint-no-tabs": "npm:remark-lint-no-tabs@4.0.0",
"remark-math": "npm:remark-math@6.0.0",
"remark-mdx-frontmatter": "npm:remark-mdx-frontmatter@4.0.0",
"remark-preset-lint-consistent": "npm:remark-preset-lint-consistent@5.1.2",
"remark-preset-lint-recommended": "npm:remark-preset-lint-recommended@6.1.3",
"tailwindcss": "npm:tailwindcss@3.4.1",
"tailwindcss/plugin": "npm:tailwindcss@3.4.1/plugin.js",
"remark-preset-lint-consistent": "npm:remark-preset-lint-consistent@6.0.0",
"remark-preset-lint-recommended": "npm:remark-preset-lint-recommended@7.0.0",
"tailwindcss": "npm:tailwindcss@3.4.3",
"tailwindcss/plugin": "npm:tailwindcss@3.4.3/plugin.js",
"unified": "npm:unified@11.0.4",
"vfile": "npm:vfile@6.0.1",
"vfile-matter": "npm:vfile-matter@5.0.0",
"vfile-reporter": "npm:vfile-reporter@8.1.0",
"vfile": "npm:vfile@6.0.1"
"vfile-reporter": "npm:vfile-reporter@8.1.1",
"zod": "https://deno.land/x/zod@v3.23.7/mod.ts"
},
"scopes": {
"https://esm.sh/v135/": {
"@preact/signals-react": "https://esm.sh/v135/*@preact/signals@1.2.2",
"@preact/signals-react": "https://esm.sh/v135/*@preact/signals@1.2.3",
"client-only": "https://esm.sh/v135/client-only@0.0.1",
"react-dom": "https://esm.sh/v135/preact@10.19.6/compat",
"react": "https://esm.sh/v135/preact@10.19.6/compat",
"react/jsx-runtime": "https://esm.sh/v135/preact@10.19.6/jsx-runtime",
"react-dom/test-utils": "https://esm.sh/v135/preact@10.19.6/test-utils"
"react-dom": "https://esm.sh/v135/preact@10.21.0/compat",
"react": "https://esm.sh/v135/preact@10.21.0/compat",
"react/jsx-runtime": "https://esm.sh/v135/preact@10.21.0/jsx-runtime",
"react-dom/test-utils": "https://esm.sh/v135/preact@10.21.0/test-utils"
}
},
"compilerOptions": {
Expand Down
8 changes: 4 additions & 4 deletions src/content/geothermal/what.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The switch to geothermal is still beginning, but it will be a worthy investment

There are four types of geothermal energy solutions.

1. Horizontal loop: Horizontal loop systems are best for properties with more land, as they are bigger and require deeper trenches.
2. Vertical Loop: Vertical loop systems are very narrow and great for residential areas!
3. Closed Loop: Closed loop systems mix water and antifreeze to accommodate cold climates, making them optimal for northern locations.
4. Open Loop: Open loop systems circulate water from an outside source, meaning that they are optimal for properties with a steady water source.
1. Horizontal loop: Horizontal loop systems are best for properties with more land, as they are bigger and require deeper trenches.
2. Vertical Loop: Vertical loop systems are very narrow and great for residential areas!
3. Closed Loop: Closed loop systems mix water and antifreeze to accommodate cold climates, making them optimal for northern locations.
4. Open Loop: Open loop systems circulate water from an outside source, meaning that they are optimal for properties with a steady water source.
2 changes: 0 additions & 2 deletions src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
import dev from "$fresh/dev.ts";
import config from "./fresh.config.ts";

import "$std/dotenv/load.ts";

await dev(import.meta.url, "./main.ts", config);
8 changes: 3 additions & 5 deletions src/islands/Chatbot.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render } from "$gfm";
import { render } from "@deno/gfm";
import { Transition } from "@headlessui/react";
import { useSignal, useSignalEffect } from "@preact/signals";
import { set } from "idb-keyval";
Expand Down Expand Up @@ -74,13 +74,11 @@ function ChatbotBox(props: JSX.HTMLAttributes<HTMLDivElement>): JSX.Element {
const isAsking = useSignal(false);
const thread = useIndexedDB<string>(
"thread",
[],
async () => (await getThread())?.id,
);

const messages_ = useIndexedDB<Db>(
"messages",
[],
// deno-lint-ignore require-await
async () => [],
);
Expand All @@ -105,10 +103,10 @@ function ChatbotBox(props: JSX.HTMLAttributes<HTMLDivElement>): JSX.Element {
)}
{messages.value.map((msg) => (
<div
key={msg.message}
key={`${msg.role}${msg.message}`}
class={`${getReplySide(msg.role)} ${replyStyles}`}
// biome-ignore lint/security/noDangerouslySetInnerHtml: It's back!
dangerouslySetInnerHTML={{ __html: render(msg.message, {}) }}
dangerouslySetInnerHTML={{ __html: render(msg.message) }}
/>
))}
</div>
Expand Down
2 changes: 0 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
/// <reference lib="dom.asynciterable" />
/// <reference lib="deno.ns" />

import "$std/dotenv/load.ts";

import { start } from "$fresh/server.ts";
import config from "./fresh.config.ts";
import manifest from "./fresh.gen.ts";
Expand Down
6 changes: 4 additions & 2 deletions src/routes/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Head, asset } from "$fresh/runtime.ts";
import { Head, Partial, asset } from "$fresh/runtime.ts";
import type { PageProps } from "$fresh/server.ts";
import type { JSX } from "preact";
import {
Expand Down Expand Up @@ -71,7 +71,9 @@ export default function App({ Component }: PageProps): JSX.Element {
</Head>

<body f-client-nav class="dark:bg-slate-950 dark:text-slate-50">
<Component />
<Partial name="body">
<Component />
</Partial>
</body>
</html>
);
Expand Down
7 changes: 2 additions & 5 deletions src/routes/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Partial } from "$fresh/runtime.ts";
import type { PageProps } from "$fresh/server.ts";
import type { JSX } from "preact";
import { Footer } from "../components/Footer.tsx";
Expand All @@ -16,10 +15,8 @@ import { Chatbot } from "../islands/Chatbot.tsx";
export default function Layout({ Component, url }: PageProps): JSX.Element {
return (
<div class="flex min-h-screen flex-col place-content-center">
<Partial name="body">
<Header active={url.pathname} />
<Component />
</Partial>
<Header active={url.pathname} />
<Component />
<Chatbot class="fixed right-3 bottom-10 sm:right-10" />
<Footer class="mt-auto" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/about.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type ServeHandlerInfo, createHandler } from "$fresh/server.ts";
import { assertStringIncludes } from "$std/assert/mod.ts";
import { assertStringIncludes } from "@std/assert";
import config from "../fresh.config.ts";
import manifest from "../fresh.gen.ts";

Expand Down
7 changes: 5 additions & 2 deletions src/routes/api/chat/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { Handlers } from "$fresh/server.ts";
import { ask } from "../../../utils/openai/assistant.ts";
import type { TextContentBlock } from "../../../utils/openai/schemas.ts";
import type {
Message,
TextContentBlock,
} from "../../../utils/openai/schemas.ts";

export const handler: Handlers<TextContentBlock | null> = {
async GET(req, ctx): Promise<Response> {
Expand All @@ -12,7 +15,7 @@ export const handler: Handlers<TextContentBlock | null> = {
}

const response = ask(message, thread_id);
const responses = [];
const responses: Message[] = [];
for await (const res of response) {
responses.push(res);
}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/calculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const handler: Handlers = {
});
}

if (!geoType.success || !squareFootage) {
if (!(geoType.success && squareFootage)) {
return ctx.renderNotFound();
}

Expand Down
4 changes: 2 additions & 2 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Card({
}: RenderableProps<CardProps>): JSX.Element {
return (
<div
class={`inline-grid items-center rounded-xl bg-slate-300 dark:bg-slate-200 p-8 md:grid md:grid-cols-4 ${cols}`}
class={`inline-grid items-center rounded-xl bg-slate-300 dark:bg-slate-700 p-8 md:grid md:grid-cols-4 ${cols}`}
>
<img
src={image}
Expand All @@ -45,7 +45,7 @@ function Card({
/>

<p
class={`prose prose-slate prose-xl p-4 md:row-start-1 md:row-end-2 ${
class={`prose prose-slate prose-xl dark:prose-invert p-4 md:row-start-1 md:row-end-2 ${
imgSide === "left"
? "md:col-start-2 md:col-end-5"
: "md:col-start-1 md:col-end-4"
Expand Down
2 changes: 1 addition & 1 deletion src/routes/solutions/[category]/[[slug]].tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Head } from "$fresh/runtime.ts";
import type { Handlers, PageProps, RouteConfig } from "$fresh/server.ts";
import { join } from "$std/path/mod.ts";
import { join } from "@std/path";
import type { JSX } from "preact";
import { Content } from "../../../components/Content.tsx";
import { Cover } from "../../../components/Cover.tsx";
Expand Down
Loading

0 comments on commit 0a0797c

Please sign in to comment.