Skip to content
This repository was archived by the owner on Mar 10, 2024. It is now read-only.

Commit 5fb46c2

Browse files
author
bhasher
committed
Report system
1 parent ad1e8e9 commit 5fb46c2

File tree

5 files changed

+78
-19
lines changed

5 files changed

+78
-19
lines changed

src/publics/css/base.less

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,20 @@
22
| Generic |
33
\*******************/
44

5+
@background-color: #222;
6+
@color: #fff;
7+
@font: sans-serif;
8+
59
*{
610
margin: 0;
711
padding: 0;
8-
scrollbar-color: #202324 #454a4d;
9-
}
10-
11-
.bold{
12-
font-weight: bold;
13-
}
14-
15-
.blur{
16-
-webkit-filter: blur(5px);
17-
-ms-filter: blur(5px);
18-
filter: blur(5px);
12+
scrollbar-color: lighten(@background-color, 10%) lighten(@background-color, 30%);
1913
}
2014

2115
body{
22-
background-color: #222222;
23-
color: white;
24-
font-family: sans-serif;
16+
background-color: @background-color;
17+
color: @color;
18+
font-family: @font;
2519
height:100vh;
2620
}
2721

@@ -144,7 +138,7 @@ div#welcome{
144138
.blur-background > *:not(#body):not(#welcome) {
145139
filter: blur(3px);
146140
pointer-events: none;
147-
}
141+
}
148142

149143
/******************\
150144
| Report Issue |
@@ -166,6 +160,36 @@ div#welcome{
166160
border-radius: 20px;
167161
border: 1px solid forestgreen;
168162
box-shadow: forestgreen 0 0 10px;
163+
display: none;
164+
165+
h3{
166+
display: block;
167+
text-align: center;
168+
margin-bottom: 10px;
169+
}
170+
171+
textarea{
172+
width: 96%;
173+
height: 300px;
174+
padding: 2%;
175+
resize: none;
176+
color: contrast(@color);
177+
background-color: contrast(@background-color);
178+
font: @font;
179+
}
180+
181+
p{
182+
margin: 10px;
183+
}
184+
185+
input[type=submit]{
186+
float: right;
187+
}
188+
}
189+
190+
.blur-background > *:not(#body):not(#report-issue) {
191+
filter: blur(3px);
192+
pointer-events: none;
169193
}
170194

171195
/******************\

src/publics/js/dev/page/base.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ new Welcome(_.id('welcome-button'));
1515

1616
document.getElementById('link-welcome').onclick = Welcome.show;
1717

18-
document.getElementById('link-report').onclick = () => {};
18+
document.getElementById('link-report').onclick = () => {
19+
document.getElementById('report-issue').style.display = "block";
20+
document.getElementById('main').classList.add("blur-background");
21+
};
22+
23+
document.getElementById('reported').addEventListener('click', e => {
24+
document.getElementById('report-issue').style.display = "none";
25+
document.getElementById('main').classList.remove("blur-background");
26+
});
27+
28+
29+
1930
/*
2031
let token =
2132
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo";

src/routes/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
*
1010
*/
1111

12-
/**
12+
const discordWebhook = require('webhook-discord');
13+
14+
/**
1315
* express module
1416
* @const
1517
*/
@@ -28,6 +30,8 @@ const config = require('../config/config');
2830
*/
2931
const router = express.Router();
3032

33+
const hook = config.DISCORD_WEBHOOK ? new discordWebhook.Webhook(config.DISCORD_WEBHOOK) : null;
34+
3135
/**
3236
* Route serving editorindex page
3337
* @name get/
@@ -56,4 +60,15 @@ router.post('/create_document', async (req, res) => {
5660
}
5761
});
5862

63+
router.post('/report-issue', async (req, res) => {
64+
try{
65+
const report = req.body.report;
66+
const agree = Boolean(req.body.agree);
67+
hook.warn('Report', `***Share data:*** ${agree}\n***Report:***\n${report}`);
68+
} catch (err) {
69+
console.log(err);
70+
throw new Error(err);
71+
}
72+
});
73+
5974
module.exports = router;

src/views/component/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a href="#" id="link-welcome">Welcome&#8239message</a>
77
<a href="https://github.com/allEyezOnCode/CodeWe">Github</a>
88
<a href="#">Support</a>
9-
<a href="#" id="link-report">Report&#8239issue</a>
9+
<a href="#report" id="link-report">Report&#8239issue</a>
1010
</div>
1111
Copyright © 2020 Dewilde Alexandre, Dubois Brieuc and Fischer Nicolas
1212
</div>
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
<div id="report-issue">
2-
Test
2+
<h3>Which problem do you want to report ?</h3>
3+
<iframe name="dummyframe" style="display: none;"></iframe>
4+
<form action="/report-issue" method="post" target="dummyframe">
5+
<textarea spellcheck="false" name="report"></textarea>
6+
<p>
7+
<input type="checkbox" checked name="agree"/><label>I agree to anonymously share certain browser-related information with the development team.</label>
8+
</p>
9+
<input type="submit" id="reported" value="Send" />
10+
</p>
11+
</form>
312
</div>

0 commit comments

Comments
 (0)