Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
katullo11 committed Dec 20, 2024
2 parents 25301a9 + 3ed2b48 commit 44848e2
Show file tree
Hide file tree
Showing 36 changed files with 1,262 additions and 1,012 deletions.
10 changes: 5 additions & 5 deletions components/common/CommonRouteTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const router = useRouter()
useCommands(() => command
? options.map(tab => ({
scope: 'Tabs',
name: tab.display,
icon: tab.icon ?? 'i-ri:file-list-2-line',
onActivate: () => router.replace(tab.to),
}))
scope: 'Tabs',
name: tab.display,
icon: tab.icon ?? 'i-ri:file-list-2-line',
onActivate: () => router.replace(tab.to),
}))
: [])
</script>

Expand Down
10 changes: 5 additions & 5 deletions components/common/CommonTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ function toValidName(option: string) {
useCommands(() => command
? tabs.value.map(tab => ({
scope: 'Tabs',
scope: 'Tabs',
name: tab.display,
icon: tab.icon ?? 'i-ri:file-list-2-line',
name: tab.display,
icon: tab.icon ?? 'i-ri:file-list-2-line',
onActivate: () => modelValue.value = tab.name,
}))
onActivate: () => modelValue.value = tab.name,
}))
: [])
</script>

Expand Down
2 changes: 1 addition & 1 deletion components/modal/ModalContainer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
import type { ConfirmDialogChoice } from '~/types'
import {
isCommandPanelOpen,
isConfirmDialogOpen,
Expand All @@ -13,7 +14,6 @@ import {
isReportDialogOpen,
isSigninDialogOpen,
} from '~/composables/dialog'
import type { ConfirmDialogChoice } from '~/types'
const isMac = useIsMac()
Expand Down
4 changes: 2 additions & 2 deletions components/nav/button/MoreMenu.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
defineModel<boolean>()
const model = defineModel<boolean>()
</script>

<template>
<NavBottomMoreMenu
v-slot="{ toggleVisible, show }" v-model="modelValue!" flex flex-row items-center
v-slot="{ toggleVisible, show }" v-model="model!" flex flex-row items-center
place-content-center h-full flex-1 cursor-pointer
>
<button
Expand Down
46 changes: 39 additions & 7 deletions components/notification/NotificationCard.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
// Add undocumented 'annual_report' type introduced in v4.3
// ref. https://github.com/mastodon/documentation/issues/1211#:~:text=api/v1/annual_reports
type NotificationType = mastodon.v1.Notification['type'] | 'annual_report'
type Notification = Omit<mastodon.v1.Notification, 'type'> & { type: NotificationType }
const { notification } = defineProps<{
notification: mastodon.v1.Notification
notification: Notification
}>()
const { t } = useI18n()
// list of notification types Elk currently implemented
// type 'favourite' and 'reblog' should always rendered by NotificationGroupedLikes
const supportedNotificationTypes: NotificationType[] = [
'follow',
'admin.sign_up',
'admin.report',
'follow_request',
'update',
'mention',
'poll',
'update',
'status',
'annual_report',
]
// well-known emoji reactions types Elk does not support yet
const unsupportedEmojiReactionTypes = ['pleroma:emoji_reaction', 'reaction']
if (unsupportedEmojiReactionTypes.includes(notification.type))
if (unsupportedEmojiReactionTypes.includes(notification.type) || !supportedNotificationTypes.includes(notification.type)) {
console.warn(`[DEV] ${t('notification.missing_type')} '${notification.type}' (notification.id: ${notification.id})`)
}
</script>

<template>
Expand Down Expand Up @@ -95,11 +117,21 @@ if (unsupportedEmojiReactionTypes.includes(notification.type))
<template v-else-if="notification.type === 'mention' || notification.type === 'poll' || notification.type === 'status'">
<StatusCard :status="notification.status!" />
</template>
<template v-else-if="!unsupportedEmojiReactionTypes.includes(notification.type)">
<!-- prevent showing errors for dev for known emoji reaction types -->
<!-- type 'favourite' and 'reblog' should always rendered by NotificationGroupedLikes -->
<div text-red font-bold>
[DEV] {{ $t('notification.missing_type') }} '{{ notification.type }}'
<template v-else-if="notification.type === 'annual_report'">
<div flex p4 items-center bg-shaded>
<div i-mdi:party-popper text-xl me-4 color-purple />
<div class="content-rich">
<p>
Your 2024 <NuxtLink to="/tags/Wrapstodon">
#Wrapstodon
</NuxtLink> awaits! Unveil your year's highlights and memorable moments on Mastodon!
</p>
<p>
<NuxtLink :to="`https://${currentServer}/notifications`" target="_blank">
View #Wrapstodon on Mastodon
</NuxtLink>
</p>
</div>
</div>
</template>
</article>
Expand Down
2 changes: 1 addition & 1 deletion components/notification/NotificationPaginator.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
import type { GroupedAccountLike, NotificationSlot } from '~/types'
// @ts-expect-error missing types
import { DynamicScrollerItem } from 'vue-virtual-scroller'
import type { GroupedAccountLike, NotificationSlot } from '~/types'
const { paginator, stream } = defineProps<{
paginator: mastodon.Paginator<mastodon.v1.Notification[], mastodon.rest.v1.ListNotificationsParams>
Expand Down
3 changes: 2 additions & 1 deletion components/publish/PublishWidget.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
import type { DraftItem } from '~/types'
import { EditorContent } from '@tiptap/vue-3'
import stringLength from 'string-length'
import type { DraftItem } from '~/types'
const {
threadComposer,
Expand Down Expand Up @@ -522,6 +522,7 @@ function stopQuestionMarkPropagation(e: KeyboardEvent) {
v-if="!threadIsActive || isFinalItemOfThread"
btn-solid rounded-3 text-sm w-full flex="~ gap1" items-center md:w-fit class="publish-button"
:aria-disabled="isPublishDisabled || isExceedingCharacterLimit" aria-describedby="publish-tooltip"
:disabled="isPublishDisabled || isExceedingCharacterLimit"
@click="publish"
>
<span v-if="isSending" block animate-spin preserve-3d>
Expand Down
2 changes: 1 addition & 1 deletion components/publish/PublishWidgetFull.client.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { formatTimeAgo } from '@vueuse/core'
import type { DraftItem } from '~/types'
import { formatTimeAgo } from '@vueuse/core'
const route = useRoute()
const { formatNumber } = useHumanReadableNumber()
Expand Down
2 changes: 1 addition & 1 deletion components/settings/SettingsBottomNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const defaultSelectedNavButtonNames = computed<NavButtonName[]>(() =>
: ['explore', 'local', 'federated', 'moreMenu'],
)
const navButtonNamesSetting = useLocalStorage<NavButtonName[]>(STORAGE_KEY_BOTTOM_NAV_BUTTONS, defaultSelectedNavButtonNames.value)
const selectedNavButtonNames = ref<NavButtonName[]>([])
const selectedNavButtonNames = ref<NavButtonName[]>(navButtonNamesSetting.value)
const selectedNavButtons = computed<NavButton[]>(() =>
selectedNavButtonNames.value.map(name =>
Expand Down
14 changes: 14 additions & 0 deletions components/status/StatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const timeago = useTimeAgo(() => status.value.createdAt, timeAgoOptions)
const isSelfReply = computed(() => status.value.inReplyToAccountId === status.value.account.id)
const collapseRebloggedBy = computed(() => rebloggedBy.value?.id === status.value.account.id)
const isDM = computed(() => status.value.visibility === 'direct')
const isPinned = computed(() => status.value.pinned)
const showUpperBorder = computed(() => props.newer && !directReply.value)
const showReplyTo = computed(() => !replyToMain.value && !directReply.value)
Expand All @@ -75,6 +76,19 @@ const forceShow = ref(false)
<div :h="showUpperBorder ? '1px' : '0'" w-auto bg-border mb-1 z--1 />

<slot name="meta">
<!-- Pinned status -->
<div flex="~ col" justify-between>
<div
v-if="isPinned"
flex="~ gap2" items-center h-auto text-sm text-orange
m="is-5" p="t-1 is-5"
relative text-secondary ws-nowrap
>
<div i-ri:pushpin-line />
<span>{{ $t('status.pinned') }}</span>
</div>
</div>

<!-- Line connecting to previous status -->
<template v-if="status.inReplyToAccountId">
<StatusReplyingTo
Expand Down
4 changes: 2 additions & 2 deletions components/tiptap/TiptapEmojiList.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { getEmojiMatchesInText } from '@iconify/utils/lib/emoji/replace/find'
import { emojiFilename, emojiPrefix, emojiRegEx } from '~~/config/emojis'
import type { CommandHandler } from '~/composables/command'
import type { CustomEmoji, Emoji } from '~/composables/tiptap/suggestion'
import { getEmojiMatchesInText } from '@iconify/utils/lib/emoji/replace/find'
import { emojiFilename, emojiPrefix, emojiRegEx } from '~~/config/emojis'
import { isCustomEmoji } from '~/composables/tiptap/suggestion'
const { items, command } = defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion composables/command.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { LocaleObject } from '@nuxtjs/i18n'
import type { ComputedRef } from 'vue'
import type { SearchResult } from '~/composables/masto/search'
import Fuse from 'fuse.js'
import { defineStore } from 'pinia'
import type { SearchResult } from '~/composables/masto/search'

// @unocss-include

Expand Down
2 changes: 1 addition & 1 deletion composables/dialog.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { mastodon } from 'masto'
import { STORAGE_KEY_FIRST_VISIT } from '~/constants'
import type { ConfirmDialogChoice, ConfirmDialogOptions, DraftItem, ErrorDialogData } from '~/types'
import { STORAGE_KEY_FIRST_VISIT } from '~/constants'

export const confirmDialogChoice = ref<ConfirmDialogChoice>()
export const confirmDialogLabel = ref<ConfirmDialogOptions>()
Expand Down
2 changes: 1 addition & 1 deletion composables/masto/masto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { Pausable } from '@vueuse/core'
import type { mastodon } from 'masto'
import type { Ref } from 'vue'
import type { ElkInstance } from '../users'
import { createRestAPIClient, createStreamingAPIClient } from 'masto'
import type { UserLogin } from '~/types'
import { createRestAPIClient, createStreamingAPIClient } from 'masto'

export function createMasto() {
return {
Expand Down
2 changes: 1 addition & 1 deletion composables/masto/publish.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DraftItem } from '~~/types'
import type { mastodon } from 'masto'
import type { Ref } from 'vue'
import type { DraftItem } from '~~/types'
import { fileOpen } from 'browser-fs-access'

export function usePublish(options: {
Expand Down
2 changes: 1 addition & 1 deletion composables/masto/statusDrafts.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { mastodon } from 'masto'
import type { ComputedRef, Ref } from 'vue'
import { STORAGE_KEY_DRAFTS } from '~/constants'
import type { DraftItem, DraftMap } from '~/types'
import type { Mutable } from '~/types/utils'
import { STORAGE_KEY_DRAFTS } from '~/constants'

export const currentUserDrafts = (import.meta.server || process.test)
? computed<DraftMap>(() => ({}))
Expand Down
6 changes: 3 additions & 3 deletions composables/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import type { MaybeRefOrGetter, RemovableRef } from '@vueuse/core'
import type { mastodon } from 'masto'
import type { EffectScope, Ref } from 'vue'
import type { ElkMasto } from './masto/masto'
import { withoutProtocol } from 'ufo'
import type { PushNotificationPolicy, PushNotificationRequest } from '~/composables/push-notifications/types'
import type { UserLogin } from '~/types'
import type { Overwrite } from '~/types/utils'
import { withoutProtocol } from 'ufo'
import {
DEFAULT_POST_CHARS_LIMIT,
STORAGE_KEY_CURRENT_USER_HANDLE,
Expand All @@ -12,8 +14,6 @@ import {
STORAGE_KEY_NOTIFICATION_POLICY,
STORAGE_KEY_SERVERS,
} from '~/constants'
import type { UserLogin } from '~/types'
import type { Overwrite } from '~/types/utils'

const mock = process.mock

Expand Down
2 changes: 1 addition & 1 deletion config/emojis.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { EmojiRegexMatch } from '@iconify/utils/lib/emoji/replace/find'
import { getEmojiMatchesInText } from '@iconify/utils/lib/emoji/replace/find'
// @unimport-disabled
import { emojiFilename, emojiPrefix, emojiRegEx } from '@iconify-emoji/twemoji'
import { getEmojiMatchesInText } from '@iconify/utils/lib/emoji/replace/find'

// Re-export everything from package
export * from '@iconify-emoji/twemoji'
Expand Down
Loading

0 comments on commit 44848e2

Please sign in to comment.