Skip to content

Commit

Permalink
Merge pull request #19 from maybeanerd/chore-update-from-upstream-elk
Browse files Browse the repository at this point in the history
chore: update from upstream elk
  • Loading branch information
maybeanerd authored Apr 18, 2024
2 parents 817164a + bb240da commit 19eb11f
Show file tree
Hide file tree
Showing 60 changed files with 1,302 additions and 585 deletions.
2 changes: 1 addition & 1 deletion components/account/AccountBotIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defineProps<{
text-secondary-light
>
<slot name="prepend" />
<CommonTooltip no-auto-focus :content="$t('account.bot')" :disabled="showLabel">
<CommonTooltip :content="$t('account.bot')" :disabled="showLabel">
<div i-mdi:robot-outline />
</CommonTooltip>
<div v-if="showLabel">
Expand Down
4 changes: 2 additions & 2 deletions components/account/AccountFollowRequestButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function rejectFollowRequest() {
<template>
<div flex gap-4>
<template v-if="relationship?.requestedBy">
<CommonTooltip :content="$t('account.authorize')" no-auto-focus>
<CommonTooltip :content="$t('account.authorize')">
<button
type="button"
rounded-full text-sm p2 border-1
Expand All @@ -48,7 +48,7 @@ async function rejectFollowRequest() {
<span block text-current i-ri:check-fill />
</button>
</CommonTooltip>
<CommonTooltip :content="$t('account.reject')" no-auto-focus>
<CommonTooltip :content="$t('account.reject')">
<button
type="button"
rounded-full text-sm p2 border-1
Expand Down
2 changes: 1 addition & 1 deletion components/account/AccountHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ async function copyAccountName() {
<div flex items-center gap-1>
<AccountHandle :account="account" overflow-unset line-clamp-unset />
<CommonTooltip placement="bottom" :content="$t('account.copy_account_name')" no-auto-focus flex>
<CommonTooltip placement="bottom" :content="$t('account.copy_account_name')" flex>
<button text-secondary-light text-sm :class="isCopied ? 'i-ri:check-fill text-green' : 'i-ri:file-copy-line'" @click="copyAccountName">
<span sr-only>{{ $t('account.copy_account_name') }}</span>
</button>
Expand Down
1 change: 1 addition & 0 deletions components/account/AccountHoverWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const userSettings = useUserSettings()
:delay="{ show: 500, hide: 100 }"
v-bind="$attrs"
:close-on-content-click="false"
no-auto-focus
>
<slot />
<template #popper>
Expand Down
2 changes: 1 addition & 1 deletion components/account/AccountLockIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { t } = useI18n()
text-secondary-light
>
<slot name="prepend" />
<CommonTooltip no-auto-focus content="Lock" :disabled="showLabel">
<CommonTooltip content="Lock" :disabled="showLabel">
<div i-ri:lock-line />
</CommonTooltip>
<div v-if="showLabel">
Expand Down
1 change: 1 addition & 0 deletions components/account/TagHoverWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const userSettings = useUserSettings()
:delay="{ show: 500, hide: 100 }"
v-bind="$attrs"
:close-on-content-click="false"
no-auto-focus
>
<slot />
<template #popper>
Expand Down
2 changes: 1 addition & 1 deletion components/common/CommonRouteTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ useCommands(() => command
</template>
<template v-if="isHydrated && moreOptions?.options?.length">
<CommonDropdown placement="bottom" flex cursor-pointer mx-1.25rem>
<CommonTooltip placement="top" no-auto-focus :content="moreOptions.tooltip || t('action.more')">
<CommonTooltip placement="top" :content="moreOptions.tooltip || t('action.more')">
<button
cursor-pointer
flex
Expand Down
1 change: 1 addition & 0 deletions components/common/CommonTooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defineProps<Props>()
v-if="isHydrated"
v-bind="$attrs"
auto-hide
no-auto-focus
>
<slot />
<template #popper>
Expand Down
1 change: 0 additions & 1 deletion components/list/Account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ async function edit() {
<CommonTooltip
:content="isRemoved ? $t('list.add_account') : $t('list.remove_account')"
:hover="isRemoved ? 'text-green' : 'text-red'"
no-auto-focus
>
<button
text-sm p2 border-1 transition-colors
Expand Down
12 changes: 6 additions & 6 deletions components/list/ListEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ async function prepareEdit() {
async function cancelEdit() {
isEditing.value = false
actionError.value = undefined
reset()
await nextTick()
reset()
editBtn.value?.focus()
}
Expand Down Expand Up @@ -113,7 +113,7 @@ onDeactivated(cancelEdit)
bg-base border="~ base" h10 m2 ps-1 pe-4 rounded-3 w-full flex="~ row"
items-center relative focus-within:box-shadow-outline gap-3
>
<CommonTooltip v-if="isEditing" :content="$t('list.cancel_edit')" no-auto-focus>
<CommonTooltip v-if="isEditing" :content="$t('list.cancel_edit')">
<button
type="button"
rounded-full text-sm p2 transition-colors
Expand All @@ -136,7 +136,7 @@ onDeactivated(cancelEdit)
{{ form.title }}
</NuxtLink>
<div mr4 flex gap2>
<CommonTooltip v-if="isEditing" :content="$t('list.save')" no-auto-focus>
<CommonTooltip v-if="isEditing" :content="$t('list.save')">
<button
type="submit"
text-sm p2 border-1 transition-colors
Expand All @@ -152,7 +152,7 @@ onDeactivated(cancelEdit)
</template>
</button>
</CommonTooltip>
<CommonTooltip v-else :content="$t('list.edit')" no-auto-focus>
<CommonTooltip v-else :content="$t('list.edit')">
<button
ref="editBtn"
type="button"
Expand All @@ -164,7 +164,7 @@ onDeactivated(cancelEdit)
<span block text-current i-ri:edit-2-line class="rtl-flip" />
</button>
</CommonTooltip>
<CommonTooltip :content="$t('list.delete')" no-auto-focus>
<CommonTooltip :content="$t('list.delete')">
<button
type="button"
text-sm p2 border-1 transition-colors
Expand Down Expand Up @@ -192,7 +192,7 @@ onDeactivated(cancelEdit)
<div aria-hidden="true" i-ri:error-warning-fill />
<p>{{ $t(`list.${isEditing ? 'edit_error' : 'delete_error'}`) }}</p>
</div>
<CommonTooltip placement="bottom" :content="$t('list.clear_error')" no-auto-focus>
<CommonTooltip placement="bottom" :content="$t('list.clear_error')">
<button
flex rounded-4 p1 hover:bg-active cursor-pointer transition-100 :aria-label="$t('list.clear_error')"
@click="clearError"
Expand Down
10 changes: 9 additions & 1 deletion components/list/Lists.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function edit(listId: string) {
</script>

<template>
<CommonPaginator :end-message="false" :paginator="paginator">
<CommonPaginator :paginator="paginator">
<template #default="{ item }">
<div p4 hover:bg-active block w="100%" flex justify-between items-center gap-4>
<p>{{ item.title }}</p>
Expand All @@ -49,5 +49,13 @@ async function edit(listId: string) {
</CommonTooltip>
</div>
</template>
<template #done>
<NuxtLink
p4 hover:bg-active block w="100%" flex justify-between items-center gap-4
to="/lists"
>
<p>{{ $t('list.manage') }}</p>
</NuxtLink>
</template>
</CommonPaginator>
</template>
2 changes: 1 addition & 1 deletion components/modal/ModalContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function handleFavouritedBoostedByClose() {
@close="handlePublishClose"
>
<!-- This `w-0` style is used to avoid overflow problems in flex layouts,so don't remove it unless you know what you're doing -->
<PublishWidget
<PublishWidgetList
v-if="dialogDraftKey"
:draft-key="dialogDraftKey" expanded flex-1 w-0
@published="handlePublished"
Expand Down
79 changes: 32 additions & 47 deletions components/nav/NavBottom.vue
Original file line number Diff line number Diff line change
@@ -1,60 +1,45 @@
<script setup lang="ts">
// only one icon can be lit up at the same time
import { STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE } from '~/constants'
import type { Component } from 'vue'
import type { NavButtonName } from '../../composables/settings'
const moreMenuVisible = ref(false)
import { STORAGE_KEY_BOTTOM_NAV_BUTTONS } from '~/constants'
import { NavButtonExplore, NavButtonFederated, NavButtonHome, NavButtonLocal, NavButtonMention, NavButtonMoreMenu, NavButtonNotification, NavButtonSearch } from '#components'
interface NavButton {
name: string
component: Component
}
const navButtons: NavButton[] = [
{ name: 'home', component: NavButtonHome },
{ name: 'search', component: NavButtonSearch },
{ name: 'notification', component: NavButtonNotification },
{ name: 'mention', component: NavButtonMention },
{ name: 'explore', component: NavButtonExplore },
{ name: 'local', component: NavButtonLocal },
{ name: 'federated', component: NavButtonFederated },
{ name: 'moreMenu', component: NavButtonMoreMenu },
]
const { notifications } = useNotifications()
const lastAccessedNotificationRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE, '')
const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, '')
const defaultSelectedNavButtonNames: NavButtonName[] = currentUser.value
? ['home', 'search', 'notification', 'mention', 'moreMenu']
: ['explore', 'local', 'federated', 'moreMenu']
const selectedNavButtonNames = useLocalStorage<NavButtonName[]>(STORAGE_KEY_BOTTOM_NAV_BUTTONS, defaultSelectedNavButtonNames)
const selectedNavButtons = computed(() => selectedNavButtonNames.value.map(name => navButtons.find(navButton => navButton.name === name)))
// only one icon can be lit up at the same time
const moreMenuVisible = ref(false)
</script>

<template>
<!-- This weird styles above are used for scroll locking, don't change it unless you know exactly what you're doing. -->
<nav
h-14 border="t base" flex flex-row text-xl
of-y-scroll scrollbar-hide overscroll-none
class="after-content-empty after:(h-[calc(100%+0.5px)] w-0.1px pointer-events-none)"
>
<!-- These weird styles above are used for scroll locking, don't change it unless you know exactly what you're doing. -->
<template v-if="currentUser">
<NuxtLink to="/home" :aria-label="$t('nav.home')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:home-5-line />
</NuxtLink>
<NuxtLink to="/search" :aria-label="$t('nav.search')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:search-line />
</NuxtLink>
<NuxtLink :to="`/notifications/${lastAccessedNotificationRoute}`" :aria-label="$t('nav.notifications')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div flex relative>
<div class="i-ri:notification-4-line" text-xl />
<div v-if="notifications" class="top-[-0.3rem] right-[-0.3rem]" absolute font-bold rounded-full h-4 w-4 text-xs bg-primary text-inverted flex items-center justify-center>
{{ notifications < 10 ? notifications : '' }}
</div>
</div>
</NuxtLink>
<NuxtLink to="/conversations" :aria-label="$t('nav.conversations')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:at-line />
</NuxtLink>
</template>
<template v-else>
<NuxtLink :to="`/${currentServer}/explore/${lastAccessedExploreRoute}`" :aria-label="$t('nav.explore')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:compass-3-line />
</NuxtLink>
<NuxtLink group :to="`/${currentServer}/public/local`" :aria-label="$t('nav.local')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:group-2-line />
</NuxtLink>
<NuxtLink :to="`/${currentServer}/public`" :aria-label="$t('nav.federated')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:earth-line />
</NuxtLink>
</template>
<NavBottomMoreMenu v-slot="{ toggleVisible, show }" v-model="moreMenuVisible" flex flex-row items-center place-content-center h-full flex-1 cursor-pointer>
<button
flex items-center place-content-center h-full flex-1 class="select-none"
:class="show ? '!text-primary' : ''"
aria-label="More menu"
@click="toggleVisible"
>
<span :class="show ? 'i-ri:close-fill' : 'i-ri:more-fill'" />
</button>
</NavBottomMoreMenu>
<Component :is="navButton!.component" v-for="navButton in selectedNavButtons" :key="navButton!.name" :active-class="moreMenuVisible ? '' : 'text-primary'" />
</nav>
</template>
15 changes: 15 additions & 0 deletions components/nav/button/Explore.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script setup lang="ts">
import { STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE } from '~/constants'
defineProps<{
activeClass: string
}>()
const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, '')
</script>

<template>
<NuxtLink :to="`/${currentServer}/explore/${lastAccessedExploreRoute}`" :aria-label="$t('nav.explore')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:compass-3-line />
</NuxtLink>
</template>
11 changes: 11 additions & 0 deletions components/nav/button/Federated.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup lang="ts">
defineProps<{
activeClass: string
}>()
</script>

<template>
<NuxtLink :to="`/${currentServer}/public`" :aria-label="$t('nav.federated')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:earth-line />
</NuxtLink>
</template>
11 changes: 11 additions & 0 deletions components/nav/button/Home.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup lang="ts">
defineProps<{
activeClass: string
}>()
</script>

<template>
<NuxtLink to="/home" :aria-label="$t('nav.home')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:home-5-line />
</NuxtLink>
</template>
11 changes: 11 additions & 0 deletions components/nav/button/Local.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup lang="ts">
defineProps<{
activeClass: string
}>()
</script>

<template>
<NuxtLink group :to="`/${currentServer}/public/local`" :aria-label="$t('nav.local')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:group-2-line />
</NuxtLink>
</template>
15 changes: 15 additions & 0 deletions components/nav/button/Mention.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script setup lang="ts">
defineProps<{
activeClass: string
}>()
</script>

<template>
<NuxtLink
to="/conversations" :aria-label="$t('nav.conversations')"
:active-class="activeClass" flex flex-row items-center place-content-center h-full
flex-1 class="coarse-pointer:select-none" @click="$scrollToTop"
>
<div i-ri:at-line />
</NuxtLink>
</template>
19 changes: 19 additions & 0 deletions components/nav/button/MoreMenu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script setup lang="ts">
defineModel<boolean>()
</script>

<template>
<NavBottomMoreMenu
v-slot="{ toggleVisible, show }" v-model="modelValue!" flex flex-row items-center
place-content-center h-full flex-1 cursor-pointer
>
<button
flex items-center place-content-center h-full flex-1 class="select-none"
:class="show ? '!text-primary' : ''"
aria-label="More menu"
@click="toggleVisible"
>
<span :class="show ? 'i-ri:close-fill' : 'i-ri:more-fill'" />
</button>
</NavBottomMoreMenu>
</template>
20 changes: 20 additions & 0 deletions components/nav/button/Notification.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script setup lang="ts">
import { STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE } from '~/constants'
defineProps<{
activeClass: string
}>()
const { notifications } = useNotifications()
const lastAccessedNotificationRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE, '')
</script>

<template>
<NuxtLink :to="`/notifications/${lastAccessedNotificationRoute}`" :aria-label="$t('nav.notifications')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div flex relative>
<div class="i-ri:notification-4-line" text-xl />
<div v-if="notifications" class="top-[-0.3rem] right-[-0.3rem]" absolute font-bold rounded-full h-4 w-4 text-xs bg-primary text-inverted flex items-center justify-center>
{{ notifications < 10 ? notifications : '' }}
</div>
</div>
</NuxtLink>
</template>
11 changes: 11 additions & 0 deletions components/nav/button/Search.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup lang="ts">
defineProps<{
activeClass: string
}>()
</script>

<template>
<NuxtLink to="/search" :aria-label="$t('nav.search')" :active-class="activeClass" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
<div i-ri:search-line />
</NuxtLink>
</template>
Loading

0 comments on commit 19eb11f

Please sign in to comment.