diff --git a/controller/api.js b/controller/api.js index aab9420..b94c3b3 100644 --- a/controller/api.js +++ b/controller/api.js @@ -345,7 +345,6 @@ exports.updateFeed = (bot)=> } - exports.strikeDashboard = (bot)=> { return async (req, res)=> @@ -373,7 +372,7 @@ exports.strikeDashboard = (bot)=> strikes.push(aux); })); // console.log(strikes) - res.render('strikesDashboard.ejs', {strikes, guild, moderator}) + res.render('strikesDashboard.ejs', {strikes, guild, moderator, params:req.params}) } } exports.updateStrikes = (bot)=> @@ -382,8 +381,27 @@ exports.updateStrikes = (bot)=> { const moderator = req.params.userid; const strike = await STRIKES.findByIdAndUpdate(req.params.strikeid, {validated:true, validatedBy:moderator}); - const strikes = await STRIKES.find({guildID:req.params.id}) - res.render('strikelist.ejs', {strikes, moderator}) + const guild = bot.guilds.cache.get(req.params.id); + const strikeList = await STRIKES.find({guildID:req.params.id}) + var strikes = []; + await Promise.all(strikeList.map(async (strike) => { + var aux = {...strike._doc } + if(strike.validated) + { + if(strike.validatedBy) + { + const user = bot.users.cache.get(strike.validatedBy); + const moderator = { + username:user.username, + avatar:user.avatar, + id:user.id + }; + aux = {...aux, moderator}; + } + } + strikes.push(aux); + })); + res.render('strikelist.ejs', {strikes, guild, moderator, params:req.params}) } } exports.deleteStrikes = (bot)=> @@ -391,8 +409,27 @@ exports.deleteStrikes = (bot)=> return async (req,res)=> { await STRIKES.findByIdAndDelete(req.params.strikeid); - const strikes = await STRIKES.find({guildID:req.params.id}) + const guild = bot.guilds.cache.get(req.params.id); + const strikeList = await STRIKES.find({guildID:req.params.id}) const moderator = req.params.userid; - res.render('strikelist.ejs', {strikes, moderator}) + var strikes = []; + await Promise.all(strikeList.map(async (strike) => { + var aux = {...strike._doc } + if(strike.validated) + { + if(strike.validatedBy) + { + const user = bot.users.cache.get(strike.validatedBy); + const moderator = { + username:user.username, + avatar:user.avatar, + id:user.id + }; + aux = {...aux, moderator}; + } + } + strikes.push(aux); + })); + res.render('strikelist.ejs', {strikes, guild, moderator, params:req.params}) } } \ No newline at end of file diff --git a/public/css/strikesdashboard.css b/public/css/strikesdashboard.css index 4650c7f..8bacd40 100644 --- a/public/css/strikesdashboard.css +++ b/public/css/strikesdashboard.css @@ -31,6 +31,7 @@ body width: 100%; justify-content: center; background-color: #071c24; + overflow-y: auto !important; } #userWrapper @@ -39,8 +40,6 @@ body flex-wrap: wrap; gap: 1em; justify-content: center; - margin-top:3vh; - margin-left: 10%; text-align: center; align-items: center; height: 15vh; @@ -55,6 +54,7 @@ body background-color: ivory; height: 10vh; width: 10vh; + top:0 !important; background-size: 10vh 10vh; border-radius: 10px; } @@ -70,24 +70,22 @@ body } #userName { - margin: 0; - position: relative; - font-size: 2.5em; font-family: 'Lato'; font-weight: bolder; white-space: pre-wrap; color: rgb(15, 98, 131); + transform: translateY(0.5em); } #maindisplay { width: 90%; - margin-top: 2vh; - margin-left: 5%; + margin-top: 3vh; color:white; display: flex; + overflow-y: auto; justify-content: center; align-items: center; text-align: center; @@ -107,6 +105,10 @@ body .strike-info { flex: 4; } +.strike-info > h3, .strike-info > h4 { + margin-top: 1em; + margin-bottom: 1em; +} .strike-info > h3 > span> img, .strike-info > h4 > span> img { border: none; @@ -144,7 +146,14 @@ body margin-right: 1em; } -.actions >div:hover +.actions > div +{ + height: 7vh; + display: flex; + justify-content: center; + flex-direction: column; +} +.actions > div:hover { background-color: darkslategray; border:none; @@ -163,4 +172,9 @@ body color:rgb(15, 98, 131); font-family: 'Lato'; font-weight: bolder; +} +.reload +{ + color: rgb(15, 98, 131); + transform: translateY(0.2em); } \ No newline at end of file diff --git a/views/strikesDashboard.ejs b/views/strikesDashboard.ejs index c7ae9b4..28c49df 100644 --- a/views/strikesDashboard.ejs +++ b/views/strikesDashboard.ejs @@ -1,11 +1,18 @@
+ cancel
-
-

<%= guild.name%>

+
+

<%= guild.name%> frame_reload +