Skip to content

Commit

Permalink
Fix reactivity in mobile shares nav
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Mar 11, 2022
1 parent 19acb5e commit 1370c43
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/web-app-files/src/components/AppBar/SharesNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ import {
locationSharesWithMe,
locationSharesWithOthers
} from '../../router/shares'
import { useActiveLocation } from '../../composables'
import { computed, getCurrentInstance, unref } from '@vue/composition-api'
import { useRouter } from 'web-pkg/src/composables'
import { useActiveLocation } from '../../composables'
export default {
setup() {
Expand All @@ -61,24 +61,33 @@ export default {
routes[route.name] = router.getRoutes().find((r) => r.name === route.name)
return routes
}, {})
const sharesWithMeActive = useActiveLocation(isLocationSharesActive, locationSharesWithMe.name)
const sharesWithOthersActive = useActiveLocation(
isLocationSharesActive,
locationSharesWithOthers.name
)
const sharesViaLinkActive = useActiveLocation(
isLocationSharesActive,
locationSharesViaLink.name
)
const navItems = computed(() => [
{
icon: 'share-forward',
to: sharesRoutes[locationSharesWithMe.name].path,
text: $gettext('Shared with me'),
active: unref(useActiveLocation(isLocationSharesActive, locationSharesWithMe.name))
active: unref(sharesWithMeActive)
},
{
icon: 'reply',
to: sharesRoutes[locationSharesWithOthers.name].path,
text: $gettext('Shared with others'),
active: unref(useActiveLocation(isLocationSharesActive, locationSharesWithOthers.name))
active: unref(sharesWithOthersActive)
},
{
icon: 'link',
to: sharesRoutes[locationSharesViaLink.name].path,
text: $gettext('Shared via link'),
active: unref(useActiveLocation(isLocationSharesActive, locationSharesViaLink.name))
active: unref(sharesViaLinkActive)
}
])
return {
Expand Down

0 comments on commit 1370c43

Please sign in to comment.