refactor: drop svelte-time, drop rehype plugins
This commit is contained in:
parent
4dd08def5c
commit
e402a54f9c
@ -46,11 +46,8 @@
|
||||
"@types/node-schedule": "^2.1.7",
|
||||
"nanoid": "^5.1.0",
|
||||
"node-schedule": "^2.1.1",
|
||||
"rehype-autolink-headings": "^7.1.0",
|
||||
"rehype-slug": "^6.0.0",
|
||||
"robots-parser": "^3.0.1",
|
||||
"steamgriddb": "^2.2.0",
|
||||
"svelte-time": "^2.0.0"
|
||||
"steamgriddb": "^2.2.0"
|
||||
},
|
||||
"trustedDependencies": [
|
||||
"@sveltejs/kit",
|
||||
|
@ -3,7 +3,6 @@
|
||||
import Note from '../components/note.svelte';
|
||||
import Window from '../components/window.svelte';
|
||||
import LatestStuff from './lateststuff.md';
|
||||
import Time from "svelte-time";
|
||||
|
||||
interface Props {
|
||||
data: any;
|
||||
@ -20,6 +19,21 @@
|
||||
minute: "2-digit",
|
||||
})
|
||||
}
|
||||
const renderRelativeDate = (timestamp: number) => {
|
||||
const elapsed = timestamp - (new Date()).getTime()
|
||||
const units: Record<string, number> = {
|
||||
year : 24 * 60 * 60 * 1000 * 365,
|
||||
month : 24 * 60 * 60 * 1000 * 365/12,
|
||||
day : 24 * 60 * 60 * 1000,
|
||||
hour : 60 * 60 * 1000,
|
||||
minute: 60 * 1000,
|
||||
second: 1000
|
||||
}
|
||||
const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' })
|
||||
for (var unit in units)
|
||||
if (Math.abs(elapsed) > units[unit] || unit == 'second')
|
||||
return rtf.format(Math.round(elapsed / units[unit]), unit as Intl.RelativeTimeFormatUnit)
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col md:flex-row gap-y-2 lg:gap-y-0 md:h-full h-card">
|
||||
@ -157,9 +171,10 @@
|
||||
<p
|
||||
class="prose prose-ralsei p-1 border-4 text-sm bg-ralsei-black"
|
||||
style="border-style: double double none double;"
|
||||
title={renderDate(data.lastNote.published)}
|
||||
>
|
||||
<a href="/entries">last log was…</a>
|
||||
published <Time relative format="dddd @ h:mm A · MMMM D, YYYY" timestamp={data.lastNote.published}/>!
|
||||
published {renderRelativeDate(data.lastNote.published)}!
|
||||
</p>
|
||||
<div class="mt-0 p-1.5 border-4 border-double bg-ralsei-black min-w-full max-w-[40ch]">
|
||||
<Note note={data.lastNote} onlyContent/>
|
||||
|
@ -2,8 +2,6 @@ import adapter from 'svelte-adapter-bun';
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
|
||||
import { mdsvex } from 'mdsvex'
|
||||
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
|
||||
import rehypeSlug from 'rehype-slug'
|
||||
|
||||
import * as toml from "@std/toml";
|
||||
|
||||
@ -33,10 +31,6 @@ const config = {
|
||||
}
|
||||
},
|
||||
},
|
||||
rehypePlugins: [
|
||||
rehypeSlug,
|
||||
rehypeAutolinkHeadings,
|
||||
],
|
||||
smartypants: {
|
||||
dashes: 'oldschool',
|
||||
quotes: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user