From f89a827aa9c848da613120c31434414f713ef524 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 13:26:48 +0900 Subject: [PATCH 1/4] Update packages/frontend/src/pages/role.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Acid Chicken (硫酸鶏) --- packages/frontend/src/pages/role.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/pages/role.vue b/packages/frontend/src/pages/role.vue index c968850444..5001dd735f 100644 --- a/packages/frontend/src/pages/role.vue +++ b/packages/frontend/src/pages/role.vue @@ -55,7 +55,7 @@ const props = withDefaults(defineProps<{ let tab = $ref(props.initialTab); let role = $ref(); let error = $ref(); -let visiable = $ref(false); +let visible = $ref(false); watch(() => props.role, () => { os.api('roles/show', { From cbab3affc9310310c6d93860fe529bb38fece6a4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 13:26:55 +0900 Subject: [PATCH 2/4] Update packages/frontend/src/pages/role.vue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Acid Chicken (硫酸鶏) --- packages/frontend/src/pages/role.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/pages/role.vue b/packages/frontend/src/pages/role.vue index 5001dd735f..4794e33ed0 100644 --- a/packages/frontend/src/pages/role.vue +++ b/packages/frontend/src/pages/role.vue @@ -63,7 +63,7 @@ watch(() => props.role, () => { }).then(res => { role = res; document.title = `${role?.name} | ${instanceName}`; - visiable = res.isExplorable && res.isPublic; + visible = res.isExplorable && res.isPublic; }).catch((err) => { if (err.code === 'NO_SUCH_ROLE') { error = i18n.ts.noRole; From 4d1a2bad17b138283b048b22b81ed597ac497f0b Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 13:27:33 +0900 Subject: [PATCH 3/4] typo --- packages/frontend/src/pages/role.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/pages/role.vue b/packages/frontend/src/pages/role.vue index 4794e33ed0..1e3db42758 100644 --- a/packages/frontend/src/pages/role.vue +++ b/packages/frontend/src/pages/role.vue @@ -18,16 +18,16 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ role.description }}
- -
+ +
{{ i18n.ts.nothing }}
- -
+ +
{{ i18n.ts.nothing }}
From a9a743dab98d6547cef7c9f5285a4615b6feb245 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 15:05:37 +0900 Subject: [PATCH 4/4] =?UTF-8?q?enhance(frontend):=20MFM=E3=81=A7UNIX?= =?UTF-8?q?=E6=99=82=E9=96=93=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=97=E3=81=A6?= =?UTF-8?q?=E6=97=A5=E6=99=82=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve #12294 --- CHANGELOG.md | 2 ++ locales/index.d.ts | 9 +++++++++ locales/ja-JP.yml | 9 +++++++++ .../components/global/MkMisskeyFlavoredMarkdown.ts | 14 ++++++++++++++ packages/frontend/src/components/global/MkTime.vue | 10 +++++++++- packages/frontend/src/const.ts | 2 +- 6 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 364199503e..c62c4c7a5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ ### Client - Enhance: MFMでルビを振れるように - 例: `$[ruby 三須木 みすき]` +- Enhance: MFMでUNIX時間を指定して日時を表示できるように + - 例: `$[unixtime 1701356400]` - Enhance: プラグインでエラーが発生した場合のハンドリングを強化 - Enhance: 細かなUIのブラッシュアップ - Fix: 効果音が再生されるとデバイスで再生している動画や音声が停止する問題を修正 #12339 diff --git a/locales/index.d.ts b/locales/index.d.ts index 968334e31b..6baed91c42 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1948,6 +1948,15 @@ export interface Locale { "yearsAgo": string; "invalid": string; }; + "_timeIn": { + "seconds": string; + "minutes": string; + "hours": string; + "days": string; + "weeks": string; + "months": string; + "years": string; + }; "_time": { "second": string; "minute": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 5b1d0d62bd..e59a550df5 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1853,6 +1853,15 @@ _ago: yearsAgo: "{n}年前" invalid: "ありません" +_timeIn: + seconds: "{n}秒後" + minutes: "{n}分後" + hours: "{n}時間後" + days: "{n}日後" + weeks: "{n}週間後" + months: "{n}ヶ月後" + years: "{n}年後" + _time: second: "秒" minute: "分" diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts index 163724a386..b10a12b504 100644 --- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts +++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts @@ -7,6 +7,7 @@ import { VNode, h } from 'vue'; import * as mfm from 'mfm-js'; import * as Misskey from 'misskey-js'; 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'; @@ -249,6 +250,19 @@ export default function(props: MfmProps) { 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: 999px; padding: 4px 10px 4px 6px;', + }, [ + h('i', { + class: 'ti ti-clock', + style: 'margin-right: 0.25em;', + }), + h(MkTime, { time: unixtime * 1000, mode: 'detail' }), + ]); + } } if (style == null) { return h('span', {}, ['$[', token.props.name, ' ', ...genEl(token.children, scale), ']']); diff --git a/packages/frontend/src/components/global/MkTime.vue b/packages/frontend/src/components/global/MkTime.vue index 5ba13ca3f3..61e65a8dcf 100644 --- a/packages/frontend/src/components/global/MkTime.vue +++ b/packages/frontend/src/components/global/MkTime.vue @@ -50,7 +50,15 @@ const relative = $computed(() => { ago >= 60 ? i18n.t('_ago.minutesAgo', { n: (~~(ago / 60)).toString() }) : ago >= 10 ? i18n.t('_ago.secondsAgo', { n: (~~(ago % 60)).toString() }) : ago >= -1 ? i18n.ts._ago.justNow : - i18n.ts._ago.future); + ago < -31536000 ? i18n.t('_timeIn.years', { n: Math.round(-ago / 31536000).toString() }) : + ago < -2592000 ? i18n.t('_timeIn.months', { n: Math.round(-ago / 2592000).toString() }) : + ago < -604800 ? i18n.t('_timeIn.weeks', { n: Math.round(-ago / 604800).toString() }) : + ago < -86400 ? i18n.t('_timeIn.days', { n: Math.round(-ago / 86400).toString() }) : + ago < -3600 ? i18n.t('_timeIn.hours', { n: Math.round(-ago / 3600).toString() }) : + ago < -60 ? i18n.t('_timeIn.minutes', { n: (~~(-ago / 60)).toString() }) : + ago < -10 ? i18n.t('_timeIn.seconds', { n: (~~(-ago % 60)).toString() }) : + '?' + ); }); let tickId: number; diff --git a/packages/frontend/src/const.ts b/packages/frontend/src/const.ts index 002c198b4d..397f804822 100644 --- a/packages/frontend/src/const.ts +++ b/packages/frontend/src/const.ts @@ -93,4 +93,4 @@ export const DEFAULT_SERVER_ERROR_IMAGE_URL = 'https://xn--931a.moe/assets/error export const DEFAULT_NOT_FOUND_IMAGE_URL = 'https://xn--931a.moe/assets/not-found.jpg'; export const DEFAULT_INFO_IMAGE_URL = 'https://xn--931a.moe/assets/info.jpg'; -export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'scale', 'position', 'fg', 'bg', 'font', 'blur', 'rainbow', 'sparkle', 'rotate', 'ruby']; +export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'scale', 'position', 'fg', 'bg', 'font', 'blur', 'rainbow', 'sparkle', 'rotate', 'ruby', 'unixtime'];