Merge remote-tracking branch 'origin/develop' into migrate/vuex-to-pinia

This commit is contained in:
Henry Jameson 2025-01-30 18:08:05 +02:00
commit 58e18d48df
489 changed files with 31167 additions and 9871 deletions

View file

@ -2,6 +2,7 @@ import Popover from '../popover/popover.vue'
import NavigationEntry from 'src/components/navigation/navigation_entry.vue'
import { mapState } from 'vuex'
import { ListsMenuContent } from '../lists_menu/lists_menu_content.vue'
import { BookmarkFoldersMenuContent } from '../bookmark_folders_menu/bookmark_folders_menu_content.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import { TIMELINES } from 'src/components/navigation/navigation.js'
import { filterNavigation } from 'src/components/navigation/filter.js'
@ -15,13 +16,14 @@ library.add(faChevronDown)
// Route -> i18n key mapping, exported and not in the computed
// because nav panel benefits from the same information.
export const timelineNames = () => {
export const timelineNames = (supportsBookmarkFolders) => {
return {
friends: 'nav.home_timeline',
bookmarks: 'nav.bookmarks',
bookmarks: supportsBookmarkFolders ? 'nav.all_bookmarks' : 'nav.bookmarks',
dms: 'nav.dms',
'public-timeline': 'nav.public_tl',
'public-external-timeline': 'nav.twkn'
'public-external-timeline': 'nav.twkn',
quotes: 'nav.quotes'
}
}
@ -29,7 +31,8 @@ const TimelineMenu = {
components: {
Popover,
NavigationEntry,
ListsMenuContent
ListsMenuContent,
BookmarkFoldersMenuContent
},
data () {
return {
@ -37,7 +40,7 @@ const TimelineMenu = {
}
},
created () {
if (timelineNames()[this.$route.name]) {
if (timelineNames(this.bookmarkFolders)[this.$route.name]) {
useInterfaceStore().setLastTimeline(this.$route.name)
}
},
@ -46,10 +49,15 @@ const TimelineMenu = {
const route = this.$route.name
return route === 'lists-timeline'
},
useBookmarkFoldersMenu () {
const route = this.$route.name
return this.bookmarkFolders && (route === 'bookmark-folder' || route === 'bookmarks')
},
...mapState({
currentUser: state => state.users.currentUser,
privateMode: state => state.instance.private,
federating: state => state.instance.federating
federating: state => state.instance.federating,
bookmarkFolders: state => state.instance.pleromaBookmarkFoldersAvailable
}),
timelinesList () {
return filterNavigation(
@ -58,7 +66,8 @@ const TimelineMenu = {
hasChats: this.pleromaChatMessagesAvailable,
isFederating: this.federating,
isPrivate: this.privateMode,
currentUser: this.currentUser
currentUser: this.currentUser,
supportsBookmarkFolders: this.bookmarkFolders
}
)
}
@ -90,7 +99,10 @@ const TimelineMenu = {
if (route === 'lists-timeline') {
return useListsStore().findListTitle(this.$route.params.id)
}
const i18nkey = timelineNames()[this.$route.name]
if (route === 'bookmark-folder') {
return this.$store.getters.findBookmarkFolderName(this.$route.params.id)
}
const i18nkey = timelineNames(this.bookmarkFolders)[this.$route.name]
return i18nkey ? this.$t(i18nkey) : route
}
}

View file

@ -15,6 +15,10 @@
:show-pin="false"
class="timelines"
/>
<BookmarkFoldersMenuContent
v-else-if="useBookmarkFoldersMenu"
class="timelines"
/>
<ul v-else>
<NavigationEntry
v-for="item in timelinesList"
@ -25,8 +29,8 @@
</ul>
</template>
<template #trigger>
<span class="button-unstyled title timeline-menu-title">
<span class="timeline-title">{{ timelineName() }}</span>
<span class="button-unstyled timeline-menu-title">
<h1 class="title timeline-title">{{ timelineName() }}</h1>
<span>
<FAIcon
size="sm"
@ -45,8 +49,6 @@
<script src="./timeline_menu.js"></script>
<style lang="scss">
@import "../../variables";
.timeline-menu-popover {
min-width: 24rem;
max-width: 100vw;
@ -60,65 +62,6 @@
margin: 0;
padding: 0;
}
a {
display: block;
padding: 0 0.65em;
height: 3.5em;
line-height: 3.5em;
&:hover {
background-color: $fallback--lightBg;
background-color: var(--selectedMenu, $fallback--lightBg);
color: $fallback--link;
color: var(--selectedMenuText, $fallback--link);
--faint: var(--selectedMenuFaintText, $fallback--faint);
--faintLink: var(--selectedMenuFaintLink, $fallback--faint);
--lightText: var(--selectedMenuLightText, $fallback--lightText);
--icon: var(--selectedMenuIcon, $fallback--icon);
}
&.router-link-active {
font-weight: bolder;
background-color: $fallback--lightBg;
background-color: var(--selectedMenu, $fallback--lightBg);
color: $fallback--text;
color: var(--selectedMenuText, $fallback--text);
--faint: var(--selectedMenuFaintText, $fallback--faint);
--faintLink: var(--selectedMenuFaintLink, $fallback--faint);
--lightText: var(--selectedMenuLightText, $fallback--lightText);
--icon: var(--selectedMenuIcon, $fallback--icon);
&:hover {
text-decoration: underline;
}
}
svg {
margin-right: 0.4em;
margin-left: -0.2em;
}
}
li {
border-bottom: 1px solid;
border-color: $fallback--border;
border-color: var(--border, $fallback--border);
padding: 0;
&:last-child a {
border-bottom-right-radius: $fallback--panelRadius;
border-bottom-right-radius: var(--panelRadius, $fallback--panelRadius);
border-bottom-left-radius: $fallback--panelRadius;
border-bottom-left-radius: var(--panelRadius, $fallback--panelRadius);
}
&:last-child {
border: none;
}
}
}
.TimelineMenu {
@ -159,8 +102,6 @@
}
&.open .timeline-menu-title svg {
color: $fallback--text;
color: var(--panelText, $fallback--text);
transform: rotate(180deg);
}