diff --git a/locales/index.d.ts b/locales/index.d.ts index ddbb9e3335..7ae60a77c4 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5557,6 +5557,14 @@ export interface Locale extends ILocale { * 投稿を予約 */ "schedulePost": string; + /** + * {x}に投稿を予約します + */ + "scheduleToPostOnX": ParameterizedString<"x">; + /** + * 予約 + */ + "schedule": string; "_compression": { "_quality": { /** diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 514181b925..e78b17096f 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1384,6 +1384,8 @@ themeIsDefaultBecauseSafeMode: "セーフモードが有効な間はデフォル thankYouForTestingBeta: "ベータ版の検証にご協力いただきありがとうございます!" createUserSpecifiedNote: "ユーザー指定ノートを作成" schedulePost: "投稿を予約" +scheduleToPostOnX: "{x}に投稿を予約します" +schedule: "予約" _compression: _quality: diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 197530d260..60eeb7bb81 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -43,7 +43,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + @@ -61,6 +61,7 @@ SPDX-License-Identifier: AGPL-3.0-only + {{ i18n.tsx.scheduleToPostOnX({ x: new Date(scheduledAt).toLocaleString() }) }} - {{ i18n.ts.notSpecifiedMentionWarning }} -
@@ -263,11 +264,17 @@ const placeholder = computed((): string => { }); const submitText = computed((): string => { - return renoteTargetNote.value - ? i18n.ts.quote - : replyTargetNote.value - ? i18n.ts.reply - : i18n.ts.note; + return scheduledAt.value != null + ? i18n.ts.schedule + : renoteTargetNote.value + ? i18n.ts.quote + : replyTargetNote.value + ? i18n.ts.reply + : i18n.ts.note; +}); + +const submitIcon = computed((): string => { + return posted.value ? 'ti ti-check' : scheduledAt.value != null ? 'ti ti-calendar-time' : replyTargetNote.value ? 'ti ti-arrow-back-up' : renoteTargetNote.value ? 'ti ti-quote' : 'ti ti-send'; }); const textLength = computed((): number => { @@ -1232,10 +1239,12 @@ function showDraftMenu(ev: MouseEvent) { } async function schedule() { - const { canceled, result } = await os.inputDate({ + const { canceled, result } = await os.inputDatetime({ title: i18n.ts.schedulePost, }); if (canceled) return; + + scheduledAt.value = result.getTime(); } onMounted(() => { @@ -1538,6 +1547,10 @@ html[data-color-scheme=light] .preview { margin: 0 20px 16px 20px; } +.scheduledAt { + margin: 0 20px 16px 20px; +} + .cw, .hashtags, .text { diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index 6c5f04c6b5..a14c24746a 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -460,7 +460,7 @@ export function inputNumber(props: { }); } -export function inputDate(props: { +export function inputDatetime(props: { title?: string; text?: string; placeholder?: string | null; @@ -475,7 +475,7 @@ export function inputDate(props: { title: props.title, text: props.text, input: { - type: 'date', + type: 'datetime-local', placeholder: props.placeholder, default: props.default ?? null, },