Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/app/(home)/_components/about-contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export function AboutContact() {
. Written in Rust and released under the MIT and Apache-2.0 licenses.
</p>
<div className="mt-3 flex flex-wrap gap-x-5 gap-y-2">
<a href={links.github} className="km-text-link">
<a href={links.github} className="km-text-link km-text-link-target">
Source code →
</a>
<Link href="/projects" className="km-text-link">
<Link href="/projects" className="km-text-link km-text-link-target">
Related projects →
</Link>
</div>
Expand All @@ -42,7 +42,7 @@ export function AboutContact() {
href={links.linkedin}
target="_blank"
rel="noopener noreferrer"
className="km-text-link"
className="km-text-link km-text-link-target"
>
LinkedIn
<span className="sr-only"> (opens in a new tab)</span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/(home)/_components/benchmark-results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function BenchmarkResults() {
</h2>
<Link
href="/docs/memory-benchmark"
className="km-text-link inline-flex min-h-[24px] items-center"
className="km-text-link km-text-link-target"
>
All results and methodology →
</Link>
Expand Down
19 changes: 14 additions & 5 deletions src/app/(home)/_components/network-section.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import Link from "next/link";
import type { ReactNode } from "react";
import { NetworkDiagram } from "./network-diagram";

const FLOW = [
const FLOW: readonly {
title: string;
command: string;
detail: ReactNode;
}[] = [
{
title: "Invite",
command: "kimetsu network invite --name laptop",
detail:
"A creates the invite. The code starts with knet1. The default name is friends. Nothing is listening yet.",
detail: (
<>
A creates the invite. The code starts with <code>knet1.</code> The
default name is friends. Nothing is listening yet.
</>
),
},
{
title: "Join",
Expand All @@ -19,7 +28,7 @@ const FLOW = [
detail:
"A runs share while B runs kimetsu network request. If discovery misses A, pass the peer: line share printed.",
},
] as const;
];

export function NetworkSection() {
return (
Expand All @@ -45,7 +54,7 @@ export function NetworkSection() {
<div className="flex flex-wrap gap-3 lg:justify-end">
<Link
href="/docs/network"
className="km-text-link inline-flex min-h-[24px] items-center"
className="km-text-link km-text-link-target"
>
Read the Network guide
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/app/(home)/_components/quick-start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function QuickStart() {
</p>
<Link
href="/docs/install"
className="km-text-link mt-4 inline-flex min-h-[24px] items-center"
className="km-text-link km-text-link-target mt-4"
>
All installation options →
</Link>
Expand Down
22 changes: 5 additions & 17 deletions src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,22 @@ export default function HomePage() {
Kimetsu
</p>
<nav aria-label="Footer" className="flex flex-wrap gap-5">
<a
href="#about"
className="km-text-link inline-flex min-h-[24px] items-center"
>
<a href="#about" className="km-text-link km-text-link-target">
About
</a>
<a
href="#contact"
className="km-text-link inline-flex min-h-[24px] items-center"
>
<a href="#contact" className="km-text-link km-text-link-target">
Contact
</a>
<a
href={links.github}
className="km-text-link inline-flex min-h-[24px] items-center"
>
<a href={links.github} className="km-text-link km-text-link-target">
GitHub
</a>
<Link
href="/docs/changelog"
className="km-text-link inline-flex min-h-[24px] items-center"
className="km-text-link km-text-link-target"
>
Changelog
</Link>
<a
href="/llms.txt"
className="km-text-link inline-flex min-h-[24px] items-center"
>
<a href="/llms.txt" className="km-text-link km-text-link-target">
For agents
</a>
</nav>
Expand Down
7 changes: 7 additions & 0 deletions src/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ html {
text-underline-offset: 4px;
}

/* 24px target for standalone text links. Kept off .km-text-link so prose links stay inline. */
.km-text-link-target {
display: inline-flex;
min-height: 24px;
align-items: center;
}

.km-text-link:hover {
text-decoration: underline;
}
Expand Down
27 changes: 27 additions & 0 deletions tests/homepage-network.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,33 @@ test("documents the network result tables and links them from the index", () =>
assert.match(results, /RTX 5060 Ti 16 GB/);
});

test("keeps the invite prefix dot inside a code token", () => {
const invite = section
.match(/A creates the invite\.[\s\S]*?Nothing is listening yet\./)?.[0]
.replace(/\s+/g, " ");
assert.equal(
invite,
"A creates the invite. The code starts with <code>knet1.</code> The default name is friends. Nothing is listening yet.",
);
assert.equal(
section.includes("On B, membership is saved. Nothing is listening."),
true,
);
assert.equal(
section.includes(
"A runs share while B runs kimetsu network request. If discovery misses A, pass the peer: line share printed.",
),
true,
);
for (const command of [
'command: "kimetsu network invite --name laptop"',
'command: "kimetsu network join <code>"',
'command: "kimetsu network share"',
]) {
assert.equal(section.includes(command), true, command);
}
});

test("does not repeat install commands in the network section", () => {
for (const command of [
"kimetsu plugin install grok-bot",
Expand Down
85 changes: 85 additions & 0 deletions tests/text-link-target.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";

const css = await readFile(
new URL("../src/app/global.css", import.meta.url),
"utf8",
);

const sources = {
benchmarks: await readFile(
new URL(
"../src/app/(home)/_components/benchmark-results.tsx",
import.meta.url,
),
"utf8",
),
network: await readFile(
new URL(
"../src/app/(home)/_components/network-section.tsx",
import.meta.url,
),
"utf8",
),
quickStart: await readFile(
new URL("../src/app/(home)/_components/quick-start.tsx", import.meta.url),
"utf8",
),
page: await readFile(
new URL("../src/app/(home)/page.tsx", import.meta.url),
"utf8",
),
about: await readFile(
new URL("../src/app/(home)/_components/about-contact.tsx", import.meta.url),
"utf8",
),
};

const repeatedTarget = "inline-flex min-h-[24px] items-center";

test("defines one tap-target utility beside km-text-link", () => {
const linkStart = css.indexOf(".km-text-link {");
const linkRule = css.slice(linkStart, css.indexOf("}", linkStart) + 1);
assert.equal(linkRule.includes("inline-flex"), false);
assert.equal(linkRule.includes("min-height"), false);
assert.match(
css,
/\.km-text-link-target\s*\{[^}]*display:\s*inline-flex;[^}]*min-height:\s*24px;[^}]*align-items:\s*center;[^}]*\}/s,
);
});

test("replaces the repeated min-height class string with the utility", () => {
for (const [name, source] of Object.entries(sources)) {
assert.equal(source.includes(repeatedTarget), false, name);
}
assert.equal(sources.benchmarks.match(/km-text-link-target/g)?.length, 1);
assert.equal(sources.network.match(/km-text-link-target/g)?.length, 1);
assert.equal(sources.quickStart.match(/km-text-link-target/g)?.length, 1);
assert.equal(sources.page.match(/km-text-link-target/g)?.length, 5);
assert.match(
sources.quickStart,
/className="km-text-link km-text-link-target mt-4"/,
);
assert.match(
sources.benchmarks,
/href="\/docs\/network\/results" className="km-text-link"/,
);
assert.equal(sources.benchmarks.includes("km-text-link mt-auto pt-6"), true);
});

test("gives the about and contact links the same 24px target", () => {
assert.match(
sources.about,
/href=\{links\.github\}[^>]*className="km-text-link km-text-link-target"[^>]*>\s*Source code →/,
);
assert.match(
sources.about,
/href="\/projects"[^>]*className="km-text-link km-text-link-target"[^>]*>\s*Related projects →/,
);
assert.match(
sources.about,
/href=\{links\.linkedin\}[\s\S]*?className="km-text-link km-text-link-target"[\s\S]*?LinkedIn/,
);
assert.equal(sources.about.match(/km-text-link-target/g)?.length, 3);
});
Loading