edit mode

This commit is contained in:
Henry Jameson 2022-08-15 21:56:07 +03:00
parent 96090ea98f
commit 14292d7ed1
4 changed files with 22 additions and 7 deletions

View File

@ -80,7 +80,7 @@ export default (store) => {
{ name: 'lists', path: '/lists', component: Lists }, { name: 'lists', path: '/lists', component: Lists },
{ name: 'lists-timeline', path: '/lists/:id', component: ListsTimeline }, { name: 'lists-timeline', path: '/lists/:id', component: ListsTimeline },
{ name: 'lists-edit', path: '/lists/:id/edit', component: ListsEdit }, { name: 'lists-edit', path: '/lists/:id/edit', component: ListsEdit },
{ name: 'edit-navigation', path: '/nav-edit', component: NavPanel, props: () => ({ forceExpand: true }), beforeEnter: validateAuthenticatedRoute } { name: 'edit-navigation', path: '/nav-edit', component: NavPanel, props: () => ({ forceExpand: true, forceEditMode: true }), beforeEnter: validateAuthenticatedRoute }
] ]
if (store.state.instance.pleromaChatMessagesAvailable) { if (store.state.instance.pleromaChatMessagesAvailable) {

View File

@ -4,6 +4,7 @@ import { TIMELINES, ROOT_ITEMS } from 'src/components/navigation/navigation.js'
import { getListEntries, filterNavigation } from 'src/components/navigation/filter.js' import { getListEntries, filterNavigation } from 'src/components/navigation/filter.js'
import NavigationEntry from 'src/components/navigation/navigation_entry.vue' import NavigationEntry from 'src/components/navigation/navigation_entry.vue'
import NavigationPins from 'src/components/navigation/navigation_pins.vue' import NavigationPins from 'src/components/navigation/navigation_pins.vue'
import Checkbox from 'src/components/checkbox/checkbox.vue'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { import {
@ -34,16 +35,18 @@ library.add(
faList faList
) )
const NavPanel = { const NavPanel = {
props: ['forceExpand'], props: ['forceExpand', 'forceEditMode'],
created () { created () {
}, },
components: { components: {
ListsMenuContent, ListsMenuContent,
NavigationEntry, NavigationEntry,
NavigationPins NavigationPins,
Checkbox
}, },
data () { data () {
return { return {
editMode: false,
showTimelines: false, showTimelines: false,
showLists: false, showLists: false,
timelinesList: Object.entries(TIMELINES).map(([k, v]) => ({ ...v, name: k })), timelinesList: Object.entries(TIMELINES).map(([k, v]) => ({ ...v, name: k })),
@ -57,6 +60,9 @@ const NavPanel = {
toggleLists () { toggleLists () {
this.showLists = !this.showLists this.showLists = !this.showLists
}, },
toggleEditMode () {
this.editMode = !this.editMode
},
toggleCollapse () { toggleCollapse () {
this.$store.commit('setPreference', { path: 'simple.collapseNav', value: !this.collapsed }) this.$store.commit('setPreference', { path: 'simple.collapseNav', value: !this.collapsed })
this.$store.dispatch('pushServerSideStorage') this.$store.dispatch('pushServerSideStorage')

View File

@ -46,7 +46,7 @@
<NavigationEntry <NavigationEntry
v-for="item in timelinesItems" v-for="item in timelinesItems"
:key="item.name" :key="item.name"
:show-pin="true" :show-pin="editMode"
:item="item" :item="item"
/> />
</ul> </ul>
@ -83,7 +83,7 @@
class="timelines-background" class="timelines-background"
> >
<ListsMenuContent <ListsMenuContent
:show-pin="true" :show-pin="editMode"
class="timelines" class="timelines"
/> />
</div> </div>
@ -91,9 +91,17 @@
<NavigationEntry <NavigationEntry
v-for="item in rootItems" v-for="item in rootItems"
:key="item.name" :key="item.name"
:show-pin="true" :show-pin="editMode || forceEditMode"
:item="item" :item="item"
/> />
<div
v-if="!forceEditMode"
class="panel-footer"
>
<Checkbox v-model="editMode">
{{ $t('nav.edit_pinned') }}
</Checkbox>
</div>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -150,7 +150,8 @@
"timelines": "Timelines", "timelines": "Timelines",
"chats": "Chats", "chats": "Chats",
"lists": "Lists", "lists": "Lists",
"edit_nav_mobile": "Customize navigation bar" "edit_nav_mobile": "Customize navigation bar",
"edit_pinned": "Edit pinned items"
}, },
"notifications": { "notifications": {
"broken_favorite": "Unknown status, searching for it…", "broken_favorite": "Unknown status, searching for it…",