Skip to content

Commit

Permalink
fixup! feat:select existing talk roomfor convesations
Browse files Browse the repository at this point in the history
Signed-off-by: greta <[email protected]>
  • Loading branch information
GretaD committed Jan 6, 2025
1 parent 1ccf1d0 commit fd43c37
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 14 deletions.
60 changes: 47 additions & 13 deletions src/components/Editor/AddTalkModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@
@open="fetchTalkConversations">
<div class="modal-content">
<h2>{{ t('calendar', 'Select a talk room from the list') }}</h2>
<ul>
<li v-for="conversation in talkConversations" :key="conversation.id">
<NcButton @click="selectConversation(conversation)">
{{ t('calendar', 'Select') }}
</NcButton>
</li>
</ul>
<h2>{{ t('calendar', 'Create a new talk room') }}</h2>
<NcButton @click="createTalkRoom">
{{ t('calendar', 'Create a new talk room') }}
</NcButton>
<div class="talk-room-list">
<ul>
<li v-for="conversation in talkConversations" :key="conversation.id">
<NcButton @click="selectConversation(conversation)">
{{ t('calendar', 'Select') }}
</NcButton>
</li>
</ul>
</div>
<div class="sticky-footer">
<NcButton @click="createTalkRoom">
<template #icon>
<IconAdd :size="20" />
</template>
{{ t('calendar', 'Create a new conversation') }}
</NcButton>
</div>
</div>
</NcModal>
</template>

Check warning on line 27 in src/components/Editor/AddTalkModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/AddTalkModal.vue#L26-L27

Added lines #L26 - L27 were not covered by tests
Expand All @@ -29,12 +35,17 @@ import axios from '@nextcloud/axios'
import { createTalkRoom } from '../../services/talkService.js'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { generateOcsUrl } from '@nextcloud/router'
import IconAdd from 'vue-material-design-icons/Plus.vue'
import useCalendarObjectInstanceStore from '../../store/calendarObjects.js'
import { mapStores } from 'pinia';

Check failure on line 40 in src/components/Editor/AddTalkModal.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Extra semicolon

Check warning on line 40 in src/components/Editor/AddTalkModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/AddTalkModal.vue#L37-L40

Added lines #L37 - L40 were not covered by tests

Check failure on line 42 in src/components/Editor/AddTalkModal.vue

View workflow job for this annotation

GitHub Actions / NPM lint

More than 1 blank line not allowed

Check warning on line 42 in src/components/Editor/AddTalkModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/AddTalkModal.vue#L42

Added line #L42 was not covered by tests
export default {
name: 'AddTalkModal',
components: {
NcButton,
NcModal,
IconAdd,

Check warning on line 48 in src/components/Editor/AddTalkModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/AddTalkModal.vue#L45-L48

Added lines #L45 - L48 were not covered by tests
},
props: {
calendarObjectInstance: {
Expand All @@ -53,12 +64,16 @@ export default {
creatingTalkRoom: false,

Check warning on line 64 in src/components/Editor/AddTalkModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/AddTalkModal.vue#L64

Added line #L64 was not covered by tests
}
},
computed: {
...mapStores(useCalendarObjectInstanceStore),

Check warning on line 69 in src/components/Editor/AddTalkModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/AddTalkModal.vue#L68-L69

Added lines #L68 - L69 were not covered by tests
},
methods: {

Check warning on line 71 in src/components/Editor/AddTalkModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/AddTalkModal.vue#L71

Added line #L71 was not covered by tests
async fetchTalkConversations() {
try {
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/room'))
this.talkConversations = response.data.ocs.data.filter(conversation =>
conversation.joinable || conversation.is_moderator,
conversation.joinable

Check warning on line 76 in src/components/Editor/AddTalkModal.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Missing trailing comma

Check warning on line 76 in src/components/Editor/AddTalkModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/AddTalkModal.vue#L75-L76

Added lines #L75 - L76 were not covered by tests
)
} catch (error) {
console.error('Error fetching Talk conversations:', error)
Expand Down Expand Up @@ -113,5 +128,24 @@ export default {
}
</script>
<style scoped>
<style lang="css" scoped>
.talk-room-list {
flex: 1;
overflow-y: auto;
padding-bottom: 16px;
}
.sticky-footer {
position: sticky;
bottom: 0;
padding: 16px;
text-align: right;
}
h2 {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
height: 30px;
}
</style>
8 changes: 7 additions & 1 deletion src/views/EditSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@
@update:value="updateLocation" />
<AddTalkModal v-if="isModalOpen"
:conversations="talkConversations"
:calendar-object-instance="calendarObjectInstance"
@close="closeModal" />
<NcButton :disabled="isCreateTalkRoomButtonDisabled"
class="add-talk-button"
@click="openModal">

Check warning on line 98 in src/views/EditSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/views/EditSidebar.vue#L98

Added line #L98 was not covered by tests
<template #icon>
<IconCheck :size="16" />
</template>

Check warning on line 101 in src/views/EditSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/views/EditSidebar.vue#L101

Added line #L101 was not covered by tests
{{ t('calendar','Add Talk') }}
</NcButton>
</div>

Check warning on line 104 in src/views/EditSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/views/EditSidebar.vue#L104

Added line #L104 was not covered by tests
Expand Down Expand Up @@ -326,6 +330,7 @@ import { mapStores, mapState } from 'pinia'
import AddTalkModal from '../components/Editor/AddTalkModal.vue'
import { createTalkRoom, doesContainTalkLink } from '../services/talkService.js'

Check warning on line 331 in src/views/EditSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/views/EditSidebar.vue#L330-L331

Added lines #L330 - L331 were not covered by tests
import { showError, showSuccess } from '@nextcloud/dialogs'
import IconCheck from 'vue-material-design-icons/Check.vue'

export default {
name: 'EditSidebar',
Expand Down Expand Up @@ -361,6 +366,7 @@ export default {
AttachmentsList,
CalendarPickerHeader,
PropertyTitle,
IconCheck,

Check warning on line 369 in src/views/EditSidebar.vue

View check run for this annotation

Codecov / codecov/patch

src/views/EditSidebar.vue#L369

Added line #L369 was not covered by tests
},
mixins: [
EditorMixin,
Expand Down Expand Up @@ -761,13 +767,13 @@ export default {
display: flex;
align-items: center;
gap: 4px;
width: 100%;
}
.add-talk-button {
flex-shrink: 0;
}
.property-location {
margin-top: 10px;
margin-left: -43px;
flex-grow: 1;
}
.property-description {
Expand Down

0 comments on commit fd43c37

Please sign in to comment.