-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: browse poll drafts from poll editor and shared items
Signed-off-by: Maksim Sukharev <[email protected]>
- Loading branch information
Showing
5 changed files
with
174 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!-- | ||
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
- SPDX-License-Identifier: AGPL-3.0-or-later | ||
--> | ||
|
||
<template> | ||
<NcDialog class="drafts" | ||
:name="t('spreed', 'Poll drafts')" | ||
size="large" | ||
close-on-click-outside | ||
v-on="$listeners" | ||
@update:open="emit('close')"> | ||
<EmptyView v-if="!pollDrafts.length" | ||
class="drafts__empty" | ||
:name="t('spreed', 'No poll drafts')" | ||
:description="t('spreed', 'There is no poll drafts yet saved for this conversation')"> | ||
<template #icon> | ||
<IconPoll /> | ||
</template> | ||
</EmptyView> | ||
<div v-else class="drafts__wrapper"> | ||
<Poll v-for="item in pollDrafts" | ||
:id="item.id.toString()" | ||
:key="item.id" | ||
:token="token" | ||
:name="item.question" | ||
draft /> | ||
</div> | ||
</NcDialog> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
|
||
import IconPoll from 'vue-material-design-icons/Poll.vue' | ||
|
||
import { t } from '@nextcloud/l10n' | ||
|
||
import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js' | ||
|
||
import EmptyView from '../EmptyView.vue' | ||
import Poll from '../MessagesList/MessagesGroup/Message/MessagePart/Poll.vue' | ||
|
||
import { useStore } from '../../composables/useStore.js' | ||
import { hasTalkFeature } from '../../services/CapabilitiesManager.ts' | ||
import { usePollsStore } from '../../stores/polls.ts' | ||
|
||
const props = defineProps<{ | ||
token: string, | ||
}>() | ||
const emit = defineEmits<{ | ||
(event: 'close'): void, | ||
}>() | ||
|
||
const supportPollDrafts = hasTalkFeature(props.token, 'talk-polls-drafts') | ||
const store = useStore() | ||
const pollsStore = usePollsStore() | ||
/** | ||
* Receive poll drafts for the current conversation as owner/moderator | ||
*/ | ||
const isModerator = computed(() => (store.getters as unknown).isModerator) | ||
if (supportPollDrafts && isModerator.value) { | ||
pollsStore.getPollDrafts(props.token) | ||
} | ||
const pollDrafts = computed(() => supportPollDrafts ? pollsStore.getDrafts(props.token) : []) | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.drafts { | ||
:deep(.dialog__content) { | ||
min-height: 200px; | ||
} | ||
|
||
&__wrapper { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; | ||
grid-gap: var(--default-grid-baseline); | ||
} | ||
|
||
&__empty { | ||
margin: 0 !important; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters