From 4b1ceccd85c5493a70b6cd5c3c304802a6d518e5 Mon Sep 17 00:00:00 2001
From: TAKAHASHI Shuuji <shuuji3@gmail.com>
Date: Sun, 3 Mar 2024 17:32:35 +0900
Subject: [PATCH] feat: replace "publish" with "schedule" in label/aria text

---
 components/publish/PublishWidget.vue | 27 +++++++++++++++++++++++++--
 locales/en.json                      |  5 +++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue
index 5169d7bb..1457d803 100644
--- a/components/publish/PublishWidget.vue
+++ b/components/publish/PublishWidget.vue
@@ -300,6 +300,28 @@ function stopQuestionMarkPropagation(e: KeyboardEvent) {
                 </li>
               </ol>
             </CommonErrorMessage>
+        <CommonErrorMessage v-if="failedMessages.length > 0" described-by="publish-failed">
+          <header id="publish-failed" flex justify-between>
+            <div flex items-center gap-x-2 font-bold>
+              <div aria-hidden="true" i-ri:error-warning-fill />
+              <p>{{ scheduleDateTime ? $t('state.schedule_failed') : $t('state.publish_failed') }}</p>
+            </div>
+            <CommonTooltip placement="bottom" :content="scheduleDateTime ? $t('state.clear_schedule_failed') : $t('action.clear_publish_failed')">
+              <button
+                flex rounded-4 p1 hover:bg-active cursor-pointer transition-100 :aria-label="scheduleDateTime ? $t('state.clear_schedule_failed') : $t('action.clear_publish_failed')"
+                @click="failedMessages = []"
+              >
+                <span aria-hidden="true" w="1.75em" h="1.75em" i-ri:close-line />
+              </button>
+            </CommonTooltip>
+          </header>
+          <ol ps-2 sm:ps-1>
+            <li v-for="(error, i) in failedMessages" :key="i" flex="~ col sm:row" gap-y-1 sm:gap-x-2>
+              <strong>{{ i + 1 }}.</strong>
+              <span>{{ error }}</span>
+            </li>
+          </ol>
+        </CommonErrorMessage>
 
             <div relative flex-1 flex flex-col :class="shouldExpanded ? 'min-h-30' : ''">
               <EditorContent
@@ -519,7 +541,7 @@ function stopQuestionMarkPropagation(e: KeyboardEvent) {
 
             <CommonTooltip
               v-if="failedMessages.length > 0" id="publish-failed-tooltip" placement="top"
-              :content="$t('tooltip.publish_failed')"
+              :content="scheduleDateTime ? $t('state.schedule_failed') : $t('tooltip.publish_failed')"
             >
               <button
                 btn-danger rounded-3 text-sm w-full flex="~ gap1" items-center md:w-fit
@@ -528,7 +550,7 @@ function stopQuestionMarkPropagation(e: KeyboardEvent) {
                 <span block>
                   <div block i-carbon:face-dizzy-filled />
                 </span>
-                <span>{{ $t('state.publish_failed') }}</span>
+                <span>{{ scheduleDateTime ? $t('state.schedule_failed') : $t('state.publish_failed') }}</span>
               </button>
             </CommonTooltip>
 
@@ -554,6 +576,7 @@ function stopQuestionMarkPropagation(e: KeyboardEvent) {
                 <template v-else>
                   <span v-if="draft.editingStatus">{{ $t('action.save_changes') }}</span>
                   <span v-else-if="draft.params.inReplyToId">{{ $t('action.reply') }}</span>
+                  <span v-else-if="scheduleDateTime">{{ !isSending ? $t('action.schedule') : $t('state.scheduling') }}</span>
                   <span v-else>{{ !isSending ? $t('action.publish') : $t('state.publishing') }}</span>
                 </template>
               </button>
diff --git a/locales/en.json b/locales/en.json
index 80017586..0975e6cf 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -61,6 +61,7 @@
     "clear": "Clear",
     "clear_publish_failed": "Clear publish errors",
     "clear_save_failed": "Clear save errors",
+    "clear_schedule_failed": "Clear schedule errors",
     "clear_upload_failed": "Clear file upload errors",
     "close": "Close",
     "compose": "Compose",
@@ -82,6 +83,7 @@
     "reset": "Reset",
     "save": "Save",
     "save_changes": "Save changes",
+    "schedule": "Schedule",
     "sign_in": "Sign in",
     "sign_in_to": "Sign in to {0}",
     "switch_account": "Switch account",
@@ -612,6 +614,8 @@
     "publish_failed": "Publish failed",
     "publishing": "Publishing",
     "save_failed": "Save failed",
+    "schedule_failed": "Schedule failed",
+    "scheduling": "Scheduling",
     "upload_failed": "Upload failed",
     "uploading": "Uploading..."
   },
@@ -736,6 +740,7 @@
     "pick_an_icon": "Pick an icon",
     "publish_failed": "Close failed messages at the top of editor to republish posts",
     "remove_thread_item": "Remove item from thread",
+    "schedule_failed": "Close failed messages at the top of editor to reschedule posts",
     "schedule_post": "Schedule post",
     "start_thread": "Start thread",
     "toggle_bold": "Toggle bold",