Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve mobile view by using horizontal-split mobile layout #3046

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You can also check [on GitHub](https://github.com/nextcloud/news/releases), the
# Unreleased
## [25.x.x]
### Changed

- Set mobileLayout to `horizontal-split` and add nav buttons for articles in mobile view
### Fixed


Expand Down
2 changes: 2 additions & 0 deletions src/components/ContentTemplate.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<NcAppContent :layout="layout"
:show-details="showDetails"
:mobile-layout="'horizontal-split'"
:list-max-width="100"
@update:showDetails="showItem(false)">
<template #list>
Expand All @@ -25,6 +26,7 @@
<div ref="contentElement" class="feed-item-content-wrapper">
<FeedItemDisplay v-if="selectedFeedItem"
:item="selectedFeedItem"
:hide-item-nav="layout === 'no-split'"
@show-details="showItem(false)" />
<NcEmptyContent v-else
style="margin-top: 20vh"
Expand Down
41 changes: 39 additions & 2 deletions src/components/feed-display/FeedItemDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
<ShareItem v-if="showShareMenu" :item-id="item.id" @close="closeShareMenu()" />

<div class="action-bar">
<NcActions v-show="!hideItemNav"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nav items should also not be shown in the screen reader mode, where the DisplayItem is used in the list.

Suggested change
<NcActions v-show="!hideItemNav"
<NcActions v-show="!splitModeOff"

The layout info is already in the component, otherwise you should add the prop also in FeedItemDisplayList where FeedItemDisplay is used for the screen reader mode.

class="action-bar-nav"
:inline="4">
<NcActionButton :title="t('news', 'Previous Item')"
@click="$root.$emit('prev-item')">
{{ t('news', 'Previous') }}
<template #icon>
<ArrowLeftThickIcon />
</template>
</NcActionButton>
<NcActionButton :title="t('news', 'Next Item')"
@click="$root.$emit('next-item')">
{{ t('news', 'Next') }}
<template #icon>
<ArrowRightThickIcon />
</template>
</NcActionButton>
</NcActions>
<NcActions :inline="4">
<NcActionButton :title="t('news', 'Share within Instance')"
@click="showShareMenu = true">
Expand Down Expand Up @@ -152,6 +170,8 @@ import { mapState } from 'vuex'
import ShareVariant from 'vue-material-design-icons/ShareVariant.vue'
import StarIcon from 'vue-material-design-icons/Star.vue'
import CloseIcon from 'vue-material-design-icons/Close.vue'
import ArrowLeftThickIcon from 'vue-material-design-icons/ArrowLeftThick.vue'
import ArrowRightThickIcon from 'vue-material-design-icons/ArrowRightThick.vue'

import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
Expand All @@ -175,6 +195,8 @@ export default Vue.extend({
NcActions,
NcActionButton,
ShareItem,
ArrowLeftThickIcon,
ArrowRightThickIcon,
},
props: {
item: {
Expand All @@ -191,6 +213,10 @@ export default Vue.extend({
required: false,
default: null,
},
hideItemNav: {
type: Boolean,
default: false,
},
},
data: () => {
return {
Expand Down Expand Up @@ -286,7 +312,9 @@ export default Vue.extend({

</script>

<style>
<style lang="scss">
$breakpoint-mobile: 1024px;

.feed-item-display {
overflow-y: hidden;
display: flex;
Expand Down Expand Up @@ -379,7 +407,15 @@ export default Vue.extend({
padding: 10px 20px 0px 20px;

display: flex;
justify-content: right
justify-content: right;
}

.action-bar-nav {
flex-grow: 1;

@media only screen and (width > $breakpoint-mobile) {
display: none !important;
}
}

.feed-item-display .action-bar .button-vue,
Expand All @@ -390,4 +426,5 @@ export default Vue.extend({
min-height: 30px;
height: 30px;
}

</style>
8 changes: 5 additions & 3 deletions src/components/feed-display/FeedItemDisplayList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ export default Vue.extend({
mounted() {
this.mounted = true
this.setupDebouncedClick()
this.$root.$on('next-item', this.jumpToNextItem)
this.$root.$on('prev-item', this.jumpToPreviousItem)
},
methods: {
async refreshApp() {
Expand Down Expand Up @@ -318,12 +320,12 @@ export default Vue.extend({
const element = componentInstance ? componentInstance.$el : undefined

if (element) {
this.$store.commit(MUTATIONS.SET_SELECTED_ITEM, { id: item.id })
this.$store.dispatch(ACTIONS.MARK_READ, { item })
const virtualScroll = this.$refs.virtualScroll
virtualScroll.showElement(element)

}

this.$store.commit(MUTATIONS.SET_SELECTED_ITEM, { id: item.id })
this.$store.dispatch(ACTIONS.MARK_READ, { item })
},
currentIndex(items: FeedItem[]): number {
return this.selectedItem ? items.findIndex((item: FeedItem) => item.id === this.selectedItem.id) || 0 : -1
Expand Down
7 changes: 5 additions & 2 deletions src/components/feed-display/FeedItemRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ export default Vue.extend({

.feed-item-row .title-container.compact {
flex: 0 1 auto;
overflow: unset;
overflow-y: unset;
overflow-x: scroll;
max-width: 100%;
text-overflow: clip;
}

.feed-item-row .intro-container {
Expand All @@ -285,7 +288,7 @@ export default Vue.extend({
}

.feed-item-row .intro-container.compact {
flex: 1 1 auto;
flex: 1 1;
height: 26pt !important;
align-content: center;
text-overflow: ellipsis;
Expand Down