Skip to content

Commit ab2d9ef

Browse files
authored
Merge pull request #4175 from nextcloud/fix/visual-issues
fixing minor and major visual issues
2 parents a013711 + 6536aed commit ab2d9ef

9 files changed

Lines changed: 121 additions & 79 deletions

File tree

src/App.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ onUnmounted(() => {
129129
.app-content {
130130
display: flex;
131131
flex-direction: column;
132-
padding: 0px 8px;
133-
row-gap: 8px;
134132
135133
.clamped {
136134
display: -webkit-box !important;

src/components/Base/modules/HeaderBar.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ function toggleClamp() {
4343
}
4444
4545
.header_bar {
46-
margin-inline: -8px;
4746
padding-inline: 56px 8px;
4847
background-color: var(--color-main-background);
4948
transition: all var(--animation-slow) linear;
@@ -88,7 +87,7 @@ function toggleClamp() {
8887
}
8988
9089
.header_bar_bottom {
91-
margin-bottom: 1rem;
90+
padding-bottom: 1rem;
9291
}
9392
9493
[class*='bar_'] {

src/components/Base/modules/IntersectionObserver.vue

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ import { onBeforeUnmount, onMounted, ref } from 'vue'
88
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
99
1010
// const model = ref(false)
11+
interface Props {
12+
orientation?: 'horizontal' | 'vertical'
13+
loading?: boolean
14+
}
15+
const { orientation = 'horizontal', loading = false } = defineProps<Props>()
16+
1117
const model = defineModel<boolean>()
1218
1319
const observer = ref<null | IntersectionObserver>(null)
1420
1521
const observerTarget = ref<null | Element>(null)
1622
const emit = defineEmits(['visible', 'invisible'])
1723
18-
const { loading = false } = defineProps<{ loading?: boolean }>()
19-
2024
onMounted(() => {
2125
const observer = new IntersectionObserver((entries) => {
2226
entries.forEach((entry) => {
@@ -41,8 +45,26 @@ onBeforeUnmount(() => {
4145
</script>
4246

4347
<template>
44-
<div ref="observerTarget">
48+
<div
49+
ref="observerTarget"
50+
:class="{
51+
'horizontal-fixed': orientation === 'horizontal',
52+
'vertical-fixed': orientation === 'vertical',
53+
}">
4554
<NcLoadingIcon v-if="loading" :size="15" />
4655
<slot v-else :in-viewport="model" />
4756
</div>
4857
</template>
58+
59+
<style lang="css" scoped>
60+
.vertical-fixed {
61+
position: sticky;
62+
top: 0;
63+
height: 100%;
64+
}
65+
.horizontal-fixed {
66+
position: sticky;
67+
left: 0;
68+
width: 100%;
69+
}
70+
</style>

src/components/Base/modules/StickyDiv.vue

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,48 @@
77
import { computed } from 'vue'
88
99
interface Props {
10-
stickyTop?: boolean
11-
stickyLeft?: boolean
1210
activateBottomShadow?: boolean
1311
activateRightShadow?: boolean
12+
stickyTop?: boolean
13+
stickyLeft?: boolean
14+
zIndex?: number
1415
}
1516
1617
const {
17-
stickyTop = false,
18-
stickyLeft = false,
1918
activateBottomShadow = false,
2019
activateRightShadow = false,
20+
stickyTop = false,
21+
stickyLeft = false,
22+
zIndex = undefined,
2123
} = defineProps<Props>()
2224
25+
const style = computed(() => {
26+
if (zIndex !== undefined && zIndex !== null) {
27+
return {
28+
'z-index': zIndex,
29+
}
30+
}
31+
if (stickyTop && stickyLeft) {
32+
return {
33+
'z-index': 6,
34+
}
35+
}
36+
37+
if (stickyLeft) {
38+
return {
39+
'z-index': 5,
40+
}
41+
}
42+
43+
if (stickyTop) {
44+
return {
45+
'z-index': 4,
46+
}
47+
}
48+
49+
return {}
50+
})
51+
2352
const stickyClass = computed(() => ({
2453
container: true,
2554
'sticky-top': stickyTop,
@@ -30,7 +59,7 @@ const stickyClass = computed(() => ({
3059
</script>
3160

3261
<template>
33-
<div :class="stickyClass">
62+
<div :class="stickyClass" :style="style">
3463
<slot name="default">
3564
<div class="inner"></div>
3665
</slot>
@@ -51,14 +80,12 @@ const stickyClass = computed(() => ({
5180
.sticky-left {
5281
position: sticky;
5382
left: 0;
54-
z-index: 5;
5583
}
5684
5785
.sticky-top {
5886
--shadow-height: 10px;
5987
position: sticky;
6088
top: 0;
61-
z-index: 4;
6289
padding-bottom: 0px;
6390
padding-bottom: var(--shadow-height);
6491
@@ -89,10 +116,6 @@ const stickyClass = computed(() => ({
89116
}
90117
}
91118
92-
.sticky-top.sticky-left {
93-
z-index: 7;
94-
}
95-
96119
/* TODO: Implement sticky right shadow
97120
An Alternative could be using a grid instead of ::after
98121
to be able to position multiple shadows in all directions */

src/components/VoteTable/VoteColumn.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ import OptionItem from '../Options/OptionItem.vue'
1212
import VoteItem from './VoteItem.vue'
1313
import CalendarPeek from '../Calendar/CalendarPeek.vue'
1414
import { usePollStore } from '../../stores/poll.ts'
15+
import { useVotesStore } from '../../stores/votes.ts'
1516
import { usePreferencesStore } from '../../stores/preferences.ts'
1617
import { Option } from '../../stores/options.ts'
1718
import OptionMenu from '../Options/OptionMenu.vue'
1819
1920
const { option } = defineProps<{ option: Option }>()
2021
2122
const pollStore = usePollStore()
23+
const votesStore = useVotesStore()
2224
const preferencesStore = usePreferencesStore()
2325
2426
const componentClass = computed(() => {
@@ -65,7 +67,7 @@ const showCalendarPeek = computed(
6567
</div>
6668

6769
<VoteItem
68-
v-for="participant in pollStore.safeParticipants"
70+
v-for="participant in votesStore.getChunkedParticipants"
6971
:key="participant.id"
7072
:user="participant"
7173
:option="option" />

src/components/VoteTable/VoteTable.vue

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const { downPage = false } = defineProps<{ downPage: boolean }>()
3939
const chunksLoading = ref(false)
4040
4141
const tableStyle = computed(() => ({
42-
'--participants-count': `${pollStore.safeParticipants.length}`,
42+
'--participants-count': `${votesStore.getChunkedParticipants.length}`,
4343
'--options-count': `${optionsStore.options.length}`,
4444
}))
4545
@@ -73,7 +73,7 @@ function isVotable(participant: User, option: Option) {
7373
class="vote-table"
7474
:style="tableStyle">
7575
<StickyDiv
76-
v-if="pollStore.viewMode === 'table-view'"
76+
v-show="pollStore.viewMode === 'table-view'"
7777
key="grid-info"
7878
sticky-left
7979
class="grid-info">
@@ -90,7 +90,7 @@ function isVotable(participant: User, option: Option) {
9090
</StickyDiv>
9191

9292
<StickyDiv
93-
v-if="pollStore.viewMode === 'table-view'"
93+
v-show="pollStore.viewMode === 'table-view'"
9494
:id="`option-item-spacer`"
9595
class="option-item-spacer"
9696
sticky-top
@@ -100,19 +100,22 @@ function isVotable(participant: User, option: Option) {
100100

101101
<StickyDiv
102102
v-if="pollStore.permissions.seeResults"
103+
v-show="pollStore.viewMode === 'table-view'"
103104
sticky-left
104105
class="counter-spacer" />
105106

106107
<StickyDiv
107-
v-for="participant in pollStore.safeParticipants"
108+
v-for="participant in votesStore.getChunkedParticipants"
108109
:key="participant.id"
109110
class="participant"
110111
sticky-left>
111112
<VoteParticipant :user="participant" />
112113
</StickyDiv>
113114

114115
<template v-for="option in optionsStore.orderedOptions" :key="option.id">
115-
<div v-if="pollStore.viewMode === 'table-view'" class="option-menu-grid">
116+
<div
117+
v-show="pollStore.viewMode === 'table-view'"
118+
class="option-menu-grid">
116119
<CalendarPeek
117120
v-if="showCalendarPeek"
118121
:id="`peek-${option.id}`"
@@ -131,7 +134,7 @@ function isVotable(participant: User, option: Option) {
131134
<StickyDiv
132135
:id="`option-item-${option.id}`"
133136
class="option-item"
134-
sticky-top
137+
:sticky-top="pollStore.viewMode === 'table-view'"
135138
:activate-bottom-shadow="!downPage">
136139
<OptionItem :option="option" />
137140
</StickyDiv>
@@ -144,7 +147,7 @@ function isVotable(participant: User, option: Option) {
144147
:option="option" />
145148

146149
<div
147-
v-for="participant in pollStore.safeParticipants"
150+
v-for="participant in votesStore.getChunkedParticipants"
148151
:key="participant.id"
149152
class="vote-cell"
150153
:class="{ 'current-user': isCurrentUser(participant) }">
@@ -175,6 +178,7 @@ function isVotable(participant: User, option: Option) {
175178
grid-auto-rows: auto;
176179
grid-auto-flow: column;
177180
overflow: scroll;
181+
margin: auto;
178182
179183
.vote-cell {
180184
padding: 0.4rem;
@@ -192,6 +196,11 @@ function isVotable(participant: User, option: Option) {
192196
visibility: hidden;
193197
}
194198
199+
&.sticky-left {
200+
left: -8px;
201+
padding-left: 8px;
202+
}
203+
195204
&:hover {
196205
background: var(--color-background-hover);
197206
@@ -223,7 +232,6 @@ function isVotable(participant: User, option: Option) {
223232
overflow: visible;
224233
min-width: min-content;
225234
max-width: max-content;
226-
margin: auto;
227235
.grid-info {
228236
grid-row: 1;
229237
grid-column: 1;
@@ -295,14 +303,15 @@ function isVotable(participant: User, option: Option) {
295303
}
296304
297305
&.list-view {
298-
grid-template-columns: auto 5rem 5rem;
306+
row-gap: 8px;
307+
grid-template-columns:
308+
minmax(11rem, max-content)
309+
minmax(4rem, max-content)
310+
minmax(4rem, max-content);
299311
max-width: var(--cap-width);
312+
width: fit-content;
300313
301-
.grid-info,
302-
.option-spacer,
303-
.counter-spacer,
304-
.participant,
305-
.option-menu-grid {
314+
.participant {
306315
display: none;
307316
}
308317

src/stores/poll.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,6 @@ export const usePollStore = defineStore('poll', {
263263
return [noString, 'yes']
264264
},
265265

266-
safeParticipants(): User[] {
267-
const sessionStore = useSessionStore()
268-
const votesStore = useVotesStore()
269-
if (this.viewMode === 'list-view') {
270-
return [sessionStore.currentUser]
271-
}
272-
return votesStore.getChunkedParticipants
273-
},
274-
275266
getProposalsOptions(): {
276267
value: AllowProposals
277268
label: string

src/stores/votes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ export const useVotesStore = defineStore('votes', {
9494
* @return
9595
*/
9696
getChunkedParticipants(state): User[] {
97+
const sessionStore = useSessionStore()
98+
const pollStore = usePollStore()
99+
if (pollStore.viewMode === 'list-view') {
100+
return [sessionStore.currentUser]
101+
}
102+
97103
if (
98104
this.participants.length > state.meta.chunks.size
99105
&& this.participants.length

0 commit comments

Comments
 (0)