data endpoint for entity 90008 (aka. a website)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: drop svelte-time, drop rehype plugins

dusk e402a54f 4dd08def

+18 -12
bun.lockb

This is a binary file and will not be displayed.

+1 -4
package.json
··· 46 46 "@types/node-schedule": "^2.1.7", 47 47 "nanoid": "^5.1.0", 48 48 "node-schedule": "^2.1.1", 49 - "rehype-autolink-headings": "^7.1.0", 50 - "rehype-slug": "^6.0.0", 51 49 "robots-parser": "^3.0.1", 52 - "steamgriddb": "^2.2.0", 53 - "svelte-time": "^2.0.0" 50 + "steamgriddb": "^2.2.0" 54 51 }, 55 52 "trustedDependencies": [ 56 53 "@sveltejs/kit",
+17 -2
src/routes/+page.svelte
··· 3 3 import Note from '../components/note.svelte'; 4 4 import Window from '../components/window.svelte'; 5 5 import LatestStuff from './lateststuff.md'; 6 - import Time from "svelte-time"; 7 6 8 7 interface Props { 9 8 data: any; ··· 20 19 minute: "2-digit", 21 20 }) 22 21 } 22 + const renderRelativeDate = (timestamp: number) => { 23 + const elapsed = timestamp - (new Date()).getTime() 24 + const units: Record<string, number> = { 25 + year : 24 * 60 * 60 * 1000 * 365, 26 + month : 24 * 60 * 60 * 1000 * 365/12, 27 + day : 24 * 60 * 60 * 1000, 28 + hour : 60 * 60 * 1000, 29 + minute: 60 * 1000, 30 + second: 1000 31 + } 32 + const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' }) 33 + for (var unit in units) 34 + if (Math.abs(elapsed) > units[unit] || unit == 'second') 35 + return rtf.format(Math.round(elapsed / units[unit]), unit as Intl.RelativeTimeFormatUnit) 36 + } 23 37 </script> 24 38 25 39 <div class="flex flex-col md:flex-row gap-y-2 lg:gap-y-0 md:h-full h-card"> ··· 157 171 <p 158 172 class="prose prose-ralsei p-1 border-4 text-sm bg-ralsei-black" 159 173 style="border-style: double double none double;" 174 + title={renderDate(data.lastNote.published)} 160 175 > 161 176 <a href="/entries">last log was…</a> 162 - published <Time relative format="dddd @ h:mm A · MMMM D, YYYY" timestamp={data.lastNote.published}/>! 177 + published {renderRelativeDate(data.lastNote.published)}! 163 178 </p> 164 179 <div class="mt-0 p-1.5 border-4 border-double bg-ralsei-black min-w-full max-w-[40ch]"> 165 180 <Note note={data.lastNote} onlyContent/>
-6
svelte.config.js
··· 2 2 import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; 3 3 4 4 import { mdsvex } from 'mdsvex' 5 - import rehypeAutolinkHeadings from 'rehype-autolink-headings' 6 - import rehypeSlug from 'rehype-slug' 7 5 8 6 import * as toml from "@std/toml"; 9 7 ··· 33 31 } 34 32 }, 35 33 }, 36 - rehypePlugins: [ 37 - rehypeSlug, 38 - rehypeAutolinkHeadings, 39 - ], 40 34 smartypants: { 41 35 dashes: 'oldschool', 42 36 quotes: true,