Skip to content

Commit f674918

Browse files
committed
Made mails and reports table responsive for small screens
1 parent bbd7ba0 commit f674918

File tree

3 files changed

+49
-21
lines changed

3 files changed

+49
-21
lines changed

ui/components/mailtable.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ export class MailTable extends LitElement {
5959
<table>
6060
<tr>
6161
<th>Subject</th>
62-
<th>Sender</th>
63-
<th>Date</th>
64-
<th class="help" title="Size of E-Mail in Bytes">Size</th>
65-
<th class="help" title="Number of XML files in the Mail">XMLs</th>
66-
<th class="help" title="Did the Mail cause DMARC Parsing Errors?">Errors</th>
62+
<th class="sm-hidden">Sender</th>
63+
<th class="md-hidden">Date</th>
64+
<th class="xs-hidden help" title="Size of E-Mail in Bytes">Size</th>
65+
<th class="md-hidden help" title="Number of XML files in the Mail">XMLs</th>
66+
<th class="xs-hidden help" title="Did the Mail cause DMARC Parsing Errors?">Errors</th>
6767
</tr>
6868
${this.mails.length !== 0 ? this.mails.map((mail) =>
6969
html`<tr>
7070
<td><a href="#/mails/${mail.uid}">${this.prepareSubject(mail.subject)}</a></td>
71-
<td><a href="#/mails?sender=${encodeURIComponent(mail.sender)}">${mail.sender}</a></td>
72-
<td>${new Date(mail.date * 1000).toLocaleString()}</td>
73-
<td>${this.prepareSize(mail)}</td>
74-
<td>${this.prepareXmlFileCount(mail)}</td>
75-
<td>${this.prepareParsingError(mail)}</td>
71+
<td class="sm-hidden"><a href="#/mails?sender=${encodeURIComponent(mail.sender)}">${mail.sender}</a></td>
72+
<td class="md-hidden">${new Date(mail.date * 1000).toLocaleString()}</td>
73+
<td class="xs-hidden">${this.prepareSize(mail)}</td>
74+
<td class="md-hidden">${this.prepareXmlFileCount(mail)}</td>
75+
<td class="xs-hidden">${this.prepareParsingError(mail)}</td>
7676
</tr>`
7777
) : html`<tr>
7878
<td colspan="4">No mails found.</td>

ui/components/reporttable.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ export class ReportTable extends LitElement {
1313
this.reports = [];
1414
}
1515

16+
prepareId(id) {
17+
const limit = 25;
18+
if (id.length <= limit) {
19+
return id;
20+
} else {
21+
return id.substring(0, limit) + "...";
22+
}
23+
}
24+
1625
renderProblemsBadge(problems) {
1726
if (problems) {
1827
return html`<span class="badge badge-negative">Yes</span>`;
@@ -26,22 +35,22 @@ export class ReportTable extends LitElement {
2635
<table>
2736
<tr>
2837
<th>ID</th>
29-
<th>Organization</th>
30-
<th>Domain</th>
38+
<th class="xs-hidden">Organization</th>
39+
<th class="sm-hidden">Domain</th>
3140
<th class="help" title="Reports that indicate possible problems">Problems</th>
32-
<th>Records</th>
33-
<th>Begin</th>
34-
<th>End</th>
41+
<th class="sm-hidden">Records</th>
42+
<th class="md-hidden">Begin</th>
43+
<th class="md-hidden">End</th>
3544
</tr>
3645
${this.reports.length !== 0 ? this.reports.map((report) =>
3746
html`<tr>
38-
<td><a href="#/reports/${report.hash}">${report.id}</a></td>
39-
<td><a href="#/reports?org=${encodeURIComponent(report.org)}">${report.org}</a></td>
40-
<td><a href="#/reports?domain=${encodeURIComponent(report.domain)}">${report.domain}</a></td>
47+
<td><a href="#/reports/${report.hash}" title="${report.id}">${this.prepareId(report.id)}</a></td>
48+
<td class="xs-hidden"><a href="#/reports?org=${encodeURIComponent(report.org)}">${report.org}</a></td>
49+
<td class="sm-hidden"><a href="#/reports?domain=${encodeURIComponent(report.domain)}">${report.domain}</a></td>
4150
<td>${this.renderProblemsBadge(report.flagged)}</td>
42-
<td>${report.records}</td>
43-
<td>${new Date(report.date_begin * 1000).toLocaleString()}</td>
44-
<td>${new Date(report.date_end * 1000).toLocaleString()}</td>
51+
<td class="sm-hidden">${report.records}</td>
52+
<td class="md-hidden">${new Date(report.date_begin * 1000).toLocaleString()}</td>
53+
<td class="md-hidden">${new Date(report.date_end * 1000).toLocaleString()}</td>
4554
</tr>`
4655
4756
) : html`<tr>

ui/components/style.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export const globalStyle = css`
9191
color: white;
9292
border-radius: 3px;
9393
background-color: rgb(108, 117, 125);
94+
margin-bottom: 3px;
9495
}
9596
9697
.button:hover {
@@ -101,4 +102,22 @@ export const globalStyle = css`
101102
.ml {
102103
margin-left: 10px;
103104
}
105+
106+
@media only screen and (max-width: 1100px) {
107+
.md-hidden {
108+
display: none;
109+
}
110+
}
111+
112+
@media only screen and (max-width: 800px) {
113+
.sm-hidden {
114+
display: none;
115+
}
116+
}
117+
118+
@media only screen and (max-width: 600px) {
119+
.xs-hidden {
120+
display: none;
121+
}
122+
}
104123
`;

0 commit comments

Comments
 (0)