From 73c9cdfc170d7aaa3321a8aaf5d5944ff2b38872 Mon Sep 17 00:00:00 2001 From: WalidMoovin Date: Sat, 4 Mar 2023 15:37:40 +0100 Subject: [PATCH] upload avatar, chat fixed, working on change username --- back/volume/src/main.ts | 1 + back/volume/src/users/dto/user.dto.ts | 2 +- front/volume/public/img/profileicon.png | Bin 9190 -> 0 bytes front/volume/src/components/Channels.svelte | 29 ++++++-- front/volume/src/components/Chat2.svelte | 11 --- front/volume/src/components/NavBar.svelte | 3 +- front/volume/src/components/Profile.svelte | 73 ++++++++------------ 7 files changed, 56 insertions(+), 63 deletions(-) delete mode 100644 front/volume/public/img/profileicon.png diff --git a/back/volume/src/main.ts b/back/volume/src/main.ts index 243ca57..ab171d8 100644 --- a/back/volume/src/main.ts +++ b/back/volume/src/main.ts @@ -7,6 +7,7 @@ import * as session from 'express-session' import * as passport from 'passport' import { type NestExpressApplication } from '@nestjs/platform-express' import * as cookieParser from 'cookie-parser' +import { Response } from 'express'; async function bootstrap () { const logger = new Logger() diff --git a/back/volume/src/users/dto/user.dto.ts b/back/volume/src/users/dto/user.dto.ts index a19571c..399dc2a 100644 --- a/back/volume/src/users/dto/user.dto.ts +++ b/back/volume/src/users/dto/user.dto.ts @@ -5,7 +5,7 @@ import { Express } from 'express' export class UserDto { @IsPositive() - @IsNotEmpty() + @IsOptional() readonly ftId: number @IsString() diff --git a/front/volume/public/img/profileicon.png b/front/volume/public/img/profileicon.png deleted file mode 100644 index bdd467fcc35859e6fd86f02a3396fb0e6bc1e2b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9190 zcmd5?={uC~+n*W6HW|hqLySEPO7@U_vQ$cvu@+JpBeK&VjIE@yWGxe=2w8?nMo3v} z5HT1dG}$GD^xVF`-}l9H9M2!{yqNpNT-SY_%k?=w=W^W1r|qqHdBk}@AP_Ic+S~yI z0-NmrxHy1+dNZDugFwEnr7v?m z9aP|29zT8gEBpp=OzwPs`!RL-k&*BdgVi}l2ZJ~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)yIc8Q1 z>Grj*(;`2O$j3HW{Iqt>lZ%~tj?oWxcd%6 zIA7gf@0X8$nLT&wgpHp+m|a(2Ymb`OwKZ2WX znq4l}Q=kOr2SdUTVUVpqM6qvw_F(@nzcu+kzktaJpZUx7;`; } @@ -19,12 +21,27 @@ const createChannel = () => { const name = prompt("Enter a name for the new channel:"); if (name) { - const newChannel: ChannelsType = { - id: Math.random().toString(), - name, - messages: [] - }; - channels = [newChannel, ...channels]; + const privacy = prompt("Enter a privacy setting for the new channel (public/private):"); + if (privacy !== "public" && privacy !== "private") { + alert("Invalid privacy setting"); + } + let password = ""; + if (privacy === "private") { + password = prompt("Enter a password for the new channel:"); + if (!password) { + alert("Invalid password"); + } + } + if (privacy === "public" || password) { + const newChannel: ChannelsType = { + id: Math.random().toString(), + name, + privacy, + password, + messages: [] + }; + channels = [newChannel, ...channels]; + } } // TODO: save to database }; diff --git a/front/volume/src/components/Chat2.svelte b/front/volume/src/components/Chat2.svelte index 4ebf96a..fe2bc87 100644 --- a/front/volume/src/components/Chat2.svelte +++ b/front/volume/src/components/Chat2.svelte @@ -95,15 +95,4 @@ height: 200px; overflow-y: scroll; } - - .options-modal { - position: absolute; - top: 0; - left: 0; - background-color: white; - padding: 1rem; - border: 1px solid #ccc; - border-radius: 5px; - z-index: 9999; - } diff --git a/front/volume/src/components/NavBar.svelte b/front/volume/src/components/NavBar.svelte index 3fc53f9..84c00de 100644 --- a/front/volume/src/components/NavBar.svelte +++ b/front/volume/src/components/NavBar.svelte @@ -1,4 +1,5 @@ +