Skip to content

Commit 25b1f6f

Browse files
authored
Merge pull request #4394 from nextcloud/ref/tidy-css
Some frontend changes
2 parents 39c2e86 + a0d1798 commit 25b1f6f

9 files changed

Lines changed: 195 additions & 155 deletions

File tree

src/assets/scss/hacks.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
*/
55
// some hacks, do alter the display of third parity components
66

7+
// FIXME: remove this hack after the issue is fixed
8+
// make sure selects are 100% width in config box
9+
.config-box .v-select {
10+
width: 100%;
11+
}
12+
713
// FIXME: remove this hack after the issue is fixed
814
// limit the width of the user bubble to prevent it from overflowing
915
.user-bubble__name {

src/components/Base/modules/Collapsible.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ const containerClass = computed(() => ({
222222
.collapsible_container {
223223
position: relative;
224224
overflow: auto;
225-
width: 100%;
226225
transition: height 0.3s ease;
227226
padding-inline-end: 8px;
228227

src/components/Base/modules/ConfigBox.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ const { name, info = '', indented = false } = defineProps<Props>()
4848
4949
&__container {
5050
grid-area: container;
51-
& > * {
52-
width: 100%;
53-
}
5451
}
5552
5653
.indented {

src/components/PollList/PollItem.vue

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ const expirationDateTime = computed(() =>
4444
DateTime.fromMillis(poll.configuration.expire * 1000),
4545
)
4646
47-
const createdDateTime = computed(() =>
48-
DateTime.fromMillis(poll.status.created * 1000),
49-
)
50-
5147
const archiveDateTime = computed(() =>
5248
DateTime.fromMillis(poll.status.archivedDate * 1000),
5349
)
@@ -75,25 +71,48 @@ const expiryClass = computed(() => {
7571
return 'success'
7672
})
7773
78-
const descriptionLine = computed(() => {
79-
if (preferencesStore.user.verbosePollsList) {
80-
if (poll.configuration.description) {
81-
return poll.configuration.description
74+
const pollDetails = computed(() => {
75+
if (noLink || !poll.permissions.view) {
76+
return {
77+
iconComponent: LockPollIcon,
78+
title: t('polls', 'No access'),
79+
description: t('polls', 'No access to this poll of {ownerName}.', {
80+
ownerName: poll.owner.displayName,
81+
}),
8282
}
83-
return t('polls', 'No description provided')
8483
}
85-
8684
if (poll.status.isArchived) {
87-
return t('polls', 'Archived {relativeTime}', {
88-
relativeTime: archiveDateTime.value.toRelative() as string,
89-
})
85+
return {
86+
iconComponent: ArchivedPollIcon,
87+
title: t('polls', 'Archived poll'),
88+
description: t('polls', 'Archived {relativeTime}', {
89+
relativeTime: archiveDateTime.value.toRelative() as string,
90+
}),
91+
}
92+
}
93+
if (poll.configuration.access === 'private') {
94+
return {
95+
iconComponent: PrivatePollIcon,
96+
title: t('polls', 'Private poll'),
97+
description: t(
98+
'polls',
99+
'Private poll, only invited participants have access',
100+
),
101+
}
102+
}
103+
return {
104+
iconComponent: OpenPollIcon,
105+
title: t('polls', 'Openly accessible poll'),
106+
description: t(
107+
'polls',
108+
'Open poll, accessible to all users of this instance and invited participants',
109+
),
90110
}
91-
92-
return t('polls', 'Started {relativeTime} from {ownerName}', {
93-
ownerName: poll.owner.displayName,
94-
relativeTime: createdDateTime.value.toRelative() as string,
95-
})
96111
})
112+
113+
const descriptionLine = computed(
114+
() => poll.configuration.description || pollDetails.value.description,
115+
)
97116
</script>
98117

99118
<template>
@@ -113,7 +132,7 @@ const descriptionLine = computed(() => {
113132
</div>
114133

115134
<div class="description_line">
116-
<LockPollIcon :size="16" />
135+
<component :is="pollDetails.iconComponent" :size="16" />
117136
<div class="description">
118137
{{
119138
t('polls', 'No access to this poll of {ownerName}.', {
@@ -143,27 +162,10 @@ const descriptionLine = computed(() => {
143162
</div>
144163

145164
<div class="description_line">
146-
<ArchivedPollIcon
147-
v-if="
148-
!preferencesStore.user.verbosePollsList
149-
&& poll.status.isArchived
150-
"
151-
:title="t('polls', 'Archived poll')"
152-
:size="16" />
153-
<OpenPollIcon
154-
v-else-if="
155-
!preferencesStore.user.verbosePollsList
156-
&& poll.configuration.access === 'open'
157-
"
158-
:title="t('polls', 'Openly accessible poll')"
159-
:size="16" />
160-
<PrivatePollIcon
161-
v-else-if="
162-
!preferencesStore.user.verbosePollsList
163-
&& poll.configuration.access === 'private'
164-
"
165-
:title="t('polls', 'Private poll')"
166-
:size="16" />
165+
<component
166+
:is="pollDetails.iconComponent"
167+
:size="16"
168+
:title="pollDetails.title" />
167169

168170
<span class="description">
169171
{{ descriptionLine }}
@@ -322,6 +324,9 @@ const descriptionLine = computed(() => {
322324
justify-content: space-between;
323325
}
324326
.description_line {
327+
display: grid;
328+
grid-template-columns: max-content 1fr;
329+
gap: 0.25rem;
325330
opacity: 0.5;
326331
}
327332
.badges {

src/components/Settings/AdminSettings/AdminJobs.vue

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,28 @@ async function loadJobs() {
118118
Logger.error('Error on fetching jobs list', { error })
119119
}
120120
}
121+
122+
function jobStatus(job: Job) {
123+
if (executedJobs.value.has(job.name)) {
124+
return {
125+
component: JobExecutedIcon,
126+
title: t('polls', '{jobName} has been executed.', { jobName: job.name }),
127+
}
128+
}
129+
if (job.manuallyRunnable) {
130+
return {
131+
component: PlayIcon,
132+
title: t('polls', 'Start {jobName} manually.', { jobName: job.name }),
133+
}
134+
}
135+
return {
136+
component: NotSupportedIcon,
137+
title: t('polls', '{jobName} does not support manually run.', {
138+
jobName: job.name,
139+
}),
140+
}
141+
}
142+
121143
/**
122144
* fetch the jobs list on component mount
123145
*/
@@ -158,29 +180,9 @@ onMounted(() => {
158180
:aria-label="t('polls', 'Request job execution')"
159181
@click="runJob(job)">
160182
<template #icon>
161-
<JobExecutedIcon
162-
v-if="executedJobs.has(job.name)"
163-
:title="
164-
t('polls', '{jobName} has been executed.', {
165-
jobName: job.name,
166-
})
167-
" />
168-
<PlayIcon
169-
v-else-if="job.manuallyRunnable"
170-
:title="
171-
t('polls', 'Start {jobName} manually.', {
172-
jobName: job.name,
173-
})
174-
" />
175-
<NotSupportedIcon
176-
v-else
177-
:title="
178-
t(
179-
'polls',
180-
'{jobName} does not support manually run.',
181-
{ jobName: job.name },
182-
)
183-
" />
183+
<component
184+
:is="jobStatus(job).component"
185+
:title="jobStatus(job).title" />
184186
</template>
185187
</NcActionButton>
186188
</template>

src/components/Shares/ShareItem.vue

Lines changed: 80 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import ShareMenu from './ShareMenu.vue'
1515
1616
import type { Share } from '../../stores/shares.types'
1717
import { AvatarTypeIcon } from '../User/UserAvatar.types'
18+
import AdminIcon from 'vue-material-design-icons/ShieldCrownOutline.vue'
19+
import ContactIcon from 'vue-material-design-icons/CardAccountDetailsOutline.vue'
20+
import EmailIcon from 'vue-material-design-icons/EmailOutline.vue'
21+
import ShareIcon from 'vue-material-design-icons/ShareVariantOutline.vue'
22+
import PollGroupIcon from 'vue-material-design-icons/CodeBraces.vue'
1823
1924
const emit = defineEmits(['showQrCode'])
2025
@@ -27,6 +32,8 @@ const publicShareDescription = computed(() => {
2732
return t('polls', 'Public link: {token}', { token: share.user.id })
2833
})
2934
35+
const typeIconSize = 16
36+
3037
const userDescription = computed(() => {
3138
if (share.groupId && !share.pollId) {
3239
return t('polls', 'Poll group access')
@@ -53,13 +60,6 @@ const userDescription = computed(() => {
5360
return ''
5461
})
5562
56-
const computedTypeIcon = computed<AvatarTypeIcon>(() => {
57-
if (share.groupId && !share.pollId) {
58-
return 'pollGroupIcon'
59-
}
60-
return true
61-
})
62-
6363
const label = ref({
6464
inputValue: '',
6565
inputProps: {
@@ -71,6 +71,67 @@ const label = ref({
7171
},
7272
})
7373
74+
const computedTypeIcon = computed<AvatarTypeIcon>(() => {
75+
if (share.groupId && !share.pollId) {
76+
return 'pollGroupIcon'
77+
}
78+
return share.type
79+
})
80+
81+
const typeIconComponent = computed(() => {
82+
switch (computedTypeIcon.value) {
83+
case 'admin':
84+
return AdminIcon
85+
case 'contact':
86+
return ContactIcon
87+
case 'email':
88+
return EmailIcon
89+
case 'external':
90+
return ShareIcon
91+
case 'pollGroupIcon':
92+
return PollGroupIcon
93+
default:
94+
return null
95+
}
96+
})
97+
98+
// const votedIndicator = computed(() => {
99+
// if (share.voted) {
100+
// return {
101+
// class: 'vote-status voted',
102+
// component: VotedIcon,
103+
// name: t('polls', 'Has voted'),
104+
// }
105+
// }
106+
// if (!share.voted) {
107+
// return {
108+
// class: 'vote-status unvoted',
109+
// component: UnvotedIcon,
110+
// name: t('polls', 'Has not voted'),
111+
// }
112+
// }
113+
// return { class: 'vote-status empty', component: null, name: '' }
114+
// })
115+
116+
const votedIndicator = computed(() => {
117+
if (share.groupId || ['public', 'group'].includes(share.type)) {
118+
return { class: 'vote-status empty', component: 'div', name: '' }
119+
}
120+
if (share.voted) {
121+
return {
122+
class: 'vote-status voted',
123+
component: VotedIcon,
124+
name: t('polls', 'Has voted'),
125+
}
126+
}
127+
128+
return {
129+
class: 'vote-status unvoted',
130+
component: UnvotedIcon,
131+
name: t('polls', 'Has not voted'),
132+
}
133+
})
134+
74135
onMounted(() => {
75136
label.value.inputValue = share.label
76137
})
@@ -82,21 +143,21 @@ onMounted(() => {
82143
:class="{ deleted: share.deleted }"
83144
:user="share.user"
84145
show-email
85-
:type-icon="computedTypeIcon"
86146
:description="userDescription"
87147
:label="share.label">
148+
<template #typeIcon>
149+
<component
150+
:is="typeIconComponent"
151+
v-if="typeIconComponent"
152+
:size="typeIconSize" />
153+
</template>
154+
88155
<template #status>
89-
<div
90-
v-if="share.groupId || ['public', 'group'].includes(share.type)"
91-
class="vote-status empty" />
92-
<VotedIcon
93-
v-else-if="share.voted"
94-
class="vote-status voted"
95-
:name="t('polls', 'Has voted')" />
96-
<UnvotedIcon
97-
v-else
98-
class="vote-status unvoted"
99-
:name="t('polls', 'Has not voted')" />
156+
<component
157+
:is="votedIndicator.component"
158+
v-if="votedIndicator.component"
159+
:class="votedIndicator.class"
160+
:title="votedIndicator.name" />
100161
</template>
101162

102163
<ShareMenu :share="share" @show-qr-code="emit('showQrCode')" />

src/components/User/UserAvatar.types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
export type AvatarTypeIcon = boolean | 'pollGroupIcon'
6+
import { ShareType } from '@/stores/shares.types'
7+
8+
export type AvatarTypeIcon = ShareType | 'pollGroupIcon'

0 commit comments

Comments
 (0)