From b1ccae88ef51740dfd99c64b3d2b0ab9d7c7815a Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Sat, 23 Mar 2024 01:06:32 +0100 Subject: [PATCH] first version of the frontend for messages --- frontend/src/Apps/Msg.vue | 100 ++++++++++++++++++++++++++++++++++++-- frontend/src/rest/msg.js | 62 ++++++++++++++++++++++- 2 files changed, 158 insertions(+), 4 deletions(-) diff --git a/frontend/src/Apps/Msg.vue b/frontend/src/Apps/Msg.vue index feecdbe..5a09e18 100644 --- a/frontend/src/Apps/Msg.vue +++ b/frontend/src/Apps/Msg.vue @@ -1,12 +1,35 @@ + + @@ -25,13 +48,84 @@ 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; +} + diff --git a/frontend/src/rest/msg.js b/frontend/src/rest/msg.js index 648f231..9f3bf3e 100644 --- a/frontend/src/rest/msg.js +++ b/frontend/src/rest/msg.js @@ -6,6 +6,9 @@ *******************************************************/ import { restGet } from './restConsumer.js' +import { ref } from 'vue' + +export const currentDiscussion = ref({}); export async function getDiscussions(){ return [ @@ -18,8 +21,65 @@ export async function getDiscussions(){ id: 2, name: "Discussion#2", members: [1, 4], + }, + { + id: 3, + name: "Discussion#3", + members: [1, 3], } ] - return restGet("/discussions"); + // 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); }