1
0
forked from PGL/Clyde

Compare commits

...

3 Commits

Author SHA1 Message Date
b1ccae88ef
first version of the frontend for messages 2024-03-23 01:06:32 +01:00
ad81ee3647
base msg 2024-03-22 13:55:13 +01:00
b714aeb156
Make app use full space 2024-03-22 13:54:30 +01:00
5 changed files with 230 additions and 4 deletions

View File

@ -86,12 +86,9 @@ window.addEventListener('hashchange', () => {
</ul>
</div>
<div class="page">
<div style=" margin:50px;">
<Suspense>
<component :is="currentView" />
<component :is="currentView" />
</Suspense>
</div>
</div>
</div>
</template>
@ -99,6 +96,8 @@ window.addEventListener('hashchange', () => {
<style scoped>
.container{
height: 100%;
width: 100%;
display:grid;
grid-template-columns:[firstCol-start]70px[firstCol-end secondCol-start]auto[endCol];
grid-template-rows:[firstRow-start]61px[firstRow-end secondRow-start] auto [endRow];
@ -111,6 +110,8 @@ window.addEventListener('hashchange', () => {
.page {
grid-area:page;
height: 100%;
width: 100%;
place-self:center;
}

131
frontend/src/Apps/Msg.vue Normal file
View File

@ -0,0 +1,131 @@
<!----------------------------------------------------
File: Msg.vue
Author: Anthony Debucquoy
Scope: Extension messagerie
Description: Main msg page
----------------------------------------------------->
<script setup>
import { ref, reactive } from 'vue'
import { getDiscussions, currentDiscussion, fetchDiscussion } from '@/rest/msg.js'
const discussionsList = reactive(await getDiscussions());
</script>
<template>
<div id="msg">
<div id="discList">
<div @click="fetchDiscussion(discussion.id)" class="discItem" v-for="discussion in discussionsList" :key="discussion.id">{{ discussion.name }}</div>
</div>
<div id="discussion">
<h1 id=msgName >{{currentDiscussion.name}}</h1>
<div id=msgs>
<div class="msg" v-for="msg in currentDiscussion.msgs" :sender="msg.sender" :key="msg.id">
{{ msg.text }}
</div>
</div>
<div id=messageBox>
<input type="text" name="messageBox" value="">
<input type="submit" name="" id="" value="send">
</div>
</div>
</div>
</template>
<style scoped>
div#msg{
position: relative;
width: 100%;
height: 100%;
display: grid;
grid-template-columns: 20% auto;
}
div#discList{
margin: 30px 0 30px 30px;
background-color: rgba(255, 255, 255, 0.05);
border-radius: 10px;
overflow: hidden;
padding: 10px;
}
.discItem{
color: darkorange;
display: flex;
font-family: sans-serif;
font-weight: bold;
height: 4vh;
margin: 5px;
border-radius: 0 30px 30px 0;
align-items: center;
justify-content: center;
border: 1px solid darkorange;
}
div#discussion{
display: flex;
flex-direction: column;
margin: 30px;
background-color: rgba(255, 255, 255, 0.05);
border-radius: 10px;
}
#msgName{
text-align: center;
display: block;
background-color: #0202f755;
border-radius: 5px;
color: white;
width: 75%;
margin: 30px auto;
}
.discItem:hover{
background-color: gray;
}
#msgs{
display: flex;
flex-grow: 1;
flex-direction: column;
}
.msg {
background-color: aliceblue;
font-family: sans-serif;
margin: 10px;
padding: 5px;
border-radius: 3px;
max-width: 50%;
align-self: start;
}
.msg[sender=true]{
background-color: darkorange;
align-self: end;
}
#messageBox{
display: flex;
margin: 10px;
border-radius: 5px;
}
#messageBox input[type="text"]{
align-self: end;
flex-grow: 1;
}
#messageBox input[type="submit"]{
position: absolute;
right: 50px;
margin: 2px;
border: none;
padding: 0 10px;
}
</style>

View File

@ -1,4 +1,11 @@
body {
background-color: rgb(53, 25, 60);
margin:0;
width: 100vw;
height: 100vh;
}
#app {
width: 100%;
height: 100%;
}

View File

@ -9,6 +9,7 @@ import Profil from "@/Apps/Profil.vue"
import Courses from "@/Apps/ManageCourses.vue"
import Users from "@/Apps/UsersList.vue"
import Students from "@/Apps/StudentsList.vue"
import Msg from "@/Apps/Msg.vue"
const apps = {
'/login': LoginPage,
@ -17,6 +18,7 @@ const apps = {
'/manage-courses' : Courses,
'/users-list' : Users,
'/students-list' : Students,
'/msg' : Msg,
}
const appsList = {

85
frontend/src/rest/msg.js Normal file
View File

@ -0,0 +1,85 @@
/*******************************************************
* File: msg.js
* Author: Anthony Debucquoy
* Scope: Extension messagerie
* Description: Messages frontend api consumer
*******************************************************/
import { restGet } from './restConsumer.js'
import { ref } from 'vue'
export const currentDiscussion = ref({});
export async function getDiscussions(){
return [
{
id: 1,
name: "Discussion#1",
members: [1, 2, 3, 4],
},
{
id: 2,
name: "Discussion#2",
members: [1, 4],
},
{
id: 3,
name: "Discussion#3",
members: [1, 3],
}
]
// return restGet("/discussions");
}
export async function fetchDiscussion(id){
currentDiscussion.value = {
id: id,
name: "Discussion#2",
msgs: [
{
id: 1,
author: 1,
sender: true,
attachment: null,
text: "Hello world!"
},
{
id: 2,
author: 2,
sender: false,
attachment: null,
text: "Hello What?"
},
{
id: 3,
author: 2,
sender: false,
attachment: null,
text: "You morron"
},
{
id: 4,
author: 1,
sender: true,
attachment: null,
text: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
},
// {
// id: 5,
// author: 1,
// sender: true,
// attachment: null,
// text: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
// },
{
id: 6,
author: 2,
sender: false,
attachment: null,
text: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
}
]
}
// currentDiscussion.value = restGet("/discussion/" + id);
}