|
|
@ -6,16 +6,35 @@
|
|
|
|
<div id="roomList" class="roomList">
|
|
|
|
<div id="roomList" class="roomList">
|
|
|
|
<h1 class="wideElement">[chat]</h1><h1 class="smallElement">[c]</h1>
|
|
|
|
<h1 class="wideElement">[chat]</h1><h1 class="smallElement">[c]</h1>
|
|
|
|
<input v-model="search" class="input wideElement" type="text" maxlength="50" placeholder="search">
|
|
|
|
<input v-model="search" class="input wideElement" type="text" maxlength="50" placeholder="search">
|
|
|
|
<div
|
|
|
|
<p class="wideElement">rooms ↴</p>
|
|
|
|
v-for="room in Object.assign([], matrix.rooms)
|
|
|
|
<room-list-element
|
|
|
|
.sort(obj => obj.timeline[obj.timeline.length-1].event.origin_server_ts)"
|
|
|
|
v-for="room in Object.assign([], matrix.client.getRooms())
|
|
|
|
:key="room.roomId" @click="openChat(room)"
|
|
|
|
.sort(obj => obj.timeline[obj.timeline.length-1].event.origin_server_ts)
|
|
|
|
>
|
|
|
|
.filter(prop=>matchResults(prop.name, search))"
|
|
|
|
<room-list-element
|
|
|
|
:key="room.roomId" @click.native="openChat(room)"
|
|
|
|
v-if="!search || room.name.toLowerCase().includes(search.toLowerCase().trim())"
|
|
|
|
:room="room"
|
|
|
|
:room="room"
|
|
|
|
class="roomListElement"
|
|
|
|
class="roomListElement"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div v-if="search">
|
|
|
|
|
|
|
|
<p class="wideElement">users ↴</p><p class="smallElement">—</p>
|
|
|
|
|
|
|
|
<user-list-element
|
|
|
|
|
|
|
|
v-for="user in matrix.client.getUsers()
|
|
|
|
|
|
|
|
.filter(prop=>matchResults(prop.displayName, search)||matchResults(prop.userId, search))
|
|
|
|
|
|
|
|
.slice(0,10)"
|
|
|
|
|
|
|
|
:user="user" :key="user.userId"
|
|
|
|
|
|
|
|
@click.native="setQuestion(`create private chat with '${search}'?`,()=>search='cool')"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
<p class="wideElement">suggestions ↴</p><p class="smallElement">…</p>
|
|
|
|
|
|
|
|
<div class="wideElement">
|
|
|
|
|
|
|
|
<p v-if="isValidUserId(search)">create chat: {{search}} ➤</p>
|
|
|
|
|
|
|
|
<p v-if="isValidRoomId(search)"
|
|
|
|
|
|
|
|
@click="setQuestion(`join room '${search}'?`, ()=>joinRoom(search))"
|
|
|
|
|
|
|
|
>join room: {{search}} ➤</p>
|
|
|
|
|
|
|
|
<p v-if="search.match(/^[a-zA-Z0-9_.+-]+$/)"
|
|
|
|
|
|
|
|
@click="setQuestion(`create room '${search}'?`,()=>search='cool')"
|
|
|
|
|
|
|
|
>create room: {{search}} ➤</p>
|
|
|
|
|
|
|
|
<room-list-element v-if="isValidRoomId(search) && getRoom(search)" :room="getRoom(search)"/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<chat
|
|
|
|
<chat
|
|
|
@ -28,21 +47,27 @@
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<div class="noRoomSelected" v-else>Please select a room to be displayed.</div>
|
|
|
|
<div class="noRoomSelected" v-else>Please select a room to be displayed.</div>
|
|
|
|
<chatInformation v-if="showRoom && showChatInfo" :room="getCurrentRoom()" :close-chat-info="()=>showChatInfo=false"/>
|
|
|
|
<chatInformation v-if="showRoom && showChatInfo" :room="getCurrentRoom()" :close-chat-info="()=>showChatInfo=false"/>
|
|
|
|
|
|
|
|
<popup-question v-if="popup.question" :callback="popup.callback" :question="popup.question" class="center"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import chat from '@/views/chat.vue';
|
|
|
|
import chat from '@/views/chat.vue';
|
|
|
|
import chatInformation from "@/components/chatInformation";
|
|
|
|
import chatInformation from '@/components/chatInformation';
|
|
|
|
import {matrix} from "@/main";
|
|
|
|
import {matrix} from '@/main';
|
|
|
|
import ThrobberOverlay from "@/components/throbberOverlay";
|
|
|
|
import ThrobberOverlay from '@/components/throbberOverlay';
|
|
|
|
import {getMxcFromRoom} from "@/lib/getMxc";
|
|
|
|
import {getMxcFromRoom} from '@/lib/getMxc';
|
|
|
|
import roomListElement from "@/components/roomListElement";
|
|
|
|
import roomListElement from '@/components/roomListElement';
|
|
|
|
import {getRoom} from "@/lib/matrixUtils";
|
|
|
|
import {getRoom, getUser} from '@/lib/matrixUtils';
|
|
|
|
|
|
|
|
import {isValidUserId, isValidRoomId} from '@/lib/matrixUtils';
|
|
|
|
|
|
|
|
import userListElement from '@/components/userListElement';
|
|
|
|
|
|
|
|
import PopupQuestion from '@/components/popupQuestion';
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "rooms",
|
|
|
|
name: 'rooms',
|
|
|
|
components:{
|
|
|
|
components:{
|
|
|
|
|
|
|
|
PopupQuestion,
|
|
|
|
|
|
|
|
userListElement,
|
|
|
|
ThrobberOverlay,
|
|
|
|
ThrobberOverlay,
|
|
|
|
chat,
|
|
|
|
chat,
|
|
|
|
chatInformation,
|
|
|
|
chatInformation,
|
|
|
@ -56,21 +81,45 @@ export default {
|
|
|
|
this.$nextTick(() => this.showRoom = true);
|
|
|
|
this.$nextTick(() => this.showRoom = true);
|
|
|
|
this.search = '';
|
|
|
|
this.search = '';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getMxcFromRoom,
|
|
|
|
|
|
|
|
getRoom,
|
|
|
|
|
|
|
|
getCurrentRoom(){
|
|
|
|
getCurrentRoom(){
|
|
|
|
return getRoom(this.$route.path.split('/')[2]);
|
|
|
|
return getRoom(this.$route.path.split('/')[2]);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
closeChat(){
|
|
|
|
closeChat(){
|
|
|
|
this.$router.push('/rooms');
|
|
|
|
this.$router.push('/rooms');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
matchResults(prop, search){
|
|
|
|
|
|
|
|
return prop.toLowerCase().includes(search.toLowerCase().trim());
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
setQuestion(question, callback){
|
|
|
|
|
|
|
|
this.popup = {
|
|
|
|
|
|
|
|
question,
|
|
|
|
|
|
|
|
callback:(res)=>{
|
|
|
|
|
|
|
|
this.popup = false;
|
|
|
|
|
|
|
|
if (res) callback();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
joinRoom(room){
|
|
|
|
|
|
|
|
this.matrix.client.join(room).then(()=>{
|
|
|
|
|
|
|
|
this.openChat(room);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
getMxcFromRoom,
|
|
|
|
|
|
|
|
getRoom,
|
|
|
|
|
|
|
|
getUser,
|
|
|
|
|
|
|
|
isValidUserId,
|
|
|
|
|
|
|
|
isValidRoomId
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data(){
|
|
|
|
data(){
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
matrix,
|
|
|
|
matrix,
|
|
|
|
showChatInfo: false,
|
|
|
|
showChatInfo: false,
|
|
|
|
showRoom: true,
|
|
|
|
showRoom: true,
|
|
|
|
search: ''
|
|
|
|
search: '',
|
|
|
|
|
|
|
|
popup:{
|
|
|
|
|
|
|
|
question: '',
|
|
|
|
|
|
|
|
callback: ()=>{}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
mounted() {
|
|
|
@ -89,6 +138,8 @@ export default {
|
|
|
|
background-color: #222;
|
|
|
|
background-color: #222;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
overflow-y: auto;
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.chat{
|
|
|
|
.chat{
|
|
|
|
position: absolute;
|
|
|
|
position: absolute;
|
|
|
@ -122,6 +173,13 @@ input{
|
|
|
|
.smallElement{
|
|
|
|
.smallElement{
|
|
|
|
display: none;
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.center{
|
|
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
|
|
transform: translate(-50%,-50%);
|
|
|
|
|
|
|
|
z-index: 50;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media (max-width: 48rem) and (min-width: 30rem) {
|
|
|
|
@media (max-width: 48rem) and (min-width: 30rem) {
|
|
|
|
.wideElement{
|
|
|
|
.wideElement{
|
|
|
@ -134,7 +192,6 @@ input{
|
|
|
|
z-index: 30;
|
|
|
|
z-index: 30;
|
|
|
|
width: 4rem;
|
|
|
|
width: 4rem;
|
|
|
|
overflow-y: auto;
|
|
|
|
overflow-y: auto;
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
|
|
|
scrollbar-width: none;
|
|
|
|
scrollbar-width: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.roomList:hover{
|
|
|
|
.roomList:hover{
|
|
|
|