feat(communication): integrate collaboration rooms into normal chat

This commit is contained in:
2026-10-02 18:12:03 +02:00
parent 6ff9971ff9
commit 0887863981
5 changed files with 462 additions and 185 deletions

View File

@@ -2,7 +2,7 @@
const { $api } = useNuxtApp()
const route = useRoute()
const state = ref({ rooms: [], invitations: [], managedRooms: [], projects: [], canManage: false, contact: '' })
const contacts = ref([]), selected = ref(''), error = ref(''), busy = ref(false), showCreate = ref(false), showManagement = ref(false)
const contacts = ref([]), selected = ref(typeof route.query.room === 'string' ? route.query.room : ''), error = ref(''), busy = ref(false), showCreate = ref(false), showManagement = ref(false)
const management = ref({ members: [], invitations: [] }), inviteResult = ref(null)
const create = reactive({ name: '', topic: '', projectId: String(route.query.project || '') })
const invite = reactive({ kind: 'user', userId: '', name: '', email: '', contact: '', role: 'participant', overviewAllowed: false, expiresAt: '', sendEmail: true })
@@ -73,6 +73,7 @@ async function savePartner(origin, active = true) {
})
}
watch(selected, () => { showManagement.value = false; inviteResult.value = null; management.value = { members: [], invitations: [] } })
watch(() => route.query.room, id => { if (typeof id === 'string') selected.value = id })
let timer
onMounted(async () => { await refresh(); timer = setInterval(() => { if (!document.hidden && !busy.value) void refresh() }, 15000) })
onBeforeUnmount(() => clearInterval(timer))
@@ -120,7 +121,10 @@ onBeforeUnmount(() => clearInterval(timer))
</button>
</aside>
<div class="min-w-0 space-y-4">
<UButton v-if="selectedManaged" variant="outline" :disabled="busy" @click="run(async () => { await loadManagement(); showManagement = !showManagement })">Teilnehmer und Freigaben verwalten</UButton>
<div class="flex flex-wrap gap-2">
<UButton v-if="readable" :to="{ path: '/communication/chat', query: { room: `collaboration:${selected}` } }" variant="outline">Im Chat öffnen</UButton>
<UButton v-if="selectedManaged" variant="outline" :disabled="busy" @click="run(async () => { await loadManagement(); showManagement = !showManagement })">Teilnehmer und Freigaben verwalten</UButton>
</div>
<section v-if="showManagement && selectedManaged" class="space-y-5 rounded-xl border border-gray-200 p-4 dark:border-gray-700">
<form class="space-y-3" @submit.prevent="invitePerson">
<h2 class="font-semibold">Person in diesen Unterraum einladen</h2>