jormungandr-patches/patches/newmfm/0003-Unix-Time-MFM.patch
2024-07-14 20:32:39 -06:00

48 lines
1.8 KiB
Diff

From 846baf305be2d4547b91e6cfd6db5c64bc6ce793 Mon Sep 17 00:00:00 2001
From: limepotato <limepot@protonmail.ch>
Date: Sun, 14 Jul 2024 06:09:33 -0600
Subject: [PATCH 3/5] Unix Time MFM
---
packages/client/src/components/mfm.ts | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/packages/client/src/components/mfm.ts b/packages/client/src/components/mfm.ts
index 2beee156c..382b1b9e7 100644
--- a/packages/client/src/components/mfm.ts
+++ b/packages/client/src/components/mfm.ts
@@ -2,6 +2,7 @@ import { defineComponent, h } from "vue";
import * as mfm from "@transfem-org/sfm-js";
import type { VNode } from "vue";
import MkUrl from "@/components/global/MkUrl.vue";
+import MkTime from '@/components/global/MkTime.vue';
import MkLink from "@/components/MkLink.vue";
import MkMention from "@/components/MkMention.vue";
import MkEmoji from "@/components/global/MkEmoji.vue";
@@ -331,6 +332,23 @@ export default defineComponent({
return h('ruby', {}, [...genEl(token.children.slice(0, token.children.length - 1), scale), h('rt', text.trim())]);
}
}
+ case 'unixtime': {
+ const child = token.children[0];
+ const unixtime = parseInt(child.type === 'text' ? child.props.text : '');
+ return h('span', {
+ style: 'display: inline-block; font-size: 90%; border: solid 1px var(--divider); border-radius: var(--radius-ellipse); padding: 4px 10px 4px 6px;',
+ }, [
+ h('i', {
+ class: 'ph-clock ph-bold ph-lg',
+ style: 'margin-right: 0.25em;',
+ }),
+ h(MkTime, {
+ key: Math.random(),
+ time: unixtime * 1000,
+ mode: 'detail',
+ }),
+ ]);
+ }
case "small": {
return h(
"small",
--
2.45.2