diff --git a/components/account/AccountMoved.vue b/components/account/AccountMoved.vue index 32e79389..ac3b79e4 100644 --- a/components/account/AccountMoved.vue +++ b/components/account/AccountMoved.vue @@ -1,4 +1,6 @@ diff --git a/components/common/CommonCropImage.vue b/components/common/CommonCropImage.vue index adee86d6..a0557210 100644 --- a/components/common/CommonCropImage.vue +++ b/components/common/CommonCropImage.vue @@ -5,7 +5,7 @@ import 'vue-advanced-cropper/dist/style.css' export interface Props { /** Images to be cropped */ - modelValue?: File + modelValue?: File | null /** Crop frame aspect ratio (width/height), default 1/1 */ stencilAspectRatio?: number /** The ratio of the longest edge of the cut box to the length of the cut screen, default 0.9, not more than 1 */ diff --git a/components/common/CommonInputImage.vue b/components/common/CommonInputImage.vue index 49a51db2..3d88734a 100644 --- a/components/common/CommonInputImage.vue +++ b/components/common/CommonInputImage.vue @@ -3,7 +3,7 @@ import { fileOpen } from 'browser-fs-access' import type { FileWithHandle } from 'browser-fs-access' const props = withDefaults(defineProps<{ - modelValue?: FileWithHandle + modelValue?: FileWithHandle | null /** The image src before change */ original?: string /** Allowed file types */ diff --git a/components/modal/ModalContainer.vue b/components/modal/ModalContainer.vue index 2ef41456..31ba7cb3 100644 --- a/components/modal/ModalContainer.vue +++ b/components/modal/ModalContainer.vue @@ -53,6 +53,7 @@ const handlePublishClose = () => { > @@ -65,7 +66,7 @@ const handlePublishClose = () => { - + diff --git a/components/notification/NotificationPaginator.vue b/components/notification/NotificationPaginator.vue index d4a8e287..2f36aded 100644 --- a/components/notification/NotificationPaginator.vue +++ b/components/notification/NotificationPaginator.vue @@ -1,5 +1,11 @@ @@ -15,7 +16,7 @@ const { translation } = useTranslation(status) class="line-compact" :content="status.content" :emojis="status.emojis" - :lang="status.language" + :lang="'language' in status && status.language" />
- +
diff --git a/composables/gestures/index.ts b/composables/gestures/index.ts index 2b04ae5b..5cb2b747 100644 --- a/composables/gestures/index.ts +++ b/composables/gestures/index.ts @@ -24,7 +24,6 @@ export const useImageGesture = ( const { set } = useSpring(motionProperties as Partial) - // @ts-expect-error we need to fix types: just suppress it for now const handlers: Handlers = { onPinch({ offset: [d] }) { set({ scale: 1 + d / 200 }) diff --git a/composables/translate.ts b/composables/translate.ts index a275453f..79e9625d 100644 --- a/composables/translate.ts +++ b/composables/translate.ts @@ -1,4 +1,4 @@ -import type { Status } from 'masto' +import type { Status, StatusEdit } from 'masto' export interface TranslationResponse { translatedText: string @@ -24,15 +24,18 @@ export async function translateText(text: string, from?: string | null, to?: str return translatedText } -const translations = new WeakMap() +const translations = new WeakMap() -export function useTranslation(status: Status) { +export function useTranslation(status: Status | StatusEdit) { if (!translations.has(status)) translations.set(status, reactive({ visible: false, text: '' })) const translation = translations.get(status)! async function toggle() { + if (!('language' in status)) + return + if (!translation.text) translation.text = await translateText(status.content, status.language) diff --git a/html.d.ts b/html.d.ts deleted file mode 100644 index 343ccfd9..00000000 --- a/html.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// for UnoCSS attributify mode compact in Volar -// refer: https://github.com/johnsoncodehk/volar/issues/1077#issuecomment-1145361472 -declare module '@vue/runtime-dom' { - interface HTMLAttributes { - [key: string]: any - } -} -declare module '@vue/runtime-core' { - interface AllowedComponentProps { - [key: string]: any - } -} -export {} diff --git a/pages/[[server]]/@[account]/[status].vue b/pages/[[server]]/@[account]/[status].vue index 467278fc..7c11f52a 100644 --- a/pages/[[server]]/@[account]/[status].vue +++ b/pages/[[server]]/@[account]/[status].vue @@ -1,5 +1,4 @@