From 2f0b0fb39f6b339baac1e42915d4fe11b5e24d64 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Mon, 25 Nov 2024 14:12:43 -0500 Subject: [PATCH] user page, meta fixes, css updates --- client/main.js | 1 - client/user.js | 20 ++++++++++++++++++++ routes.js | 7 +++++-- static/main.css | 7 ++++--- views/main.ejs | 1 + views/user.ejs | 17 +++++++++++++++++ 6 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 client/user.js create mode 100644 views/user.ejs diff --git a/client/main.js b/client/main.js index 06cfd74..5578926 100644 --- a/client/main.js +++ b/client/main.js @@ -7,7 +7,6 @@ let db = await initDb(); let main = new Route([auth], async function (req, res, input) { let { username } = input; let videos = await db.all('SELECT * FROM video ORDER BY date DESC', [ - req.query.id ]); return res.render('main', { username, diff --git a/client/user.js b/client/user.js new file mode 100644 index 0000000..024e2ae --- /dev/null +++ b/client/user.js @@ -0,0 +1,20 @@ +import Route from "../route.js"; +import auth from "../form/auth.js"; +import initDb from "../db.js"; + +let db = await initDb(); + +let main = new Route([auth], async function (req, res, input) { + let { id } = req.query; + let { username } = input; + let videos = await db.all('SELECT * FROM video WHERE username = ? ORDER BY date DESC', [ + req.query.id + ]); + return res.render('user', { + username, + id, + videos + }); +}); + +export default main; \ No newline at end of file diff --git a/routes.js b/routes.js index f59c1b3..3dc9328 100644 --- a/routes.js +++ b/routes.js @@ -1,12 +1,14 @@ import main from "./client/main.js"; -import auth from "./form/auth.js"; import login from "./client/login.js"; import register from "./client/register.js"; import upload from "./client/upload.js"; import player from "./client/player.js"; +import user from "./client/user.js"; + import loginB from "./form/login.js"; import registerB from "./form/register.js"; import uploadB from "./form/upload.js"; +import auth from "./form/auth.js"; const routes = { get: {}, @@ -19,7 +21,8 @@ routes.client = { login, register, upload, - video: player + video: player, + user } routes.get = { }; diff --git a/static/main.css b/static/main.css index e3c42c0..1713086 100644 --- a/static/main.css +++ b/static/main.css @@ -14,12 +14,11 @@ body { :root { --dark-1: #2f2b36; --dark-2: #d8d8d8; - --dark-3: rgb(209, 73, 236); --light-1: #ffffff; --light-2: #ffa9d8; - --hyperlink: rgb(255, 72, 240); + --hyperlink: rgb(109, 119, 255); --shadow-1: 0px 0px 2px 2px var(--dark-2); @@ -37,7 +36,8 @@ textarea, .area, form, .video, -.controls { +.controls, +.user { border: solid var(--dark-2) 3px; border-radius: 5px; @@ -91,6 +91,7 @@ form { background-color: var(--hyperlink); font-weight: bold; width: 150px; + display: inline-block; } .header { diff --git a/views/main.ejs b/views/main.ejs index 24e4bb6..d7e7527 100644 --- a/views/main.ejs +++ b/views/main.ejs @@ -15,6 +15,7 @@ <%if (username=='!nobody' ) { %>
Join
<% } %> +
Chat

Recent Videos

diff --git a/views/user.ejs b/views/user.ejs new file mode 100644 index 0000000..bec47f3 --- /dev/null +++ b/views/user.ejs @@ -0,0 +1,17 @@ +<%- include('header.ejs') -%> +
+

User

+
+ +

+ @<%= id %> +

+
+
+
+

Uploaded Videos

+
+ <%- include('videos.ejs') -%> +
+
+ <%- include('footer.ejs') -%> \ No newline at end of file