-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wip] feat(calendar): add dialog for meetings overview
Signed-off-by: Maksim Sukharev <[email protected]>
- Loading branch information
Showing
4 changed files
with
156 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<!-- | ||
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
- SPDX-License-Identifier: AGPL-3.0-or-later | ||
--> | ||
|
||
<script setup lang="ts"> | ||
import { computed, onBeforeMount, ref } from 'vue' | ||
|
||
import IconCalendarBlank from 'vue-material-design-icons/CalendarBlank.vue' | ||
|
||
import { showError, showSuccess } from '@nextcloud/dialogs' | ||
import { t, n } from '@nextcloud/l10n' | ||
|
||
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' | ||
import NcDateTimePickerNative from '@nextcloud/vue/dist/Components/NcDateTimePickerNative.js' | ||
import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js' | ||
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js' | ||
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js' | ||
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js' | ||
import usernameToColor from '@nextcloud/vue/dist/Functions/usernameToColor.js' | ||
|
||
import { useGroupwareStore } from '../stores/groupware.ts' | ||
|
||
const props = defineProps<{ | ||
token: string, | ||
container?: string, | ||
}>() | ||
const emit = defineEmits<{ | ||
(event: 'close'): void, | ||
}>() | ||
|
||
const groupwareStore = useGroupwareStore() | ||
|
||
const loading = ref(groupwareStore.calendars.length === 0) | ||
const upcomingEvents = computed(() => { | ||
return groupwareStore.getAllEvents(props.token) | ||
}) | ||
|
||
const selectedCalendar = ref(null) | ||
const calendarOptions = computed(() => { | ||
return groupwareStore.calendars.map(calendar => { | ||
return { | ||
value: calendar.uri, | ||
label: calendar.name, | ||
style: `background-color: ${calendar.color ?? usernameToColor(calendar.uri).color}`, | ||
} | ||
}) | ||
}) | ||
|
||
onBeforeMount(() => { | ||
getCalendars() | ||
}) | ||
|
||
/** | ||
* | ||
*/ | ||
async function getCalendars() { | ||
await groupwareStore.getPersonalCalendars() | ||
loading.value = false | ||
} | ||
</script> | ||
|
||
<template> | ||
<NcDialog class="calendar-events" | ||
:name="t('spreed', 'Upcoming events')" | ||
size="normal" | ||
close-on-click-outside | ||
:container="container" | ||
@update:open="emit('close')"> | ||
<template v-if="!loading && upcomingEvents.length"> | ||
<ul> | ||
<li v-for="event in upcomingEvents" :key="event.uri"> | ||
<a :href="event.calendarAppUrl" target="_blank">{{ event.summary }}</a> | ||
</li> | ||
</ul> | ||
</template> | ||
<NcEmptyContent v-else> | ||
<template #icon> | ||
<NcLoadingIcon v-if="loading" /> | ||
<IconCalendarBlank v-else /> | ||
</template> | ||
|
||
<template #description> | ||
<p>{{ loading ? t('spreed', 'Loading …') : t('spreed', 'No upcoming events') }}</p> | ||
</template> | ||
</NcEmptyContent> | ||
<NcSelect id="schedule_meeting_select" | ||
v-model="selectedCalendar" | ||
:options="calendarOptions" | ||
:placeholder="t('spreed', 'Select calendar …')"> | ||
<template #option="option"> | ||
<span class="select-option_badge" :style="option.style" /> | ||
{{ option.label }} | ||
</template> | ||
</NcSelect> | ||
<!-- <NcDateTimePickerNative id="schedule_meeting_input" ></NcDateTimePickerNative>--> | ||
<template #actions> | ||
<NcButton type="primary" | ||
@click="emit('close')"> | ||
{{ t('spreed', 'Schedule a meeting') }} | ||
</NcButton> | ||
</template> | ||
</NcDialog> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.calendar-events { | ||
} | ||
|
||
.select-option_badge { | ||
display: inline-block; | ||
width: var(--default-font-size); | ||
height: var(--default-font-size); | ||
border-radius: 50%; | ||
background-color: var(--primary-color); | ||
} | ||
</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
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