zenno: format & lint fixes

This commit is contained in:
2026-05-24 18:06:51 -04:00
parent 0f14ece4da
commit bae79a5320
6 changed files with 433 additions and 326 deletions
+19 -18
View File
@@ -1,27 +1,28 @@
<script lang="ts">
import { skills, ZERO_SKILL, type Skill } from "./data/skill";
import { skills, ZERO_SKILL, type Skill } from './data/skill';
interface CommonProps {
hint?: string;
mention?: boolean;
}
interface CommonProps {
hint?: string;
mention?: boolean;
}
type Props = CommonProps & ({skill: number, name?: never} | {name: string, skill?: never});
type Props = CommonProps & ({ skill: number; name?: never } | { name: string; skill?: never });
let {hint, mention, skill, name}: Props = $props();
let { hint, mention, skill, name }: Props = $props();
const s: Readonly<Skill> = $derived.by(() => {
const l = skill != null ? skills.global.filter((s) => s.skill_id === skill) : skills.global.filter((s) => s.name.includes(name!));
if (name != null) {
console.warn(`skills specified as ${name} (${hint}):`, l);
}
if (l.length === 0) {
return ZERO_SKILL;
}
return l[0];
});
const s: Readonly<Skill> = $derived.by(() => {
const l =
skill != null ? skills.global.filter((s) => s.skill_id === skill) : skills.global.filter((s) => s.name.includes(name!));
if (name != null) {
console.warn(`skills specified as ${name} (${hint}):`, l);
}
if (l.length === 0) {
return ZERO_SKILL;
}
return l[0];
});
const spanClass = $derived(mention ? 'italic' : 'font-bold')
const spanClass = $derived(mention ? 'italic' : 'font-bold');
</script>
<span class={spanClass}>{s.name}</span>