some more ui stuff

This commit is contained in:
biglyderv 2025-02-26 13:54:25 -05:00
parent 9e5989825f
commit d65c737a6e
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
5 changed files with 60 additions and 42 deletions

View file

@ -35,8 +35,8 @@ body {
.header-big { .header-big {
width: 800px; width: 800px;
margin: -10px; margin: -5px;
padding: 10px; padding: 5px;
background: var(--main-5); background: var(--main-5);
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-top-right-radius: 10px; border-top-right-radius: 10px;
@ -114,7 +114,7 @@ body {
.nav, .nav,
.main { .main {
border: solid var(--main-1) 5px; border: solid var(--main-1) 5px;
padding: 10px; padding: 5px;
width: 800px; width: 800px;
max-width: calc(100vw - 40px); max-width: calc(100vw - 40px);
} }
@ -182,4 +182,12 @@ form .header-big,
background: var(--main-3); background: var(--main-3);
color: var(--main-1); color: var(--main-1);
margin: .5rem; margin: .5rem;
}
.sub {
font-size: 0.8em;
}
h1 {
font-size: 1.4em;
} }

View file

@ -35,8 +35,6 @@ router.get('/:id', async (req, res, next) => {
replies = replies.filter(x => x.comment != 'fail'); replies = replies.filter(x => x.comment != 'fail');
console.log(replies)
res.ctx.mainPage = 'commenter' res.ctx.mainPage = 'commenter'
res.ctx.mainCtx = { res.ctx.mainCtx = {
replies replies

View file

@ -37,6 +37,11 @@ router.get('/get/:type/:id/:num', async (req, res, next) => {
req.params.num * 10 req.params.num * 10
]); ]);
replies.splice(0, 0, {
childType: 'comment',
childId: req.params.id
})
for (let reply of replies) { for (let reply of replies) {
let dat = await db.all('SELECT * FROM comment WHERE id = ?', [ let dat = await db.all('SELECT * FROM comment WHERE id = ?', [
reply.childId reply.childId
@ -50,6 +55,7 @@ router.get('/get/:type/:id/:num', async (req, res, next) => {
reply.comment.id = reply.childId; reply.comment.id = reply.childId;
} }
let comment = replies.splice(0, 1)[0];
replies = replies.filter(x => x.comment != 'fail'); replies = replies.filter(x => x.comment != 'fail');
res.ctx.mainPage = 'replies' res.ctx.mainPage = 'replies'
@ -59,7 +65,9 @@ router.get('/get/:type/:id/:num', async (req, res, next) => {
opLink: `/${req.params.type}/${req.params.id}`, opLink: `/${req.params.type}/${req.params.id}`,
type: req.params.type, type: req.params.type,
id: req.params.id id: req.params.id,
comment
} }
next(); next();
}) })

View file

@ -1,8 +1,7 @@
<div class='main'> <div class='main'>
<div class="header-big"> <h1 class="header-big"><%= username %></h1>
<div><%= username %> </div>
<div><%= new Date(date).toISOString() %> </div>
</div>
<div><%= content %></div> <div><%= content %></div>
<div class='sub'><b>Posted on</b> <%= new Date(date).toISOString() %> </div>
<%- include ('vblock.ejs', {link: `/${type}/${id}`, icon: '/icon.svg', name: 'Original'}) %>
<%- include ('vblock.ejs', {link: `/walls/get/${type}/${id}/0`, icon: '/icon.svg', name: 'Replies'}) %> <%- include ('vblock.ejs', {link: `/walls/get/${type}/${id}/0`, icon: '/icon.svg', name: 'Replies'}) %>
</div> </div>

View file

@ -1,40 +1,45 @@
<%- include('form.ejs', { <% if (comment.comment != 'fail') { %>
title: "Reply", <%- include ('comment.ejs', comment.comment || {}) %>
message: 'Send your thoughts to the world.', <% } %>
action: "/api/file/comment",
inputs: [
{
"key": "Message",
"type": "textarea",
"name": "post",
"default": ""
},
{
"key": "Attachments",
"type": "file",
"name": "post",
"default": ""
},
{
"key": "",
"type": "hidden",
"name": "type",
"default": type
},
{
"key": "",
"type": "hidden",
"name": "id",
"default": id
},
]
}) %>
<div class='main'> <div class='main'>
<h1 class="header-big">Replies</h1> <h1 class="header-big">Replies</h1>
<%- include ('vblock.ejs', {link: opLink, icon: '/icon.svg', name: 'Original'}) %>
<%- include ('vblock.ejs', {link: `${page - 1}`, icon: '/icon.svg', name: 'Previous'}) %> <%- include ('vblock.ejs', {link: `${page - 1}`, icon: '/icon.svg', name: 'Previous'}) %>
<%- include ('vblock.ejs', {link: `${page * 1 + 1}`, icon: '/icon.svg', name: 'Next'}) %> <%- include ('vblock.ejs', {link: `${page * 1 + 1}`, icon: '/icon.svg', name: 'Next'}) %>
</div> </div>
<% if (page == 0) { %>
<%- include('form.ejs', {
title: "Reply",
message: 'Send your thoughts to the world.',
action: "/api/file/comment",
inputs: [
{
"key": "Message",
"type": "textarea",
"name": "post",
"default": ""
},
{
"key": "Attachments",
"type": "file",
"name": "post",
"default": ""
},
{
"key": "",
"type": "hidden",
"name": "type",
"default": type
},
{
"key": "",
"type": "hidden",
"name": "id",
"default": id
},
]
}) %>
<% } %>
<% for (let reply of replies) { %> <% for (let reply of replies) { %>
<%- include ('comment.ejs', reply.comment || {}) %> <%- include ('comment.ejs', reply.comment || {}) %>
<% } %> <% } %>