Compare commits
No commits in common. "b6a332a2fe21207ef32e49862dd24ea09e25b82b" and "b9f7b63aa92185b07c4fd9dfcd48aed215d17b02" have entirely different histories.
b6a332a2fe
...
b9f7b63aa9
3
.env
Normal file
3
.env
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
DOMAIN="martials.no"
|
||||||
|
GIT_URL=https://git.$DOMAIN
|
||||||
|
STATUS_URL="https://status.$DOMAIN/status/home"
|
@ -39,7 +39,10 @@ export default defineConfig({
|
|||||||
}),
|
}),
|
||||||
env: {
|
env: {
|
||||||
schema: {
|
schema: {
|
||||||
URL: envField.string({ context: "client", access: "public" })
|
DOMAIN: envField.string({ context: "client", access: "public" }),
|
||||||
|
URL: envField.string({ context: "client", access: "public" }),
|
||||||
|
GIT_URL: envField.string({ context: "client", access: "public" }),
|
||||||
|
STATUS_URL: envField.string({ context: "client", access: "public" })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -25,14 +25,12 @@
|
|||||||
"@tailwindcss/typography": "^0.5.15",
|
"@tailwindcss/typography": "^0.5.15",
|
||||||
"astro": "5.0.0-beta.5",
|
"astro": "5.0.0-beta.5",
|
||||||
"astro-icon": "^1.1.1",
|
"astro-icon": "^1.1.1",
|
||||||
"diff": "^7.0.0",
|
|
||||||
"sharp": "^0.33.5",
|
"sharp": "^0.33.5",
|
||||||
"svelte": "^4.2.19",
|
"svelte": "^4.2.19",
|
||||||
"tailwindcss": "^3.4.13",
|
"tailwindcss": "^3.4.13",
|
||||||
"typescript": "^5.6.3"
|
"typescript": "^5.6.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/diff": "^5.2.3",
|
|
||||||
"daisyui": "^4.12.13",
|
"daisyui": "^4.12.13",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"prettier-plugin-astro": "^0.14.1",
|
"prettier-plugin-astro": "^0.14.1",
|
||||||
|
17
pnpm-lock.yaml
generated
17
pnpm-lock.yaml
generated
@ -44,9 +44,6 @@ importers:
|
|||||||
astro-icon:
|
astro-icon:
|
||||||
specifier: ^1.1.1
|
specifier: ^1.1.1
|
||||||
version: 1.1.1
|
version: 1.1.1
|
||||||
diff:
|
|
||||||
specifier: ^7.0.0
|
|
||||||
version: 7.0.0
|
|
||||||
sharp:
|
sharp:
|
||||||
specifier: ^0.33.5
|
specifier: ^0.33.5
|
||||||
version: 0.33.5
|
version: 0.33.5
|
||||||
@ -60,9 +57,6 @@ importers:
|
|||||||
specifier: ^5.6.3
|
specifier: ^5.6.3
|
||||||
version: 5.6.3
|
version: 5.6.3
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/diff':
|
|
||||||
specifier: ^5.2.3
|
|
||||||
version: 5.2.3
|
|
||||||
daisyui:
|
daisyui:
|
||||||
specifier: ^4.12.13
|
specifier: ^4.12.13
|
||||||
version: 4.12.13(postcss@8.4.47)
|
version: 4.12.13(postcss@8.4.47)
|
||||||
@ -971,9 +965,6 @@ packages:
|
|||||||
'@types/debug@4.1.12':
|
'@types/debug@4.1.12':
|
||||||
resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
|
resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
|
||||||
|
|
||||||
'@types/diff@5.2.3':
|
|
||||||
resolution: {integrity: sha512-K0Oqlrq3kQMaO2RhfrNQX5trmt+XLyom88zS0u84nnIcLvFnRUMRRHmrGny5GSM+kNO9IZLARsdQHDzkhAgmrQ==}
|
|
||||||
|
|
||||||
'@types/estree-jsx@1.0.5':
|
'@types/estree-jsx@1.0.5':
|
||||||
resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==}
|
resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==}
|
||||||
|
|
||||||
@ -1437,10 +1428,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==}
|
resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==}
|
||||||
engines: {node: '>=0.3.1'}
|
engines: {node: '>=0.3.1'}
|
||||||
|
|
||||||
diff@7.0.0:
|
|
||||||
resolution: {integrity: sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==}
|
|
||||||
engines: {node: '>=0.3.1'}
|
|
||||||
|
|
||||||
dlv@1.1.3:
|
dlv@1.1.3:
|
||||||
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
|
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
|
||||||
|
|
||||||
@ -4070,8 +4057,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/ms': 0.7.34
|
'@types/ms': 0.7.34
|
||||||
|
|
||||||
'@types/diff@5.2.3': {}
|
|
||||||
|
|
||||||
'@types/estree-jsx@1.0.5':
|
'@types/estree-jsx@1.0.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/estree': 1.0.6
|
'@types/estree': 1.0.6
|
||||||
@ -4599,8 +4584,6 @@ snapshots:
|
|||||||
|
|
||||||
diff@5.2.0: {}
|
diff@5.2.0: {}
|
||||||
|
|
||||||
diff@7.0.0: {}
|
|
||||||
|
|
||||||
dlv@1.1.3: {}
|
dlv@1.1.3: {}
|
||||||
|
|
||||||
dom-serializer@2.0.0:
|
dom-serializer@2.0.0:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
import Input from "@/components/Input.svelte"
|
import Input from "@/components/Input.astro"
|
||||||
import * as m from "@/paraglide/messages.js"
|
import * as m from "@/paraglide/messages.js"
|
||||||
// TODO self-host email server
|
// TODO self-host email server
|
||||||
---
|
---
|
@ -1,19 +1,20 @@
|
|||||||
---
|
---
|
||||||
import GiteaLink from "./links/GiteaLink.astro"
|
import GiteaLink from "./links/GiteaLink.astro"
|
||||||
|
import PajamasIcon from "./icons/PajamasIcon.astro"
|
||||||
import ExternalLink from "./links/ExternalLink.astro"
|
import ExternalLink from "./links/ExternalLink.astro"
|
||||||
import LanguageButtonGroup from "./LanguageButtonGroup.astro"
|
import LanguageButtonGroup from "./LanguageButtonGroup.astro"
|
||||||
|
import { GIT_URL, STATUS_URL } from "astro:env/client"
|
||||||
import * as m from "@/paraglide/messages"
|
import * as m from "@/paraglide/messages"
|
||||||
import { LINKED_IN_URL, THIS_GIT_URL, STATUS_URL } from "../constants"
|
|
||||||
|
const giteaLink = `${GIT_URL}/martials/martials.no`
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="divider" />
|
<div class="divider" />
|
||||||
<div class="py-5 flex flex-row gap-1 justify-around w-full items-center">
|
<div class="py-5 flex flex-row gap-1 justify-around w-full items-center">
|
||||||
<div class="flex flex-col gap-1">
|
<div>
|
||||||
<GiteaLink href={THIS_GIT_URL} />
|
<GiteaLink href={giteaLink} />
|
||||||
<ExternalLink href={LINKED_IN_URL} iconLeft="pajamas:linkedin" iconLeftAriaLabel="LinkedIn" title="LinkedIn">
|
<ExternalLink href={STATUS_URL} class="flex items-center" title="Status">
|
||||||
LinkedIn
|
<PajamasIcon name="pajamas:status-health" class="w-6 h-6 mr-2" />
|
||||||
</ExternalLink>
|
|
||||||
<ExternalLink href={STATUS_URL} iconLeft="pajamas:status-health" iconLeftAriaLabel="Status health" title="Status">
|
|
||||||
{m.status()}
|
{m.status()}
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
import Select from "./Select.svelte"
|
import Select from "./Select.svelte"
|
||||||
import * as m from "@/paraglide/messages"
|
import * as m from "@/paraglide/messages"
|
||||||
import CollapseList from "@/components/collapse/CollapseList.svelte"
|
import CollapseList from "@/components/collapse/CollapseList.svelte"
|
||||||
import type { CollectionEntry } from "astro:content"
|
|
||||||
|
|
||||||
export let hardware: CollectionEntry<"hardware">[] = []
|
export let hardware: any[] = []
|
||||||
|
|
||||||
const hardwareOptions = hardware.map((item) => ({
|
const hardwareOptions = hardware.map((item) => ({
|
||||||
key: item.id,
|
key: item.id,
|
||||||
|
28
src/components/Input.astro
Normal file
28
src/components/Input.astro
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
interface Props {
|
||||||
|
label: string
|
||||||
|
type?: "text" | "email" | "password" | "number"
|
||||||
|
name: string
|
||||||
|
required?: boolean
|
||||||
|
placeholder?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
label,
|
||||||
|
type = "text",
|
||||||
|
name,
|
||||||
|
required = false,
|
||||||
|
placeholder,
|
||||||
|
} = Astro.props
|
||||||
|
---
|
||||||
|
|
||||||
|
<label class="flex flex-col">
|
||||||
|
{label}
|
||||||
|
<input
|
||||||
|
class="input input-bordered"
|
||||||
|
type={type}
|
||||||
|
name={name}
|
||||||
|
required={required}
|
||||||
|
placeholder={placeholder}
|
||||||
|
/>
|
||||||
|
</label>
|
@ -1,19 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
export let label: string
|
|
||||||
export let type: "text" | "email" | "password" | "number" = "text"
|
|
||||||
export let name: string
|
|
||||||
export let required: boolean = false
|
|
||||||
export let placeholder: string
|
|
||||||
export let inputClass: string
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<label class="flex flex-col ${$$restProps.class}">
|
|
||||||
{label}
|
|
||||||
<input
|
|
||||||
class="input input-bordered ${inputClass}"
|
|
||||||
type={type}
|
|
||||||
name={name}
|
|
||||||
required={required}
|
|
||||||
placeholder={placeholder}
|
|
||||||
/>
|
|
||||||
</label>
|
|
@ -1,7 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<!-- TODO -->
|
|
||||||
</div>
|
|
@ -1,7 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="flex flex-row items-center ${$$restProps.class}">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
@ -1,29 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
|
|
||||||
export let defaultValue: boolean = false
|
|
||||||
export let title: string
|
|
||||||
export let onChange: (value: boolean) => void
|
|
||||||
export let name: string
|
|
||||||
export let id: string
|
|
||||||
|
|
||||||
let checked = defaultValue
|
|
||||||
|
|
||||||
function handleChange() {
|
|
||||||
checked = !checked
|
|
||||||
if (onChange) {
|
|
||||||
onChange(checked)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<button
|
|
||||||
id={id}
|
|
||||||
on:click={handleChange}
|
|
||||||
title={title}
|
|
||||||
class={`${checked ? "bg-cyan-900" : "bg-gray-500"} relative my-2 inline-flex h-6 w-11 items-center rounded-full ${$$restProps.class}`}
|
|
||||||
>
|
|
||||||
<span class={"sr-only"}>{name}</span>
|
|
||||||
<span
|
|
||||||
class={`${checked ? "translate-x-6" : "translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition-all`}
|
|
||||||
/>
|
|
||||||
</button>
|
|
@ -1,11 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
|
|
||||||
export let id: string | undefined = undefined
|
|
||||||
export let title: string
|
|
||||||
export let type: "button" | "submit" | "reset" = "button"
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<button id={id} class="btn" title={title} type={type}>
|
|
||||||
<slot />
|
|
||||||
</button>
|
|
@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
import ContactMeForm from "./ContactMeForm.astro"
|
|
||||||
import * as m from "@/paraglide/messages"
|
|
||||||
---
|
|
||||||
|
|
||||||
<h1 class="text-center">{m.contactMe()}</h1>
|
|
||||||
<ContactMeForm />
|
|
@ -7,4 +7,4 @@ interface Props {
|
|||||||
const { class: clazz } = Astro.props
|
const { class: clazz } = Astro.props
|
||||||
---
|
---
|
||||||
|
|
||||||
<PajamasIcon name="pajamas:gitea" aria-label="Gitea" class={clazz} />
|
<PajamasIcon name="pajamas:gitea" class={clazz}></PajamasIcon>
|
||||||
|
@ -2,13 +2,11 @@
|
|||||||
import type { PajamasIcon } from "@/types/icons"
|
import type { PajamasIcon } from "@/types/icons"
|
||||||
import type { ComponentProps } from "@/types/props"
|
import type { ComponentProps } from "@/types/props"
|
||||||
import { Icon } from "astro-icon/components"
|
import { Icon } from "astro-icon/components"
|
||||||
|
|
||||||
interface Props extends ComponentProps {
|
interface Props extends ComponentProps {
|
||||||
name: PajamasIcon
|
name: PajamasIcon
|
||||||
"aria-label": string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name, class: clazz, ...props } = Astro.props
|
const { name, class: clazz, ...props } = Astro.props
|
||||||
---
|
---
|
||||||
|
|
||||||
<Icon name={name} class:list={["w-6 h-6", clazz]} {...props} />
|
<Icon name={name} class:list={[clazz]} {...props} />
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import type { PajamasIcon } from "@/types/icons"
|
|
||||||
import { Icon } from "astro-icon/components"
|
|
||||||
|
|
||||||
export let name: PajamasIcon
|
|
||||||
export let ariaLabel: string
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Icon name={name} class="w-6 h-6 ${$$restProps.class}" aria-label={ariaLabel} />
|
|
@ -1,28 +1,12 @@
|
|||||||
---
|
---
|
||||||
import type { LinkProps } from "@/types/props"
|
import type { LinkProps } from "@/types/props"
|
||||||
import type { PajamasIcon } from "@/types/icons"
|
|
||||||
import ExternalLinkTextOnly from "./ExternalLinkTextOnly.astro"
|
|
||||||
import ExternalLinkIconLeft from "./ExternalLinkIconLeft.astro"
|
|
||||||
|
|
||||||
interface Props extends LinkProps {
|
interface Props extends LinkProps {
|
||||||
iconLeft?: PajamasIcon
|
noStyle?: boolean
|
||||||
iconLeftAriaLabel?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { iconLeft, iconLeftAriaLabel, ...props } = Astro.props
|
const { href, noStyle = false, class: clazz, ...props } = Astro.props
|
||||||
if (iconLeft && !iconLeftAriaLabel) {
|
|
||||||
throw new Error("ExternalLink: iconLeftAriaLabel is required when iconLeft is provided")
|
|
||||||
}
|
|
||||||
---
|
---
|
||||||
|
|
||||||
{ iconLeft && iconLeftAriaLabel
|
<a href={href} target="_blank" rel="noopener" class:list={[noStyle ? "" : "link", clazz]} {...props}>
|
||||||
?
|
|
||||||
<ExternalLinkIconLeft iconLeft={iconLeft} iconLeftAriaLabel={iconLeftAriaLabel} {...props}>
|
|
||||||
<slot />
|
<slot />
|
||||||
</ExternalLinkIconLeft>
|
</a>
|
||||||
:
|
|
||||||
<ExternalLinkTextOnly {...props}>
|
|
||||||
<slot />
|
|
||||||
</ExternalLinkTextOnly>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
import type { PajamasIcon as PajamasIconType } from "@/types/icons"
|
|
||||||
import type { LinkProps } from "@/types/props"
|
|
||||||
import ExternalLinkTextOnly from "./ExternalLinkTextOnly.astro"
|
|
||||||
import PajamasIcon from "../icons/PajamasIcon.astro"
|
|
||||||
|
|
||||||
interface Props extends LinkProps {
|
|
||||||
iconLeft: PajamasIconType
|
|
||||||
iconLeftAriaLabel: string
|
|
||||||
}
|
|
||||||
const { href, class: clazz, iconLeft, iconLeftAriaLabel, ...props } = Astro.props
|
|
||||||
---
|
|
||||||
|
|
||||||
<div class="flex items-center">
|
|
||||||
<PajamasIcon name={iconLeft} aria-label={iconLeftAriaLabel} class="mr-2" />
|
|
||||||
<ExternalLinkTextOnly href={href} class={clazz} {...props}>
|
|
||||||
<slot />
|
|
||||||
</ExternalLinkTextOnly>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
import type { LinkProps } from "@/types/props"
|
|
||||||
|
|
||||||
interface Props extends LinkProps {
|
|
||||||
}
|
|
||||||
|
|
||||||
const { href, class: clazz, ...props } = Astro.props
|
|
||||||
---
|
|
||||||
|
|
||||||
<a href={href} target="_blank" rel="noopener" class:list={[clazz]} {...props}>
|
|
||||||
<slot />
|
|
||||||
</a>
|
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
import ExternalLink from "./ExternalLink.astro"
|
import ExternalLink from "./ExternalLink.astro"
|
||||||
import * as m from "@/paraglide/messages"
|
import * as m from "@/paraglide/messages"
|
||||||
|
import Gitea from "../icons/Gitea.astro"
|
||||||
interface Props {
|
interface Props {
|
||||||
href: string
|
href: string
|
||||||
}
|
}
|
||||||
@ -8,7 +9,8 @@ const { href } = Astro.props
|
|||||||
---
|
---
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ExternalLink iconLeft="pajamas:gitea" iconLeftAriaLabel="Gitea" href={href}>
|
<ExternalLink href={href} class="flex items-center gap-1">
|
||||||
|
<Gitea class="w-6 h-6" />
|
||||||
{m.sourceCode()}
|
{m.sourceCode()}
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,10 +10,10 @@ interface Props extends MyLink {
|
|||||||
const { title, message, url, icon, class: clazz } = Astro.props
|
const { title, message, url, icon, class: clazz } = Astro.props
|
||||||
---
|
---
|
||||||
|
|
||||||
<ExternalLink href={url}>
|
<ExternalLink href={url} noStyle>
|
||||||
<div class:list={["card bg-neutral", clazz]}>
|
<div class:list={["card bg-neutral", clazz]}>
|
||||||
<div class="card-body p-5 flex flex-row items-center">
|
<div class="card-body p-5 flex flex-row items-center">
|
||||||
<PajamasIcon name={icon ?? "pajamas:link"} aria-label={icon ? title : "Link"} />
|
<PajamasIcon name={icon ?? "pajamas:link"} class="w-6 h-6" />
|
||||||
<div>
|
<div>
|
||||||
<h5 class="card-title">{title}</h5>
|
<h5 class="card-title">{title}</h5>
|
||||||
<p class="prose">{message}</p>
|
<p class="prose">{message}</p>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { PajamasIcon } from "@/types/icons.ts"
|
import type { PajamasIcon } from "@/types/icons.ts"
|
||||||
|
import { GIT_URL } from "astro:env/client"
|
||||||
import * as m from "@/paraglide/messages"
|
import * as m from "@/paraglide/messages"
|
||||||
import * as c from "@/constants.ts"
|
|
||||||
|
|
||||||
export interface MyLink {
|
export interface MyLink {
|
||||||
title: string;
|
title: string;
|
||||||
@ -12,35 +12,35 @@ export interface MyLink {
|
|||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
title: "GitHub",
|
title: "GitHub",
|
||||||
url: c.GITHUB_PROFILE_URL,
|
url: "https://github.com/emberal",
|
||||||
icon: "pajamas:github"
|
icon: "pajamas:github"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Gitea",
|
title: "Gitea",
|
||||||
url: c.GIT_PROFILE_URL,
|
url: `${GIT_URL}/martials`,
|
||||||
message: m.forPersonalProjects(),
|
message: m.forPersonalProjects(),
|
||||||
icon: "pajamas:gitea"
|
icon: "pajamas:gitea"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "LinkedIn",
|
title: "LinkedIn",
|
||||||
url: c.LINKED_IN_URL,
|
url: "https://www.linkedin.com/in/martin-b-2a69391a3/",
|
||||||
icon: "pajamas:linkedin"
|
icon: "pajamas:linkedin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Mastodon (Snabelen)",
|
title: "Mastodon (Snabelen)",
|
||||||
url: c.MASTODON_URL,
|
url: "https://snabelen.no/@Martials",
|
||||||
icon: "pajamas:mastodon"
|
icon: "pajamas:mastodon"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Pixelfed",
|
title: "Pixelfed",
|
||||||
url: c.PIXELFED_URL
|
url: "https://pixelfed.social/i/web/profile/261454857934868480"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Steam",
|
title: "Steam",
|
||||||
url: c.STEAM_URL
|
url: "https://steamcommunity.com/id/martials/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Trakt.tv",
|
title: "Trakt.tv",
|
||||||
url: c.TRAKT_URL
|
url: "https://trakt.tv/users/martials"
|
||||||
}
|
}
|
||||||
] satisfies MyLink[]
|
] satisfies MyLink[]
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
import KeywordsDisclosure from "./KeywordsDisclosure.astro"
|
|
||||||
import DisclosureContainer from "./output/DisclosureContainer.astro"
|
|
||||||
import Disclosure from "./output/Disclosure.astro"
|
|
||||||
import ExternalLink from "../links/ExternalLink.astro"
|
|
||||||
// TODO translate and move link
|
|
||||||
---
|
|
||||||
|
|
||||||
<DisclosureContainer>
|
|
||||||
<Disclosure title={"How to"}>
|
|
||||||
<p>
|
|
||||||
Fill in a truth expression and it will be simplified for you as much as possible. It will
|
|
||||||
also genereate a truth table with all possible values. You can use a single letter, word or
|
|
||||||
multiple words without spacing for each atomic value. If you do not want to simplify the
|
|
||||||
expression, simply turn off the toggle. Keywords for operators are defined below.
|
|
||||||
Parentheses is also allowed.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
API docs can be found
|
|
||||||
<ExternalLink href={"https://api.martials.no/simplify-truths"}>here</ExternalLink>
|
|
||||||
.
|
|
||||||
</p>
|
|
||||||
</Disclosure>
|
|
||||||
|
|
||||||
<KeywordsDisclosure />
|
|
||||||
</DisclosureContainer>
|
|
@ -1,40 +0,0 @@
|
|||||||
---
|
|
||||||
import Disclosure from "./output/Disclosure.astro"
|
|
||||||
// TODO Translate
|
|
||||||
---
|
|
||||||
|
|
||||||
<Disclosure title={"Keywords"}>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr class={"text-left"}>
|
|
||||||
<th>Name</th>
|
|
||||||
<th class={"pr-2"}>API</th>
|
|
||||||
<th>Other</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>Not:</td>
|
|
||||||
<td>!</td>
|
|
||||||
<td>NOT</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>And:</td>
|
|
||||||
<td>&</td>
|
|
||||||
<td>AND</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Or:</td>
|
|
||||||
<td>|</td>
|
|
||||||
<td>/</td>
|
|
||||||
<td>OR</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class={"pr-2"}>Implication:</td>
|
|
||||||
<td>{"->"}</td>
|
|
||||||
<td class={"px-2"}>IMPLICATION</td>
|
|
||||||
<td>IMP</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</Disclosure>
|
|
@ -1,24 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
|
|
||||||
import Input from "@/components/Input.svelte"
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Input
|
|
||||||
inputClass={`rounded-xl pl-7 h-10 w-full pr-8`}
|
|
||||||
class={`w-full ${$$restProps.class}`}
|
|
||||||
id={id}
|
|
||||||
ref={ref}
|
|
||||||
placeholder="¬A & B -> C"
|
|
||||||
type={"text"}
|
|
||||||
onChange={onChange}
|
|
||||||
leading={
|
|
||||||
<Icon path={magnifyingGlass} aria-label={"Magnifying glass"} class={"absolute pl-2"} />
|
|
||||||
}
|
|
||||||
trailing={
|
|
||||||
<Show when={typing()} keyed>
|
|
||||||
<button class={"absolute right-2"} title={"Clear"} type={"reset"} onClick={clearSearch}>
|
|
||||||
<Icon path={xMark} aria-label={"The letter X"} />
|
|
||||||
</button>
|
|
||||||
</Show>
|
|
||||||
}
|
|
||||||
/>
|
|
@ -1,37 +0,0 @@
|
|||||||
---
|
|
||||||
import type { FetchResult } from "@/types/types"
|
|
||||||
import Disclosure from "./output/Disclosure.astro"
|
|
||||||
import DisclosureContainer from "./output/DisclosureContainer.astro"
|
|
||||||
import { diffChars } from "diff"
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
fetchResult: FetchResult | null
|
|
||||||
}
|
|
||||||
const { fetchResult } = Astro.props
|
|
||||||
---
|
|
||||||
|
|
||||||
<DisclosureContainer>
|
|
||||||
<Disclosure title={"Show me how it's done"}>
|
|
||||||
<table class={"table"}>
|
|
||||||
<tbody>
|
|
||||||
{
|
|
||||||
fetchResult?.orderOperations?.map((operation, index) => (
|
|
||||||
<tr class={"border-b border-dotted border-gray-500"}>
|
|
||||||
<td>{index + 1}:</td>
|
|
||||||
<td class={"px-2"}>
|
|
||||||
{
|
|
||||||
diffChars(operation.before, operation.after).map((part) => (
|
|
||||||
<span class={`${part.added && "bg-green-700"} ${part.removed && "bg-red-700"}`}>
|
|
||||||
{part.value}
|
|
||||||
</span>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
<td>using: {operation.law}</td>
|
|
||||||
</tr>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</Disclosure>
|
|
||||||
</DisclosureContainer>
|
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
import SimplifyTruthsPageBody from "./SimplifyTruthsPageBody.svelte"
|
|
||||||
import HowTo from "./HowTo.astro"
|
|
||||||
---
|
|
||||||
|
|
||||||
<div id={"truth-content"}>
|
|
||||||
<SimplifyTruthsPageBody>
|
|
||||||
<HowTo />
|
|
||||||
</SimplifyTruthsPageBody>
|
|
||||||
</div>
|
|
@ -1,428 +0,0 @@
|
|||||||
/* @refresh reload */
|
|
||||||
|
|
||||||
type Option = {
|
|
||||||
name: string
|
|
||||||
value: "NONE" | "TRUE" | "FALSE" | "DEFAULT" | "TRUE_FIRST" | "FALSE_FIRST"
|
|
||||||
}
|
|
||||||
|
|
||||||
const fetchUrls = [
|
|
||||||
"http://localhost:8080/simplify/table/",
|
|
||||||
"https://api.martials.no/simplify-truths/simplify/table/"
|
|
||||||
]
|
|
||||||
|
|
||||||
// TODO move some code to new components
|
|
||||||
const TruthTablePage: Component = () => {
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams()
|
|
||||||
let inputElement: HTMLInputElement | undefined = undefined
|
|
||||||
|
|
||||||
let simplifyDefault = searchParams.simplify === undefined || searchParams.simplify === "true",
|
|
||||||
inputContent = !!searchParams.exp,
|
|
||||||
hideIntermediate = searchParams.hideIntermediate === "true"
|
|
||||||
|
|
||||||
const [simplifyEnabled, setSimplifyEnabled] = createSignal(simplifyDefault)
|
|
||||||
const [fetchResult, setFetchResult] = createSignal<FetchResult | null>(null)
|
|
||||||
|
|
||||||
const hideOptions: Option[] = [
|
|
||||||
{ name: "Show all result", value: "NONE" },
|
|
||||||
{ name: "Hide true results", value: "TRUE" },
|
|
||||||
{ name: "Hide false results", value: "FALSE" }
|
|
||||||
]
|
|
||||||
|
|
||||||
const [hideValues, setHideValues] = createSignal(hideOptions[0])
|
|
||||||
|
|
||||||
const sortOptions: Option[] = [
|
|
||||||
{ name: "Sort by default", value: "DEFAULT" },
|
|
||||||
{ name: "Sort by true first", value: "TRUE_FIRST" },
|
|
||||||
{ name: "Sort by false first", value: "FALSE_FIRST" }
|
|
||||||
]
|
|
||||||
|
|
||||||
const [sortValues, setSortValues] = createSignal(sortOptions[0])
|
|
||||||
const [hideIntermediates, setHideIntermediates] = createSignal(hideIntermediate)
|
|
||||||
const [isLoaded, setIsLoaded] = createSignal<boolean | null>(null)
|
|
||||||
const [error, setError] = createSignal<{ title: string; message: string } | null>(null)
|
|
||||||
const [useLocalhost, setUseLocalhost] = createSignal(false)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the state of the current expression to the new search with all whitespace removed.
|
|
||||||
* If the element is not found, reset.
|
|
||||||
*/
|
|
||||||
function onClick(e: Event): void {
|
|
||||||
e.preventDefault() // Stops the page from reloading onClick
|
|
||||||
const exp = inputElement?.value
|
|
||||||
|
|
||||||
if (exp) {
|
|
||||||
setSearchParams({
|
|
||||||
exp,
|
|
||||||
simplify: simplifyEnabled(),
|
|
||||||
hide: hideValues().value,
|
|
||||||
sort: sortValues().value,
|
|
||||||
hideIntermediate: hideIntermediates()
|
|
||||||
})
|
|
||||||
|
|
||||||
getFetchResult(exp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFetchResult(exp: string | null): void {
|
|
||||||
setFetchResult(null)
|
|
||||||
|
|
||||||
if (exp && exp !== "") {
|
|
||||||
exp = replaceOperators(exp)
|
|
||||||
setError(null)
|
|
||||||
setIsLoaded(false)
|
|
||||||
|
|
||||||
fetch(`${fetchUrls[useLocalhost() ? 0 : 1]}${encodeURIComponent(exp)}?
|
|
||||||
simplify=${simplifyEnabled()}&hide=${hideValues().value}&sort=${sortValues().value}&caseSensitive=false&
|
|
||||||
hideIntermediate=${hideIntermediates()}`)
|
|
||||||
.then((res) => res.json())
|
|
||||||
.then((res) => {
|
|
||||||
if (res.status !== "OK" && !res.ok) {
|
|
||||||
return setError({ title: "Input error", message: res.message })
|
|
||||||
}
|
|
||||||
return setFetchResult(res)
|
|
||||||
})
|
|
||||||
.catch((err) => setError({ title: "Fetch error", message: err.toString() }))
|
|
||||||
.finally(() => setIsLoaded(true))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount((): void => {
|
|
||||||
if (searchParams.exp) {
|
|
||||||
const exp = searchParams.exp
|
|
||||||
if (exp && inputElement) {
|
|
||||||
inputElement.value = exp
|
|
||||||
}
|
|
||||||
const hide = searchParams.hide
|
|
||||||
if (hide) {
|
|
||||||
setHideValues(hideOptions.find((o) => o.value === hide) ?? hideOptions[0])
|
|
||||||
}
|
|
||||||
const sort = searchParams.sort
|
|
||||||
if (sort) {
|
|
||||||
setSortValues(sortOptions.find((o) => o.value === sort) ?? sortOptions[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
getFetchResult(exp)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Focuses searchbar on load
|
|
||||||
if (!isTouch()) {
|
|
||||||
inputElement?.focus()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const tableId = "truth-table"
|
|
||||||
const filenameId = "excel-filename"
|
|
||||||
|
|
||||||
function _exportToExcel(): void {
|
|
||||||
const value = getElementById<HTMLInputElement>(filenameId)?.value
|
|
||||||
exportToExcel({
|
|
||||||
name: value !== "" ? value : undefined,
|
|
||||||
tableId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Layout title={"Truth tables"}>
|
|
||||||
<Show when={import.meta.env.DEV ?? false} keyed>
|
|
||||||
(DEV) Use localhost:
|
|
||||||
<MySwitch title={"Use localhost"} defaultValue={false} onChange={setUseLocalhost} />
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<div id={"truth-content"}>
|
|
||||||
<div class={"mx-auto max-w-2xl"}>
|
|
||||||
<HowTo />
|
|
||||||
|
|
||||||
<form class={"flex-row-center"} onSubmit={onClick} autocomplete={"off"}>
|
|
||||||
<Search ref={inputElement} typingDefault={inputContent} />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
id={"truth-input-button"}
|
|
||||||
title={"Generate (Enter)"}
|
|
||||||
type={"submit"}
|
|
||||||
className={"min-w-50px ml-2 h-10"}
|
|
||||||
children={"Generate"}
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{/* Options row */}
|
|
||||||
<Row className={"my-1 gap-2"}>
|
|
||||||
<span class={"h-min"}>{"Simplify"}: </span>
|
|
||||||
|
|
||||||
<MySwitch
|
|
||||||
onChange={setSimplifyEnabled}
|
|
||||||
defaultValue={simplifyEnabled()}
|
|
||||||
title={"Simplify"}
|
|
||||||
name={"Turn on/off simplify expressions"}
|
|
||||||
className={"mx-1"}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div class={"relative h-min"}>
|
|
||||||
<MyMenu
|
|
||||||
title={"Filter results"}
|
|
||||||
id={"filter-results"}
|
|
||||||
button={
|
|
||||||
<Show
|
|
||||||
when={hideValues().value !== "NONE"}
|
|
||||||
children={
|
|
||||||
<Icon
|
|
||||||
path={eyeSlash}
|
|
||||||
aria-label={"An eye with a slash through it"}
|
|
||||||
class={`mx-1 ${hideValues().value === "TRUE" ? "text-green-500" : "text-red-500"}`}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
fallback={<Icon path={eye} aria-label={"An eye"} class={"mx-1"} />}
|
|
||||||
keyed
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
children={
|
|
||||||
<For each={hideOptions}>
|
|
||||||
{(option) => (
|
|
||||||
<SingleMenuItem
|
|
||||||
onClick={() => setHideValues(option)}
|
|
||||||
option={option}
|
|
||||||
currentValue={hideValues}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</For>
|
|
||||||
}
|
|
||||||
itemsClassName={"right-0"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class={"relative h-min"}>
|
|
||||||
<MyMenu
|
|
||||||
title={"Sort results"}
|
|
||||||
id={"sort-results"}
|
|
||||||
button={
|
|
||||||
<Icon
|
|
||||||
path={funnel}
|
|
||||||
aria-label={"Filter"}
|
|
||||||
class={`h-6 w-6 ${
|
|
||||||
sortValues().value === "TRUE_FIRST"
|
|
||||||
? "text-green-500"
|
|
||||||
: sortValues().value === "FALSE_FIRST" && "text-red-500"
|
|
||||||
}`}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
children={
|
|
||||||
<For each={sortOptions}>
|
|
||||||
{(option) => (
|
|
||||||
<SingleMenuItem
|
|
||||||
option={option}
|
|
||||||
currentValue={sortValues}
|
|
||||||
onClick={() => setSortValues(option)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</For>
|
|
||||||
}
|
|
||||||
itemsClassName={"right-0"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<MySwitch
|
|
||||||
title={"Hide intermediate values"}
|
|
||||||
onChange={setHideIntermediates}
|
|
||||||
defaultValue={hideIntermediates()}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Show when={isLoaded() && error() === null} keyed>
|
|
||||||
<MyDialog
|
|
||||||
title={"Download"}
|
|
||||||
description={"Export current table (.xlsx)"}
|
|
||||||
button={
|
|
||||||
<>
|
|
||||||
<p class={"sr-only"}>{"Download"}</p>
|
|
||||||
<Icon aria-label={"Download"} path={arrowDownTray} />
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
callback={_exportToExcel}
|
|
||||||
acceptButtonName={"Download"}
|
|
||||||
cancelButtonName={"Cancel"}
|
|
||||||
buttonClass={`float-right`}
|
|
||||||
buttonTitle={"Export current table"}
|
|
||||||
acceptButtonId={"download-accept"}
|
|
||||||
>
|
|
||||||
<p>{"Filename"}:</p>
|
|
||||||
<Input
|
|
||||||
className={"border-rounded h-10 px-2"}
|
|
||||||
id={filenameId}
|
|
||||||
placeholder={"Truth Table"}
|
|
||||||
/>
|
|
||||||
</MyDialog>
|
|
||||||
</Show>
|
|
||||||
</Row>
|
|
||||||
|
|
||||||
<Show when={error()} keyed>
|
|
||||||
<ErrorBox
|
|
||||||
title={error()?.title ?? "Error"}
|
|
||||||
error={error()?.message ?? "Something went wrong"}
|
|
||||||
/>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={isLoaded() === false} keyed>
|
|
||||||
<Icon
|
|
||||||
path={arrowPath}
|
|
||||||
aria-label={"Loading indicator"}
|
|
||||||
class={"mx-auto animate-spin"}
|
|
||||||
/>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={simplifyEnabled() && (fetchResult()?.orderOperations?.length ?? 0) > 0} keyed>
|
|
||||||
<ShowMeHow fetchResult={fetchResult} />
|
|
||||||
</Show>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Show when={isLoaded() && error() === null} keyed>
|
|
||||||
<Show when={simplifyEnabled()} keyed>
|
|
||||||
<InfoBox
|
|
||||||
className={"mx-auto w-fit pb-1 text-center text-lg"}
|
|
||||||
title={"Output:"}
|
|
||||||
id={"expression-output"}
|
|
||||||
>
|
|
||||||
<p>{fetchResult()?.after}</p>
|
|
||||||
</InfoBox>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<div class={"m-2 flex justify-center"}>
|
|
||||||
<div id={"table"} class={"h-[45rem] overflow-auto"}>
|
|
||||||
<TruthTable
|
|
||||||
header={fetchResult()?.header ?? undefined}
|
|
||||||
table={fetchResult()?.table?.truthMatrix}
|
|
||||||
id={tableId}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default TruthTablePage
|
|
||||||
|
|
||||||
interface SingleMenuItem {
|
|
||||||
option: Option
|
|
||||||
currentValue?: Accessor<Option>
|
|
||||||
onClick: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>
|
|
||||||
}
|
|
||||||
|
|
||||||
const SingleMenuItem: Component<SingleMenuItem> = ({ option, currentValue, onClick }) => {
|
|
||||||
const isSelected = () => currentValue?.().value === option.value
|
|
||||||
return (
|
|
||||||
<button class={`flex-row-center cursor-pointer last:mb-1 hover:underline`} onClick={onClick}>
|
|
||||||
<Icon
|
|
||||||
path={check}
|
|
||||||
aria-label={isSelected() ? "A checkmark" : "Nothing"}
|
|
||||||
class={`text-white ${!isSelected() && "invisible"}`}
|
|
||||||
/>
|
|
||||||
{option.name}
|
|
||||||
</button>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const ErrorBox: Component<{ title: string; error: string }> = ({ title, error }) => (
|
|
||||||
<InfoBox className={"mx-auto w-fit text-center"} title={title} error={true}>
|
|
||||||
<p>{error}</p>
|
|
||||||
</InfoBox>
|
|
||||||
)
|
|
||||||
|
|
||||||
interface ShowMeHowProps {
|
|
||||||
fetchResult: Accessor<FetchResult | null>
|
|
||||||
}
|
|
||||||
|
|
||||||
const ShowMeHow: Component<ShowMeHowProps> = ({ fetchResult }) => (
|
|
||||||
<MyDisclosureContainer>
|
|
||||||
<MyDisclosure title={"Show me how it's done"}>
|
|
||||||
<table class={"table"}>
|
|
||||||
<tbody>
|
|
||||||
<For each={fetchResult()?.orderOperations}>{orderOperationRow()}</For>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</MyDisclosure>
|
|
||||||
</MyDisclosureContainer>
|
|
||||||
)
|
|
||||||
|
|
||||||
const HowTo: Component = () => (
|
|
||||||
<MyDisclosureContainer>
|
|
||||||
<MyDisclosure title={"How to"}>
|
|
||||||
<p>
|
|
||||||
Fill in a truth expression and it will be simplified for you as much as possible. It will
|
|
||||||
also genereate a truth table with all possible values. You can use a single letter, word or
|
|
||||||
multiple words without spacing for each atomic value. If you do not want to simplify the
|
|
||||||
expression, simply turn off the toggle. Keywords for operators are defined below.
|
|
||||||
Parentheses is also allowed.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
API docs can be found <Link to={"https://api.martials.no/simplify-truths"}>here</Link>.
|
|
||||||
</p>
|
|
||||||
</MyDisclosure>
|
|
||||||
|
|
||||||
<KeywordsDisclosure />
|
|
||||||
</MyDisclosureContainer>
|
|
||||||
)
|
|
||||||
|
|
||||||
const orderOperationRow = () => (operation: OrderOfOperation, index: Accessor<number>) => (
|
|
||||||
<tr class={"border-b border-dotted border-gray-500"}>
|
|
||||||
<td>{index() + 1}:</td>
|
|
||||||
<td class={"px-2"}>
|
|
||||||
{
|
|
||||||
<For each={diffChars(operation.before, operation.after)}>
|
|
||||||
{(part) => (
|
|
||||||
<span class={`${part.added && "bg-green-700"} ${part.removed && "bg-red-700"}`}>
|
|
||||||
{part.value}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</For>
|
|
||||||
}
|
|
||||||
|
|
||||||
<Show when={typeof window !== "undefined" && window.outerWidth <= 640} keyed>
|
|
||||||
<p>
|
|
||||||
{"using"}: {operation.law}
|
|
||||||
</p>
|
|
||||||
</Show>
|
|
||||||
</td>
|
|
||||||
<Show when={typeof window !== "undefined" && window.outerWidth > 640} keyed>
|
|
||||||
<td>
|
|
||||||
{"using"}: {operation.law}
|
|
||||||
</td>
|
|
||||||
</Show>
|
|
||||||
</tr>
|
|
||||||
)
|
|
||||||
|
|
||||||
const KeywordsDisclosure: Component = () => (
|
|
||||||
<MyDisclosure title={"Keywords"}>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr class={"text-left"}>
|
|
||||||
<th>Name</th>
|
|
||||||
<th class={"pr-2"}>API</th>
|
|
||||||
<th>Other</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>Not:</td>
|
|
||||||
<td>!</td>
|
|
||||||
<td>NOT</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>And:</td>
|
|
||||||
<td>&</td>
|
|
||||||
<td>AND</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Or:</td>
|
|
||||||
<td>|</td>
|
|
||||||
<td>/</td>
|
|
||||||
<td>OR</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class={"pr-2"}>Implication:</td>
|
|
||||||
<td>{"->"}</td>
|
|
||||||
<td class={"px-2"}>IMPLICATION</td>
|
|
||||||
<td>IMP</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</MyDisclosure>
|
|
||||||
)
|
|
@ -1,302 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
|
|
||||||
import Switch from "@/components/Switch.svelte"
|
|
||||||
import Search from "@/components/simplifyTruths/Search.svelte"
|
|
||||||
import { onMount } from "svelte"
|
|
||||||
import Button from "@/components/buttons/Button.svelte"
|
|
||||||
import Row from "@/components/Row.svelte"
|
|
||||||
import Menu from "@/components/Menu.svelte"
|
|
||||||
import PajamasIcon from "@/components/icons/PajamasIcon.svelte"
|
|
||||||
|
|
||||||
let useLocalhost = false
|
|
||||||
let inputElement: HTMLInputElement | null = null
|
|
||||||
|
|
||||||
// TODO refactor getter and setters
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the state of the current expression to the new search with all whitespace removed.
|
|
||||||
* If the element is not found, reset.
|
|
||||||
*/
|
|
||||||
function onFormSubmit(e: Event): void {
|
|
||||||
e.preventDefault() // Stops the page from reloading on:click
|
|
||||||
const exp = inputElement?.value // TODO test
|
|
||||||
|
|
||||||
if (exp) {
|
|
||||||
setSearchParams({
|
|
||||||
exp,
|
|
||||||
simplify: simplifyEnabled(),
|
|
||||||
hide: hideValues().value,
|
|
||||||
sort: sortValues().value,
|
|
||||||
hideIntermediate: hideIntermediates()
|
|
||||||
})
|
|
||||||
|
|
||||||
getFetchResult(exp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFetchResult(exp: string | null): void {
|
|
||||||
setFetchResult(null)
|
|
||||||
|
|
||||||
if (exp && exp !== "") {
|
|
||||||
exp = replaceOperators(exp)
|
|
||||||
setError(null)
|
|
||||||
setIsLoaded(false)
|
|
||||||
|
|
||||||
// TODO refactor
|
|
||||||
fetch(`${fetchUrls[useLocalhost() ? 0 : 1]}${encodeURIComponent(exp)}?
|
|
||||||
simplify=${simplifyEnabled()}&hide=${hideValues().value}&sort=${sortValues().value}&caseSensitive=false&
|
|
||||||
hideIntermediate=${hideIntermediates()}`)
|
|
||||||
.then((res) => res.json())
|
|
||||||
.then((res) => {
|
|
||||||
if (res.status !== "OK" && !res.ok) {
|
|
||||||
return setError({ title: "Input error", message: res.message })
|
|
||||||
}
|
|
||||||
return setFetchResult(res)
|
|
||||||
})
|
|
||||||
.catch((err) => setError({ title: "Fetch error", message: err.toString() }))
|
|
||||||
.finally(() => setIsLoaded(true))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fetchUrls = [
|
|
||||||
"http://localhost:8080/simplify/table/",
|
|
||||||
"https://api.martials.no/simplify-truths/simplify/table/"
|
|
||||||
]
|
|
||||||
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams()
|
|
||||||
let inputElement: HTMLInputElement | undefined = undefined
|
|
||||||
|
|
||||||
let simplifyDefault = searchParams.simplify === undefined || searchParams.simplify === "true",
|
|
||||||
inputContent = !!searchParams.exp,
|
|
||||||
hideIntermediate = searchParams.hideIntermediate === "true"
|
|
||||||
|
|
||||||
const [simplifyEnabled, setSimplifyEnabled] = createSignal(simplifyDefault)
|
|
||||||
const [fetchResult, setFetchResult] = createSignal<FetchResult | null>(null)
|
|
||||||
|
|
||||||
const hideOptions: Option[] = [
|
|
||||||
{ name: "Show all result", value: "NONE" },
|
|
||||||
{ name: "Hide true results", value: "TRUE" },
|
|
||||||
{ name: "Hide false results", value: "FALSE" }
|
|
||||||
]
|
|
||||||
|
|
||||||
const [hideValues, setHideValues] = createSignal(hideOptions[0])
|
|
||||||
|
|
||||||
const sortOptions: Option[] = [
|
|
||||||
{ name: "Sort by default", value: "DEFAULT" },
|
|
||||||
{ name: "Sort by true first", value: "TRUE_FIRST" },
|
|
||||||
{ name: "Sort by false first", value: "FALSE_FIRST" }
|
|
||||||
]
|
|
||||||
|
|
||||||
const [sortValues, setSortValues] = createSignal(sortOptions[0])
|
|
||||||
const [hideIntermediates, setHideIntermediates] = createSignal(hideIntermediate)
|
|
||||||
const [isLoaded, setIsLoaded] = createSignal<boolean | null>(null)
|
|
||||||
const [error, setError] = createSignal<{ title: string; message: string } | null>(null)
|
|
||||||
const [useLocalhost, setUseLocalhost] = createSignal(false)
|
|
||||||
|
|
||||||
onMount((): void => {
|
|
||||||
if (searchParams.exp) {
|
|
||||||
const exp = searchParams.exp
|
|
||||||
if (exp && inputElement) {
|
|
||||||
inputElement.value = exp
|
|
||||||
}
|
|
||||||
const hide = searchParams.hide
|
|
||||||
if (hide) {
|
|
||||||
setHideValues(hideOptions.find((o) => o.value === hide) ?? hideOptions[0])
|
|
||||||
}
|
|
||||||
const sort = searchParams.sort
|
|
||||||
if (sort) {
|
|
||||||
setSortValues(sortOptions.find((o) => o.value === sort) ?? sortOptions[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
getFetchResult(exp)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Focuses searchbar on load
|
|
||||||
if (!isTouch()) {
|
|
||||||
inputElement?.focus()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const tableId = "truth-table"
|
|
||||||
const filenameId = "excel-filename"
|
|
||||||
|
|
||||||
function _exportToExcel(): void {
|
|
||||||
const value = getElementById<HTMLInputElement>(filenameId)?.value
|
|
||||||
exportToExcel({
|
|
||||||
name: value !== "" ? value : undefined,
|
|
||||||
tableId
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if import.meta.env.DEV}
|
|
||||||
(DEV) Use localhost:
|
|
||||||
<Switch title={"Use localhost"} defaultValue={false} onChange={(state) => useLocalhost = state} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
|
||||||
<div class={"mx-auto max-w-2xl"}>
|
|
||||||
<slot />
|
|
||||||
<form class={"flex-row-center"} onSubmit={onFormSubmit} autocomplete={"off"}>
|
|
||||||
<Search ref={inputElement} typingDefault={inputContent} />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
id={"truth-input-button"}
|
|
||||||
title={"Generate (Enter)"}
|
|
||||||
type={"submit"}
|
|
||||||
className={"min-w-50px ml-2 h-10"}
|
|
||||||
>
|
|
||||||
Generate
|
|
||||||
</Button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- Options row -->
|
|
||||||
<Row class={"my-1 gap-2"}>
|
|
||||||
<span class={"h-min"}>{"Simplify"}: </span>
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
onChange={setSimplifyEnabled}
|
|
||||||
defaultValue={simplifyEnabled()}
|
|
||||||
title={"Simplify"}
|
|
||||||
name={"Turn on/off simplify expressions"}
|
|
||||||
className={"mx-1"}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div class={"relative h-min"}>
|
|
||||||
<Menu
|
|
||||||
title={"Filter results"}
|
|
||||||
id={"filter-results"}
|
|
||||||
button={
|
|
||||||
<Show
|
|
||||||
when={hideValues().value !== "NONE"}
|
|
||||||
children={
|
|
||||||
<Icon
|
|
||||||
path={eyeSlash}
|
|
||||||
aria-label={"An eye with a slash through it"}
|
|
||||||
class={`mx-1 ${hideValues().value === "TRUE" ? "text-green-500" : "text-red-500"}`}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
fallback={<Icon path={eye} aria-label={"An eye"} class={"mx-1"} />}
|
|
||||||
keyed
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
children={
|
|
||||||
<For each={hideOptions}>
|
|
||||||
{(option) => (
|
|
||||||
<SingleMenuItem
|
|
||||||
onClick={() => setHideValues(option)}
|
|
||||||
option={option}
|
|
||||||
currentValue={hideValues}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</For>
|
|
||||||
}
|
|
||||||
itemsClassName={"right-0"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class={"relative h-min"}>
|
|
||||||
<Menu
|
|
||||||
title={"Sort results"}
|
|
||||||
id={"sort-results"}
|
|
||||||
button={
|
|
||||||
<PajamasIcon
|
|
||||||
name="TODO"
|
|
||||||
aria-label={"Filter"}
|
|
||||||
class={`h-6 w-6 ${
|
|
||||||
sortValues().value === "TRUE_FIRST"
|
|
||||||
? "text-green-500"
|
|
||||||
: sortValues().value === "FALSE_FIRST" && "text-red-500"
|
|
||||||
}`}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
children={
|
|
||||||
<For each={sortOptions}>
|
|
||||||
{(option) => (
|
|
||||||
<SingleMenuItem
|
|
||||||
option={option}
|
|
||||||
currentValue={sortValues}
|
|
||||||
onClick={() => setSortValues(option)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</For>
|
|
||||||
}
|
|
||||||
itemsClassName={"right-0"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
title={"Hide intermediate values"}
|
|
||||||
onChange={setHideIntermediates}
|
|
||||||
defaultValue={hideIntermediates()}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Show when={isLoaded() && error() === null} keyed>
|
|
||||||
<MyDialog
|
|
||||||
title={"Download"}
|
|
||||||
description={"Export current table (.xlsx)"}
|
|
||||||
button={
|
|
||||||
<>
|
|
||||||
<p class={"sr-only"}>{"Download"}</p>
|
|
||||||
<Icon aria-label={"Download"} path={arrowDownTray} />
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
callback={_exportToExcel}
|
|
||||||
acceptButtonName={"Download"}
|
|
||||||
cancelButtonName={"Cancel"}
|
|
||||||
buttonClass={`float-right`}
|
|
||||||
buttonTitle={"Export current table"}
|
|
||||||
acceptButtonId={"download-accept"}
|
|
||||||
>
|
|
||||||
<p>{"Filename"}:</p>
|
|
||||||
<Input
|
|
||||||
className={"border-rounded h-10 px-2"}
|
|
||||||
id={filenameId}
|
|
||||||
placeholder={"Truth Table"}
|
|
||||||
/>
|
|
||||||
</MyDialog>
|
|
||||||
</Show>
|
|
||||||
</Row>
|
|
||||||
|
|
||||||
<Show when={error()} keyed>
|
|
||||||
<ErrorBox
|
|
||||||
title={error()?.title ?? "Error"}
|
|
||||||
error={error()?.message ?? "Something went wrong"}
|
|
||||||
/>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={isLoaded() === false} keyed>
|
|
||||||
<Icon
|
|
||||||
path={arrowPath}
|
|
||||||
aria-label={"Loading indicator"}
|
|
||||||
class={"mx-auto animate-spin"}
|
|
||||||
/>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={simplifyEnabled() && (fetchResult()?.orderOperations?.length ?? 0) > 0} keyed>
|
|
||||||
<ShowMeHow fetchResult={fetchResult} />
|
|
||||||
</Show>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if isLoaded() && error() === null}
|
|
||||||
{#if simplifyEnabled()}
|
|
||||||
<InfoBox
|
|
||||||
className={"mx-auto w-fit pb-1 text-center text-lg"}
|
|
||||||
title={"Output:"}
|
|
||||||
id={"expression-output"}
|
|
||||||
>
|
|
||||||
<p>{fetchResult()?.after}</p>
|
|
||||||
</InfoBox>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class={"m-2 flex justify-center"}>
|
|
||||||
<div id={"table"} class={"h-[45rem] overflow-auto"}>
|
|
||||||
<TruthTable
|
|
||||||
header={fetchResult()?.header ?? undefined}
|
|
||||||
table={fetchResult()?.table?.truthMatrix}
|
|
||||||
id={tableId}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
@ -1,20 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import type { SimplifyTruthsOption } from "@/types/types.ts"
|
|
||||||
|
|
||||||
export let option: SimplifyTruthsOption
|
|
||||||
export let currentValue: () => SimplifyTruthsOption
|
|
||||||
export let onClick: () => void
|
|
||||||
|
|
||||||
const isSelected = () => option === currentValue()
|
|
||||||
|
|
||||||
// TODO bind on:click
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<button class={`flex-row-center cursor-pointer last:mb-1 hover:underline`} on:click={onClick}>
|
|
||||||
<Icon
|
|
||||||
path={check}
|
|
||||||
aria-label={isSelected() ? "A checkmark" : "Nothing"}
|
|
||||||
class={`text-white ${!isSelected() && "invisible"}`}
|
|
||||||
/>
|
|
||||||
{option.name}
|
|
||||||
</button>
|
|
@ -1,39 +0,0 @@
|
|||||||
---
|
|
||||||
import type { Table } from "@/types/types"
|
|
||||||
import type { ComponentProps } from "@/types/props"
|
|
||||||
|
|
||||||
interface Props extends ComponentProps {
|
|
||||||
table?: Table
|
|
||||||
header?: string[]
|
|
||||||
}
|
|
||||||
const { table, header, class: clazz, ...props } = Astro.props
|
|
||||||
---
|
|
||||||
|
|
||||||
<table class={`z-10 table border-collapse border-2 border-gray-500 ${clazz}`} {...props}>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
{header?.map(exp => (
|
|
||||||
<th
|
|
||||||
scope={"col"}
|
|
||||||
class={
|
|
||||||
`sticky top-0 bg-default-bg text-center outline
|
|
||||||
outline-2 outline-offset-[-1px] outline-gray-500 [position:-webkit-sticky;]` /*TODO sticky header at the top of the screen */
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<p class={"w-max px-2"}>{exp}</p>
|
|
||||||
</th>
|
|
||||||
))}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{table?.map(row => (
|
|
||||||
<tr class={"hover:text-black"}>
|
|
||||||
{row.map(value => (
|
|
||||||
<td class={`border border-gray-500 text-center last:underline ${value ? "bg-green-700" : "bg-red-700"}`}>
|
|
||||||
<p>{value ? "T" : "F"}</p>
|
|
||||||
</td>
|
|
||||||
))}
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
<div>TODO implement</div>
|
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
<div class={`border-rounded mb-2 flex flex-col gap-1 bg-cyan-900 p-2 dark:border-gray-800 ${Astro.props.className}`}>
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
import InfoBox from "./InfoBox.astro"
|
|
||||||
interface Props {
|
|
||||||
title: string
|
|
||||||
error: string
|
|
||||||
}
|
|
||||||
const { title, error } = Astro.props
|
|
||||||
---
|
|
||||||
|
|
||||||
<InfoBox class={"mx-auto w-fit text-center"} title={title} error={true}>
|
|
||||||
<p>{error}</p>
|
|
||||||
</InfoBox>
|
|
@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
import type { ComponentProps } from "@/types/props"
|
|
||||||
interface Props extends ComponentProps {
|
|
||||||
title: string
|
|
||||||
error?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
const { title, error = false, class: clazz, ...props } = Astro.props
|
|
||||||
---
|
|
||||||
|
|
||||||
<div class={`border-rounded ${error ? "border-red-500" : "border-gray-500"} ${clazz}`} {...props}>
|
|
||||||
<p class={`border-b px-2 ${error ? "border-red-500" : "border-gray-500"}`}>{title}</p>
|
|
||||||
<div class="mx-2">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,11 +0,0 @@
|
|||||||
export const DOMAIN = "martials.no"
|
|
||||||
export const LINKED_IN_URL = "https://www.linkedin.com/in/martin-b-2a69391a3"
|
|
||||||
export const GIT_BASE_URL = `https://git.${DOMAIN}`
|
|
||||||
export const GIT_PROFILE_URL = `${GIT_BASE_URL}/martials`
|
|
||||||
export const GITHUB_PROFILE_URL = "https://github.com/emberal"
|
|
||||||
export const MASTODON_URL = "https://snabelen.no/@Martials"
|
|
||||||
export const PIXELFED_URL = "https://pixelfed.social/i/web/profile/261454857934868480"
|
|
||||||
export const STEAM_URL = "https://steamcommunity.com/id/martials/"
|
|
||||||
export const THIS_GIT_URL = `${GIT_BASE_URL}/martials/martials.no`
|
|
||||||
export const TRAKT_URL = "https://trakt.tv/users/martials"
|
|
||||||
export const STATUS_URL = `https://status.${DOMAIN}/status/home`
|
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
import ContactMePage from "@/components/contactMe/ContactMePage.astro"
|
import ContactMeForm from "@/components/ContactMeForm.astro"
|
||||||
import Layout from "@/layouts/Layout.astro"
|
import Layout from "@/layouts/Layout.astro"
|
||||||
import "@/styles/global.css"
|
import "@/styles/global.css"
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Kontakt meg">
|
<Layout title="Kontakt meg">
|
||||||
<ContactMePage />
|
<ContactMeForm />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
import ContactMePage from "@/components/contactMe/ContactMePage.astro"
|
import ContactMeForm from "@/components/ContactMeForm.astro"
|
||||||
import Layout from "@/layouts/Layout.astro"
|
import Layout from "@/layouts/Layout.astro"
|
||||||
import "@/styles/global.css"
|
import "@/styles/global.css"
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Kontakt meg">
|
<Layout title="Kontakt meg">
|
||||||
<ContactMePage />
|
<ContactMeForm />
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
import Layout from "@/layouts/Layout.astro"
|
|
||||||
import SimplifyTruthsPage from "@/components/simplifyTruths/SimplifyTruthsPage.astro"
|
|
||||||
---
|
|
||||||
|
|
||||||
<Layout title="Simplify truths">
|
|
||||||
<SimplifyTruthsPage />
|
|
||||||
</Layout>
|
|
@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
import Layout from "@/layouts/Layout.astro"
|
|
||||||
import SimplifyTruthsPage from "@/components/simplifyTruths/SimplifyTruthsPage.astro"
|
|
||||||
---
|
|
||||||
|
|
||||||
<Layout title="Forenkle sannhetsverdier">
|
|
||||||
<SimplifyTruthsPage />
|
|
||||||
</Layout>
|
|
@ -1,8 +1,6 @@
|
|||||||
export interface ComponentProps {
|
export interface ComponentProps {
|
||||||
class?: string;
|
class?: string;
|
||||||
style?: string;
|
|
||||||
title?: string;
|
title?: string;
|
||||||
id?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LinkProps extends ComponentProps {
|
export interface LinkProps extends ComponentProps {
|
||||||
|
@ -3,40 +3,3 @@ import type { CollectionEntry } from "astro:content"
|
|||||||
export type AbsolutePathname = `/${string}`
|
export type AbsolutePathname = `/${string}`
|
||||||
|
|
||||||
export type Project = CollectionEntry<"projects">
|
export type Project = CollectionEntry<"projects">
|
||||||
|
|
||||||
export type Operator = "AND" | "OR" | "NOT" | "IMPLICATION"
|
|
||||||
|
|
||||||
export type Table = boolean[][]
|
|
||||||
|
|
||||||
export type OrderOfOperation = {
|
|
||||||
before: string
|
|
||||||
after: string
|
|
||||||
law: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Expression = {
|
|
||||||
leading: string
|
|
||||||
left: Expression | null
|
|
||||||
operator: Operator | null
|
|
||||||
right: Expression | null
|
|
||||||
trailing: string
|
|
||||||
atomic: string | null
|
|
||||||
}
|
|
||||||
|
|
||||||
export type FetchResult = {
|
|
||||||
status: string
|
|
||||||
version: string | null
|
|
||||||
before: string
|
|
||||||
after: string
|
|
||||||
orderOperations: OrderOfOperation[] | null
|
|
||||||
expression: Expression | null
|
|
||||||
header: string[] | null
|
|
||||||
table: {
|
|
||||||
truthMatrix: Table
|
|
||||||
} | null
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SimplifyTruthsOption = {
|
|
||||||
name: string
|
|
||||||
value: "NONE" | "TRUE" | "FALSE" | "DEFAULT" | "TRUE_FIRST" | "FALSE_FIRST"
|
|
||||||
}
|
|
||||||
|
@ -58,9 +58,8 @@ export function localizePathname(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function resolvePathname(pathname: string): AbsolutePathname {
|
export function resolvePathname(pathname: string): AbsolutePathname {
|
||||||
const enPattern = "/en"
|
if (pathname.startsWith("/en")) {
|
||||||
if (pathname.startsWith(enPattern)) {
|
return pathname.slice(3) as AbsolutePathname
|
||||||
return pathname.slice(enPattern.length) as AbsolutePathname
|
|
||||||
}
|
}
|
||||||
return pathname as AbsolutePathname
|
return pathname as AbsolutePathname
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user