Skip to content

Commit bcc5c19

Browse files
committed
Add Web Ring
- Added webring support. - Updated the terminal command to reflect the new feature. - Minor UI updates. - Minor bug fixes.
1 parent e1a5e9a commit bcc5c19

File tree

10 files changed

+678
-451
lines changed

10 files changed

+678
-451
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
"lint": "prettier --check ."
1313
},
1414
"devDependencies": {
15-
"@iconify/json": "^2.2.323",
15+
"@iconify/json": "^2.2.357",
1616
"@sveltejs/adapter-static": "^3.0.8",
17-
"@sveltejs/kit": "^2.20.6",
17+
"@sveltejs/kit": "^2.22.5",
1818
"@sveltejs/vite-plugin-svelte": "^4.0.4",
19-
"@tailwindcss/postcss": "^4.1.2",
20-
"@tailwindcss/vite": "^4.1.2",
21-
"postcss": "^8.5.3",
22-
"prettier": "^3.5.3",
23-
"prettier-plugin-svelte": "^3.3.3",
24-
"prettier-plugin-tailwindcss": "^0.6.11",
25-
"svelte": "^5.25.6",
26-
"svelte-check": "^4.1.5",
27-
"tailwindcss": "^4.1.2",
19+
"@tailwindcss/postcss": "^4.1.11",
20+
"@tailwindcss/vite": "^4.1.11",
21+
"postcss": "^8.5.6",
22+
"prettier": "^3.6.2",
23+
"prettier-plugin-svelte": "^3.4.0",
24+
"prettier-plugin-tailwindcss": "^0.6.14",
25+
"svelte": "^5.35.6",
26+
"svelte-check": "^4.2.2",
27+
"tailwindcss": "^4.1.11",
2828
"tslib": "^2.8.1",
29-
"typescript": "^5.8.2",
29+
"typescript": "^5.8.3",
3030
"unplugin-icons": "^22.1.0",
3131
"vite": "^5.4.19"
3232
},

pnpm-lock.yaml

Lines changed: 467 additions & 390 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
font-weight: 100 800;
88
src: url(@fontsource-variable/jetbrains-mono/files/jetbrains-mono-latin-wght-normal.woff2)
99
format("woff2-variations");
10-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
11-
U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
12-
U+FFFD;
10+
unicode-range:
11+
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
12+
U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
1313
}
1414

1515
body {

src/lib/components/Button.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
this={href ? "a" : "button"}
3838
role={href ? "link" : "button"}
3939
tabindex="0"
40-
class="z-50 flex items-center justify-center gap-2 rounded-lg bg-slate-800 {sizeClass} {className} transition-all duration-200 hover:brightness-90"
40+
class="z-50 flex cursor-pointer items-center justify-center gap-2 rounded-lg bg-slate-800 {sizeClass} {className} transition-all duration-200 hover:brightness-90"
4141
{onclick}
4242
{href}
4343
data-sveltekit-preload-data="hover"

src/lib/components/InlineLink.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
children?: Snippet;
99
}
1010
11-
let { class: className = "", href, icon = null, children }: Props = $props();
11+
let { class: className = "", href, icon, children }: Props = $props();
1212
</script>
1313

1414
<a

src/lib/components/Ring.svelte

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<script lang="ts">
2+
import { page } from "$app/state";
3+
import { getRing, type Ring } from "$lib/data/ring";
4+
import { onMount } from "svelte";
5+
import SolarArrowLeftLinear from "~icons/solar/arrow-left-linear";
6+
import SolarArrowRightLinear from "~icons/solar/arrow-right-linear";
7+
import SolarLinkCircleOutline from "~icons/solar/link-circle-outline";
8+
import SolarMagicStickOutline from "~icons/solar/magic-stick-outline";
9+
10+
let ring: Ring | null = null;
11+
onMount(() => {
12+
ring = getRing(page.url.host);
13+
});
14+
</script>
15+
16+
<div
17+
class="group flex w-full flex-col gap-2 rounded-lg bg-slate-900 p-4 transition-all duration-300"
18+
>
19+
<!-- Header -->
20+
<p class="text-center text-sm font-medium">{ring?.name}</p>
21+
22+
<!-- Navigation Links -->
23+
<div
24+
class="flex items-center justify-center gap-1 *:flex *:items-center *:gap-1 *:rounded-lg *:px-3 *:py-1.5 *:text-xs *:font-medium *:text-slate-400 *:transition-all *:duration-200 *:hover:bg-slate-800 *:hover:text-slate-100"
25+
>
26+
<a href="{ring?.base}/{ring?.previous}" target="_blank" title="Previous site">
27+
<SolarArrowLeftLinear class="size-3" />
28+
<span>Prev</span>
29+
</a>
30+
31+
<a href={ring?.base} target="_blank" title="Visit {ring?.name}">
32+
<SolarLinkCircleOutline class="size-3" />
33+
<span>Ring</span>
34+
</a>
35+
36+
<a href="{ring?.base}/{ring?.next}" target="_blank" title="Next site">
37+
<span>Next</span>
38+
<SolarArrowRightLinear class="size-3" />
39+
</a>
40+
41+
<a href="{ring?.base}/{ring?.random}" target="_blank" title="Random site">
42+
<SolarMagicStickOutline class="size-3" />
43+
<span>Random</span>
44+
</a>
45+
</div>
46+
</div>

src/lib/components/Terminal.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import { cmds, output, setDefaultModeSetter } from "$lib/terminal/cmds";
33
import { showCommandHelp } from "$lib/terminal/help";
44
import { handleKeys, setInput } from "$lib/terminal/keys";
5-
import { onMount, type SvelteComponent } from "svelte";
6-
import type { SvelteHTMLElements } from "svelte/elements";
5+
import type { Component } from "svelte";
6+
import { onMount } from "svelte";
77
import { fade } from "svelte/transition";
88
import MaterialSymbolsArrowForwardIosRounded from "~icons/material-symbols/arrow-forward-ios-rounded";
99
import MaterialSymbolsChromeRestoreOutlineRounded from "~icons/material-symbols/chrome-restore-outline-rounded";
@@ -69,20 +69,20 @@
6969
};
7070
});
7171
72-
const windowIcons: [typeof SvelteComponent<SvelteHTMLElements["svg"]>, string][] = [
72+
const windowIcons: [Component, string][] = [
7373
[MaterialSymbolsHorizontalRuleRounded, "mt-1.5"],
7474
[MaterialSymbolsChromeRestoreOutlineRounded, "rotate-180"],
7575
[MaterialSymbolsCloseRounded, ""]
7676
];
7777
</script>
7878

7979
<div in:fade class="flex h-screen flex-col overflow-hidden">
80-
<div class="sticky top-0 flex items-center py-5">
80+
<div class="flex items-center py-5">
8181
<div class="text-md flex-1 text-center text-slate-400">Terminal</div>
82-
<div class="fixed right-0 flex gap-2 p-2 text-slate-200">
82+
<div class="fixed right-0 flex gap-2 p-2 text-slate-100">
8383
{#each windowIcons as [Icon, cls]}
8484
<button
85-
class="flex size-6 cursor-default items-center justify-center overflow-hidden rounded-full bg-slate-800 p-1 transition-all duration-200 group-hover:scale-110 hover:bg-slate-800/80"
85+
class="flex size-6 cursor-default items-center justify-center overflow-hidden rounded-full bg-slate-800 p-1 transition-all duration-200 hover:bg-slate-800/80"
8686
onclick={() => (defaultMode = true)}
8787
>
8888
<Icon class={cls} />

src/lib/data/ring.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export interface Ring {
2+
name: string;
3+
base: string;
4+
previous: string;
5+
next: string;
6+
random: string;
7+
}
8+
9+
export const getRing = (host: string): Ring => {
10+
return {
11+
name: "Yellow Brick Ring",
12+
base: "https://yellowbrickring.com",
13+
previous: `webring?from=${host}&to=prev`,
14+
next: `webring?from=${host}&to=next`,
15+
random: `webring?from=${host}&to=random`
16+
};
17+
};

src/lib/terminal/cmds.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import projects from "$lib/data/projects";
2+
import { getRing } from "$lib/data/ring";
23
import socials from "$lib/data/socials";
34
import { showHelp } from "$lib/terminal/help";
45
import { writable, type Writable } from "svelte/store";
@@ -20,6 +21,8 @@ interface Cmds {
2021
};
2122
}
2223

24+
const ring = getRing(window.location.host);
25+
2326
export const cmds: Cmds = {
2427
help: {
2528
help: "List all available commands",
@@ -162,6 +165,76 @@ export const cmds: Cmds = {
162165
}
163166
]
164167
},
168+
ring: {
169+
help: "View the ring",
170+
func: (args, input) => {
171+
output.update((prev) => [
172+
...prev,
173+
{
174+
inp: input,
175+
res: `You're viewing the ${makeHyperlink(ring.name, ring.base)}. Use the options to navigate.`
176+
}
177+
]);
178+
},
179+
opts: [
180+
{
181+
opts: ["-o", "--open"],
182+
help: "Opens the ring",
183+
func: (args, input) => {
184+
output.update((prev) => [
185+
...prev,
186+
{
187+
inp: input,
188+
res: `Opening ${makeHyperlink(ring.name, ring.base)}...`
189+
}
190+
]);
191+
window.open(ring.base, "_blank");
192+
}
193+
},
194+
{
195+
opts: ["-n", "--next"],
196+
help: "Go to the next ring",
197+
func: (args, input) => {
198+
output.update((prev) => [
199+
...prev,
200+
{
201+
inp: input,
202+
res: `Opening the next ring...`
203+
}
204+
]);
205+
window.open(`${ring.base}/${ring.next}`, "_blank");
206+
}
207+
},
208+
{
209+
opts: ["-p", "--previous"],
210+
help: "Go to the previous ring",
211+
func: (args, input) => {
212+
output.update((prev) => [
213+
...prev,
214+
{
215+
inp: input,
216+
res: `Opening the previous ring...`
217+
}
218+
]);
219+
window.open(`${ring.base}/${ring.previous}`, "_blank");
220+
}
221+
},
222+
{
223+
opts: ["-r", "--random"],
224+
help: "Go to a random ring",
225+
func: (args, input) => {
226+
output.update((prev) => [
227+
...prev,
228+
{
229+
inp: input,
230+
res: `Opening a random ring...`
231+
}
232+
]);
233+
window.open(`${ring.base}/${ring.random}`, "_blank");
234+
}
235+
}
236+
]
237+
},
165238
echo: {
166239
help: "Prints the given text",
167240
func: (args, input) => {

0 commit comments

Comments
 (0)