Skip to content

Commit

Permalink
chore: format and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shuuji3 committed Feb 1, 2025
1 parent fae7914 commit 31b17d7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 53 deletions.
105 changes: 52 additions & 53 deletions components/publish/PublishWidget.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
import type { DraftItem } from '~/types'
import { EditorContent } from '@tiptap/vue-3'
import { useNow } from '@vueuse/core'
import stringLength from 'string-length'
import type { DraftItem } from '~/types'

Check failure on line 6 in components/publish/PublishWidget.vue

View workflow job for this annotation

GitHub Actions / ci

Expected "~/types" (internal-type) to come before "string-length" (external)
const {
threadComposer,
Expand Down Expand Up @@ -88,12 +88,11 @@ function trimPollOptions() {
const trimmedOptions = draft.value.params.poll!.options.slice(0, indexLastNonEmpty + 1)
if (currentInstance.value?.configuration
&& trimmedOptions.length >= currentInstance.value?.configuration?.polls.maxOptions) {
&& trimmedOptions.length >= currentInstance.value?.configuration?.polls.maxOptions)
draft.value.params.poll!.options = trimmedOptions

Check failure on line 92 in components/publish/PublishWidget.vue

View workflow job for this annotation

GitHub Actions / ci

Expect curly brackets
}
else {
else
draft.value.params.poll!.options = [...trimmedOptions, '']

Check failure on line 95 in components/publish/PublishWidget.vue

View workflow job for this annotation

GitHub Actions / ci

Expect curly brackets
}
}
function editPollOptionDraft(event: Event, index: number) {
Expand Down Expand Up @@ -335,37 +334,37 @@ 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>{{ scheduledTime ? $t('state.schedule_failed') : $t('state.publish_failed') }}</p>
</div>
<CommonTooltip placement="bottom" :content="scheduledTime ? $t('action.clear_schedule_failed') : $t('action.clear_publish_failed')">
<button
flex rounded-4 p1 hover:bg-active cursor-pointer transition-100 :aria-label="scheduledTime ? $t('action.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>

<CommonErrorMessage v-if="!isValidScheduledTime" described-by="scheduled-time-invalid" pt-2>
<header id="scheduled-time-invalid" flex justify-between>
<div flex items-center gap-x-2 font-bold>
<div aria-hidden="true" i-ri:error-warning-fill />
<p>{{ $t('state.schedule_time_invalid', [minimumScheduledTime.toLocaleString()]) }}</p>
</div>
</header>
</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>{{ scheduledTime ? $t('state.schedule_failed') : $t('state.publish_failed') }}</p>
</div>
<CommonTooltip placement="bottom" :content="scheduledTime ? $t('action.clear_schedule_failed') : $t('action.clear_publish_failed')">
<button
flex rounded-4 p1 hover:bg-active cursor-pointer transition-100 :aria-label="scheduledTime ? $t('action.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>

<CommonErrorMessage v-if="!isValidScheduledTime" described-by="scheduled-time-invalid" pt-2>
<header id="scheduled-time-invalid" flex justify-between>
<div flex items-center gap-x-2 font-bold>
<div aria-hidden="true" i-ri:error-warning-fill />
<p>{{ $t('state.schedule_time_invalid', [minimumScheduledTime.toLocaleString()]) }}</p>
</div>
</header>
</CommonErrorMessage>

<div relative flex-1 flex flex-col :class="shouldExpanded ? 'min-h-30' : ''">
<EditorContent
Expand Down Expand Up @@ -528,24 +527,24 @@ function stopQuestionMarkPropagation(e: KeyboardEvent) {

<PublishEditorTools v-if="editor" :editor="editor" />

<CommonDropdown placement="bottom">
<CommonTooltip placement="top" :content="$t('tooltip.schedule_post')" no-auto-focus>
<button btn-action-icon :aria-label="$t('tooltip.schedule_post')">
<div i-ri:calendar-schedule-line :class="scheduledTime !== '' ? 'text-primary' : ''" />
</button>
</CommonTooltip>
<template #popper>
<input
v-model="scheduledTime"
p2
type="datetime-local"
name="schedule-datetime"
:min="getDatetimeInputFormat(minimumScheduledTime)"
>
</template>
</CommonDropdown>
<CommonDropdown placement="bottom">
<CommonTooltip placement="top" :content="$t('tooltip.schedule_post')" no-auto-focus>
<button btn-action-icon :aria-label="$t('tooltip.schedule_post')">
<div i-ri:calendar-schedule-line :class="scheduledTime !== '' ? 'text-primary' : ''" />
</button>
</CommonTooltip>
<template #popper>
<input
v-model="scheduledTime"
p2
type="datetime-local"
name="schedule-datetime"
:min="getDatetimeInputFormat(minimumScheduledTime)"
>
</template>
</CommonDropdown>

<div flex-auto />
<div flex-auto />

<PublishCharacterCounter :max="characterLimit" :length="characterCount" />

Expand Down
2 changes: 2 additions & 0 deletions components/status/ScheduledStatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const client = useMastoClient()
async function cancelSchedule(id: string) {
const status = await client.v1.scheduledStatuses.$select(id)
// DEBUG: temporarily disable
// eslint-disable-next-line no-alert
if (confirm('Are you sure to cancel this scheduled post?'))
status.remove()
}
Expand Down

0 comments on commit 31b17d7

Please sign in to comment.