Style fixes for tracker page

- Restore single search bar
- Restore cell borders
- Restore row highlighting on hover
- Utilize more vertical space
- Remove sorting arrows
This commit is contained in:
Chris Wilson 2020-07-25 02:07:52 -04:00
parent 789d0245cc
commit 3ea435c66c
5 changed files with 68 additions and 13 deletions

View File

@ -3,7 +3,6 @@ body{
background-color: #dce2bd; background-color: #dce2bd;
font-size: 1.2rem; font-size: 1.2rem;
font-family: "Segoe UI", Arial, sans-serif; font-family: "Segoe UI", Arial, sans-serif;
margin-top: 0.5rem;
} }
/** Button Styles */ /** Button Styles */

View File

@ -1,11 +1,12 @@
table.dataTable{ table.dataTable{
width: 100% !important; width: 100%;
} }
table.dataTable, table.dataTable.no-footer{ table.dataTable, table.dataTable.no-footer{
border: none; border: none;
font-size: 1rem; font-size: 1rem;
text-align: left; text-align: left;
border-collapse: collapse;
} }
.dataTables_wrapper .dataTables_filter{ .dataTables_wrapper .dataTables_filter{

View File

@ -1,22 +1,52 @@
#tracker-wrapper{ #tracker-wrapper{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between;
width: 100%;
} }
.table-wrapper{ .table-wrapper{
max-height: 400px;
overflow-y: auto; overflow-y: auto;
overflow-x: auto; overflow-x: auto;
width: 100%; margin-bottom: 2rem;
max-height: 425px;
}
#search{
width: 200px;
height: 20px;
margin-bottom: 0.5rem;
}
.table-wrapper table tbody tr:hover{
background-color: #e2eabb;
} }
div.dataTables_wrapper.no-footer .dataTables_scrollBody{ div.dataTables_wrapper.no-footer .dataTables_scrollBody{
border: none; border: none;
} }
table.dataTable{ table.dataTable tbody th, table.dataTable tbody td{
margin-top: 0.5rem; padding: 4px 6px;
margin-bottom: 2rem; }
table.dataTable, table.dataTable.no-footer{
border-left: 1px solid #bba967;
width: calc(100% - 2px) !important;
font-size: 1rem;
}
table.dataTable thead{
position: sticky;
top: 0;
}
table.dataTable thead .sorting, table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc{
background-image: none;
}
table.dataTable tbody td{
border: 1px solid #bba967;
} }
div.dataTables_scrollBody{ div.dataTables_scrollBody{
@ -33,14 +63,30 @@ img.alttp-sprite {
min-height: 14px; min-height: 14px;
} }
@media all and (max-width: 1600px) { .item-acquired{
background-color: #d3c97d;
}
@media all and (max-width: 1700px) {
table.dataTable, table.dataTable.no-footer{
font-size: 0.8rem;
}
img.alttp-sprite { img.alttp-sprite {
height: auto; height: auto;
max-height: 16px; max-height: 24px;
min-height: 10px; min-height: 10px;
} }
} }
.item-acquired{ @media all and (max-width: 1400px) {
background-color: green; table.dataTable, table.dataTable.no-footer{
font-size: 0.6rem;
}
img.alttp-sprite {
height: auto;
max-height: 20px;
min-height: 10px;
}
} }

View File

@ -2,12 +2,18 @@ window.addEventListener('load', () => {
const tables = $(".table").DataTable({ const tables = $(".table").DataTable({
paging: false, paging: false,
info: false, info: false,
scrollCollapse: true, dom: "t",
// DO NOT use the scrollX or scrollY options. They cause DataTables to split the thead from // DO NOT use the scrollX or scrollY options. They cause DataTables to split the thead from
// the tbody and render two separate tables. // the tbody and render two separate tables.
}); });
document.getElementById('search').addEventListener('keyup', (event) => {
tables.search(event.target.value);
console.info(tables.search());
tables.draw();
});
const update = () => { const update = () => {
const target = $("<div></div>"); const target = $("<div></div>");
const tracker = document.getElementById('tracker-wrapper').getAttribute('data-tracker'); const tracker = document.getElementById('tracker-wrapper').getAttribute('data-tracker');
@ -32,6 +38,8 @@ window.addEventListener('load', () => {
setInterval(update, 30000); setInterval(update, 30000);
window.addEventListener('resize', () => tables.draw());
$(".dataTables_scrollBody").scrollsync({ $(".dataTables_scrollBody").scrollsync({
y_sync: true, y_sync: true,
x_sync: true x_sync: true

View File

@ -9,6 +9,7 @@
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<div id="tracker-wrapper" data-tracker="{{ room.tracker }}"> <div id="tracker-wrapper" data-tracker="{{ room.tracker }}">
<input placeholder="Search" id="search" />
{% for team, players in inventory.items() %} {% for team, players in inventory.items() %}
<div class="table-wrapper"> <div class="table-wrapper">
<table class="table unique-item-table"> <table class="table unique-item-table">
@ -76,7 +77,7 @@
<th colspan="{{ colspan }}" class="center-column">{{ area }}</th> <th colspan="{{ colspan }}" class="center-column">{{ area }}</th>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<th rowspan="2">Last<br>Activity</th> <th rowspan="2" class="center-column">Last<br>Activity</th>
</tr> </tr>
<tr> <tr>
{% for area in ordered_areas %} {% for area in ordered_areas %}