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

Minor design improvements and hint for unpublished polls #3086

Merged
merged 3 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/js/App.vue
Expand Up @@ -24,7 +24,7 @@
<NcContent app-name="polls" :class="appClass">
<router-view v-if="getCurrentUser()" name="navigation" />
<router-view />
<router-view v-show="sideBar.open" name="sidebar" :active="sideBar.activeTab" />
<router-view v-show="sideBar.open" name="sidebar" />
<LoadingOverlay v-if="loading" />
<UserSettingsDlg />
</NcContent>
Expand All @@ -34,7 +34,7 @@
import UserSettingsDlg from './components/Settings/UserSettingsDlg.vue'
import { getCurrentUser } from '@nextcloud/auth'
import { NcContent } from '@nextcloud/vue'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { mapState, mapActions } from 'vuex'
import '@nextcloud/dialogs/dist/index.css'
import './assets/scss/colors.scss'
Expand All @@ -59,7 +59,6 @@ export default {
return {
sideBar: {
open: (window.innerWidth > 920),
activeTab: 'comments',
},
transitionClass: 'transitions-active',
loading: false,
Expand Down Expand Up @@ -121,7 +120,7 @@ export default {
})

subscribe('polls:sidebar:toggle', (payload) => {
this.sideBar.activeTab = payload?.activeTab ?? this.sideBar.activeTab
emit('polls:sidebar:changeTab', { activeTab: payload.activeTab })
this.sideBar.open = payload?.open ?? !this.sideBar.open
})
},
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Options/Counter.vue
Expand Up @@ -65,7 +65,7 @@ export default {
display: flex;
align-items: center;
justify-content: space-around;
gap: 4px;
gap: 4px 16px;
padding: 0 12px;
font-size: 1.1em;

Expand Down
1 change: 1 addition & 0 deletions src/js/components/Options/OptionItem.vue
Expand Up @@ -253,6 +253,7 @@ export default {
justify-content: flex-start;
text-align: center;
hyphens: auto;
white-space: nowrap !important;
}

.event-date {
Expand Down
3 changes: 1 addition & 2 deletions src/js/components/Poll/PollInfoLine.vue
Expand Up @@ -82,8 +82,7 @@ export default {
subTexts.push({
id: 'no-access',
text: [
t('polls', 'This poll is unpublished'),
t('polls', 'Invite users via the share tab in the sidebar'),
t('polls', 'Unpublished'),
].join('. '),
class: 'unpublished',
iconComponent: unpublishedIcon,
Expand Down
14 changes: 10 additions & 4 deletions src/js/components/VoteTable/VoteTable.vue
Expand Up @@ -116,6 +116,7 @@ export default {
border-radius: 12px;
&.currentuser {
order:5;
margin-bottom: 30px;
}
}

Expand Down Expand Up @@ -153,22 +154,22 @@ export default {
.vote-column {
order: 2;
display: flex;
flex: 1 0 85px;
flex: 1 0 11em;
flex-direction: column;
align-items: stretch;
max-width: 280px;
max-width: 19em;
margin-bottom: 4px;

&>div {
display: flex;
justify-content: space-around;
justify-content: center;
align-items: center;
}
.option-item {
align-items: stretch;
flex: 1;
order: 1;
}

}

&.closed .vote-column {
Expand Down Expand Up @@ -233,6 +234,10 @@ export default {

.option-item .option-item__option--text {
text-align: center;
/* Notice: https://caniuse.com/css-text-wrap-balance */
text-wrap: balance;
hyphens: auto;
padding: 0 0.6em;
}
}

Expand All @@ -241,6 +246,7 @@ export default {

.vote-column {
flex-direction: row-reverse;
flex: 1 5.5em;
align-items: center;
max-width: initial;
position: relative;
Expand Down
36 changes: 17 additions & 19 deletions src/js/views/SideBar.vue
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<NcAppSidebar :active="active"
<NcAppSidebar :active.sync="activeTab"
:title="t('polls', 'Details')"
@close="closeSideBar()">
<NcAppSidebarTab v-if="acl.allowEdit"
Expand Down Expand Up @@ -84,29 +84,17 @@
<script>
import { NcAppSidebar, NcAppSidebarTab } from '@nextcloud/vue'
import { mapState } from 'vuex'
import { emit } from '@nextcloud/event-bus'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import SidebarConfigurationIcon from 'vue-material-design-icons/Wrench.vue'
import SidebarOptionsIcon from 'vue-material-design-icons/FormatListChecks.vue'
import SidebarShareIcon from 'vue-material-design-icons/ShareVariant.vue'
import SidebarCommentsIcon from 'vue-material-design-icons/CommentProcessing.vue'
import SidebarActivityIcon from 'vue-material-design-icons/LightningBolt.vue'
// test static loading
// import SideBarTabConfiguration from '../components/SideBar/SideBarTabConfiguration.vue'
// import SideBarTabComments from '../components/SideBar/SideBarTabComments.vue'
// import SideBarTabOptions from '../components/SideBar/SideBarTabOptions.vue'
// import SideBarTabShare from '../components/SideBar/SideBarTabShare.vue'
// import SideBarTabActivity from '../components/SideBar/SideBarTabActivity.vue'

export default {
name: 'SideBar',

components: {
// test static loading
// SideBarTabConfiguration,
// SideBarTabComments,
// SideBarTabOptions,
// SideBarTabShare,
// SideBarTabActivity,
SideBarTabConfiguration: () => import('../components/SideBar/SideBarTabConfiguration.vue'),
SideBarTabComments: () => import('../components/SideBar/SideBarTabComments.vue'),
SideBarTabOptions: () => import('../components/SideBar/SideBarTabOptions.vue'),
Expand All @@ -121,11 +109,10 @@ export default {
SidebarCommentsIcon,
},

props: {
active: {
type: String,
default: t('polls', 'Comments').toLowerCase(),
},
data() {
return {
activeTab: t('polls', 'Comments').toLowerCase(),
}
},

computed: {
Expand All @@ -135,6 +122,17 @@ export default {
useActivity: (state) => state.appSettings.useActivity,
useCollaboration: (state) => state.appSettings.useCollaboration,
}),

},

created() {
subscribe('polls:sidebar:changeTab', (payload) => {
this.activeTab = payload?.activeTab ?? this.activeTab
})
},

beforeDestroy() {
unsubscribe('polls:sidebar:changeTab')
},

methods: {
Expand Down
19 changes: 19 additions & 0 deletions src/js/views/Vote.vue
Expand Up @@ -33,6 +33,16 @@
</HeaderBar>

<div class="vote_main">
<CardDiv v-if="isNoAccessSet && options.length" type="warning">
{{ t('polls', 'This poll is unpublished.') }}
{{ t('polls', 'Invite users or allow internal access for all site users.') }}
<template #button>
<NcButton type="primary" @click="openShares">
{{ t('polls', 'Edit access') }}
</NcButton>
</template>
</CardDiv>

<div v-if="poll.description" class="area__description">
<MarkUpDescription />
</div>
Expand Down Expand Up @@ -144,8 +154,13 @@ export default {
countHiddenParticipants: 'poll/countHiddenParticipants',
safeTable: 'poll/safeTable',
confirmedOptions: 'options/confirmed',
hasShares: 'shares/hasShares',
}),

isNoAccessSet() {
return this.poll.access === 'private' && !this.hasShares && this.acl.allowEdit
},

showConfirmationMail() {
return this.acl.isOwner && this.closed && this.confirmedOptions.length > 0
},
Expand Down Expand Up @@ -191,6 +206,10 @@ export default {
openOptions() {
emit('polls:sidebar:toggle', { open: true, activeTab: 'options' })
},

openShares() {
emit('polls:sidebar:toggle', { open: true, activeTab: 'sharing' })
},
},
}

Expand Down