diff --git a/src/app.css b/src/app.css index bd6213e..3e6c14a 100644 --- a/src/app.css +++ b/src/app.css @@ -1,3 +1,14 @@ @tailwind base; @tailwind components; -@tailwind utilities; \ No newline at end of file +@tailwind utilities; + +@font-face { + font-family: 'Comfortaa'; + src: url('./fonts/Comfortaa-VariableFont_wght.ttf') format('truetype'); + font-weight: 1 1000; /* Объявляем диапазон веса шрифта */ + font-style: normal; + font-stretch: normal; + } +:root{ + --fontColor: #FFFFFF; +} \ No newline at end of file diff --git a/src/app.html b/src/app.html index 629c4c3..e39ac10 100644 --- a/src/app.html +++ b/src/app.html @@ -13,7 +13,15 @@ html,body{ margin: 0; padding: 0; + background-color: #101010; } + :root{ + --bg: #101010; + --gradient: linear-gradient(to right, #3C53FF, #7734AA); + --fontColor: #FFFFFF; + font-family: Comfortaa; + + } diff --git a/src/lib/userFunction.js b/src/lib/userFunction.js index 50fa959..fdc1811 100644 --- a/src/lib/userFunction.js +++ b/src/lib/userFunction.js @@ -7,7 +7,6 @@ export async function UserCheck(){ }) if(!response.ok){ - window.location.href = '/login' return(response.status) } @@ -17,6 +16,31 @@ export async function UserCheck(){ } } + export async function handleRegister(username,password,email,date_of_birth){ + const response = await fetch('http://localhost:8000/api/users/register',{ + method:'POST', + credentials:"include", + headers:{ + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + "email": email, + "username": username, + "password": password, + "date_of_birth": date_of_birth + }) + }) + + if(!response.ok){ + console.log(response.status) + } + else{ + const data = await response.json(); + return data; + } + + } + export async function handleLogin(username, password) { const response = await fetch('http://localhost:8000/api/users/login', { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index e69de29..fe9b435 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -0,0 +1,23 @@ + + +
+ + + + \ No newline at end of file diff --git a/src/routes/chatPage/+page.svelte b/src/routes/chatPage/+page.svelte index 5e9c7b0..954cfe2 100644 --- a/src/routes/chatPage/+page.svelte +++ b/src/routes/chatPage/+page.svelte @@ -21,8 +21,12 @@ onMount(async () => { const userData = await UserCheck(); + let userId = userData.id; let chatId = 2; + if(userId === undefined) + window.location.href = '/login' + const websocketUrl = `ws://localhost:8000/api/chat/ws/${chatId}?user_id=${userId}`; messages = await getLastMessages(); @@ -58,6 +62,7 @@ if (event.key === 'Enter' && !event.shiftKey) { // Если нажат Enter и не нажат Shift, отправляем сообщение sendMessage(event); + messageText = "" event.preventDefault(); } diff --git a/src/routes/register/+page.svelte b/src/routes/register/+page.svelte index 23880b4..b53e0a5 100644 --- a/src/routes/register/+page.svelte +++ b/src/routes/register/+page.svelte @@ -1,8 +1,153 @@ - -
+ + + + + +
+
+
+

ЖОПА

+ +
+

имя

+ + +

эл почта

+ + +

пароль

+ + +

повтори пароль (для уверенности)

+ + +

Дата рождения

+
+ + + + + + + +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/static/fonts/Comfortaa-VariableFont_wght.ttf b/static/fonts/Comfortaa-VariableFont_wght.ttf new file mode 100644 index 0000000..9918535 Binary files /dev/null and b/static/fonts/Comfortaa-VariableFont_wght.ttf differ diff --git a/static/nnnoise.svg b/static/nnnoise.svg new file mode 100644 index 0000000..56f5b0c --- /dev/null +++ b/static/nnnoise.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file