Redesigned admin pages

This commit is contained in:
Borna Rajković committed 2024-01-01 12:29:59 +01:00
1 parent 6163c0a04f
commit 9bdb5dd129
15 files changed
+527 -272

No files matched your search

+10 -12
View File
@@ -11,17 +11,15 @@ window.addEventListener('load', () => {
}
function generateQuery(query) {
initialQuery = `curl -H "accept: ${query['contentType']}" "https://holiday.bbr-dev.info/api/v1/holidays?country=${query['country']}`
initialQuery = `https://holiday.bbr-dev.info/api/v1/holidays?country=${query['country']}`
delete query['contentType'];
delete query['country'];
for(const key in query) {
initialQuery += `&${key}=${query[key]}`
}
initialQuery+='"';
document.querySelector('#result-content').innerHTML = initialQuery;
document.querySelector('#query-link').href = initialQuery;
document.querySelector('#result-content').innerHTML = "curl \"" + initialQuery + "\"";
}
let country = document.querySelector("#country");
@@ -36,10 +34,8 @@ window.addEventListener('load', () => {
let dDate = document.querySelector("#dsd-date");
let dStartRange = document.querySelector("#dsr-start-range");
let dStartRangeRequired = document.querySelector("#dsr-start-range-required");
let dEndRange = document.querySelector("#dsr-end-range");
let dEndRangeRequired = document.querySelector("#dsr-end-range-required");
let queryGenerator = document.querySelector("#query-generator");
@@ -53,6 +49,7 @@ window.addEventListener('load', () => {
if(religiousHoliday.value === 'true' || religiousHoliday.value === 'false') {
query['religiousHoliday'] = parseBoolean(religiousHoliday.value);
}
console.log(dateSelector.value, dStartRange.value, dEndRange.value);
switch(dateSelector.value) {
case 'year':
query['year'] = dYear.value;
@@ -63,10 +60,10 @@ window.addEventListener('load', () => {
}
break;
case 'range':
if(dStartRangeRequired.checked && dStartRange.value) {
if(dStartRange.value) {
query['startRange'] = dStartRange.value;
}
if(dEndRangeRequired.checked && dEndRange.value) {
if(dEndRange.value) {
query['endRange'] = dEndRange.value;
}
case 'all':
@@ -79,13 +76,14 @@ window.addEventListener('load', () => {
queryGenerator.addEventListener('change', event => {
const query = {};
query['country'] = country.value;
query['contentType'] = contentType.value;
query['type'] = contentType.value;
if(stateHoliday.value === 'true' || stateHoliday.value === 'false') {
query['stateHoliday'] = parseBoolean(stateHoliday.value);
}
if(religiousHoliday.value === 'true' || religiousHoliday.value === 'false') {
query['religiousHoliday'] = parseBoolean(religiousHoliday.value);
}
console.log(dateSelector.value, dStartRange.value, dEndRange.value);
switch(dateSelector.value) {
case 'year':
query['year'] = dYear.value;
@@ -96,10 +94,10 @@ window.addEventListener('load', () => {
}
break;
case 'range':
if(dStartRangeRequired.checked && dStartRange.value) {
if(dStartRange.value) {
query['startRange'] = dStartRange.value;
}
if(dEndRangeRequired.checked && dEndRange.value) {
if(dEndRange.value) {
query['endRange'] = dEndRange.value;
}
case 'all':
+219 -28
View File
@@ -2,7 +2,6 @@ body {
border: 0;
margin: 0;
padding: 0;
font-size: 20px;
}
main {
@@ -12,20 +11,44 @@ main {
position: relative;
}
header {
width: 100%;
box-sizing: border-box;
padding: 1em;
background: white;
position: sticky;
z-index: 10;
top: 0;
border-bottom: 1px solid #dddddd;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: baseline;
gap: 1em;
}
.dialog {
box-sizing: border-box;
border: 1px solid #e0e0e0;
background: white;
margin: auto;
padding: 16px 32px;
padding: 1em 0.5em;
}
@media screen and (min-width: 480px) {
.dialog {
padding: 1em 2em;
}
}
.background-image {
min-width: 100vw;
min-height: 100vh;
min-height: 100dvh;
max-width: 100vw;
max-height: 100vh;
max-height: 100dvh;
background: url("/assets/background.jpg");
background-position: bottom;
@@ -63,50 +86,65 @@ main {
}
h1 {
font-size: 2rem;
font-size: 1.1rem;
margin: 0;
}
h1 a {
all: unset;
}
h3 {
margin: 0.5em 0;
}
@media screen and (min-width: 480px) {
h1 {
font-size: 1.6rem;
}
}
.form-field {
width: 100%;
margin-bottom: 16px;
margin-bottom: 1em;
}
.form-field label {
display: block;
color: #999;
}
.form-field input {
width: 300px;
.form-field input, .form-field textarea {
width: 100%;
border: none;
border-bottom: 1px solid #bbb;
font-size: 20px;
font-size: 1rem;
outline: none;
}
.form-field input:focus {
.form-field .checkbox {
display: inline;
}
.form-field input[type=checkbox] {
width: inherit;
margin-left: 1em;
accent-color: #6a7579;
}
.form-field input:focus, .form-field textarea:focus {
color: cadetblue;
border-bottom: 1px solid cadetblue;
}
.form-field input:not(focus) {
.form-field input:not(focus), .form-field textarea:not(focus) {
color: #333;
}
.form-field label {
display: block;
color: #999;
}
.form-field select {
all: unset;
width: 100%;
border: none;
border-bottom: 1px solid #bbb;
font-size: 20px;
font-size: 1rem;
outline: none;
}
@@ -123,29 +161,28 @@ h1 a {
color: cadetblue;
}
.button.secondary, button.primary {
padding: 12px 16px;
.button.primary, button.primary {
padding: 0.75em 1em;
background-color: cadetblue;
font-family: Quicksand, Arial, sans-serif;
border: none;
color: white;
font-size: 1.2rem;
margin-top: 16px;
font-size: 1rem;
margin-top: 1em;
}
.button.secondary, button.primary:hover {
.button.primary, button.primary:hover {
filter: contrast(140%);
}
.button.secondary, button.secondary {
padding: 12px 16px;
padding: 0.75em 1em;
background-color: white;
font-family: Quicksand, Arial, sans-serif;
border: 1px solid cadetblue;
color: cadetblue;
font-size: 1.2rem;
margin-top: 16px;
font-size: 1rem;
margin-top: 1em;
}
.button.secondary:hover, button.secondary:hover {
@@ -155,11 +192,11 @@ h1 a {
/*index.html*/
.search-dialog {
position: absolute;
top: 0;
left: 0;
position: relative;
width: 100%;
padding-top: 40px;
padding-bottom: 40px;
border: none;
}
@media screen and (min-width: 480px) {
@@ -169,6 +206,7 @@ h1 a {
left: 10vw;
transform: translateY(-50%);
width: 380px;
padding-top: 40px;
padding-bottom: 40px;
}
}
@@ -179,6 +217,7 @@ h1 a {
width: 100%;
max-width: 100%;
padding-bottom: 40px;
border: none;
}
.results-dialog table {
@@ -193,6 +232,7 @@ h1 a {
.results-dialog {
position: relative;
margin: auto;
margin-top: 1em;
width: 600px;
padding-bottom: 40px;
}
@@ -200,4 +240,155 @@ h1 a {
.results td {
padding: 0.4em 0;
}
/*documentation.html*/
.documentation-dialog {
position: relative;
width: 100%;
max-width: 100%;
border: none;
}
@media screen and (min-width: 480px) {
.documentation-dialog {
position: relative;
margin: auto;
margin-top: 1em;
width: 600px;
}
}
.documentation-dialog #result-content {
font-family: 'Courier New', Courier, monospace;
background: #aaa;
padding: 1em;
word-break: break-word;
}
section.radio-group {
margin-bottom: 0.5em;
}
section.radio-group input {
display: none;
}
section.radio-group div label {
display: inline-block;
padding: 0.75em 1em;
border: none;
color: black;
font-size: 1rem;
background: #ddd;
}
section.radio-group div label {
min-width: 3ch;
text-align: center;
font-size: 1rem;
}
section.radio-group div label:first-of-type {
border-top-left-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
}
section.radio-group div label:last-of-type {
border-top-right-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
}
section.radio-group div input:checked+label {
background: cadetblue;
color: white;
}
.documentation-dialog .range-selector {
display: flex;
gap: 1em;
flex-direction: row;
flex-wrap: wrap;
}
.documentation-dialog .range-selector section {
flex-grow: 1;
width: initial;
}
.documentation-dialog .hide {
display: none;
}
.admin-dashboard {
display: flex;
flex-direction: row;
flex-wrap: wrap;
box-sizing: border-box;
margin: 1em;
gap: 1em;
background: transparent;
width: calc(100% - 2em);
}
.admin-dashboard .filter-dialog {
margin: 0;
width: 100%;
flex-grow: 1;
}
.admin-dashboard .table-results table {
width: 100%;
}
.admin-dashboard .table-results table th, .admin-dashboard .table-results table td {
text-align: left;
margin: 0.4em 0;
}
.admin-dashboard .table-results table tr td:nth-child(3) {
display: flex;
flex-direction: row;
}
@media screen and (min-width: 480px) {
.admin-dashboard .filter-dialog {
width: 300px;
flex-grow: 0;
}
}
img.icon, button.icon svg {
height: 1.2em;
width: 1.2em;
}
button.icon, a.icon {
border: none;
cursor: pointer;
background: transparent;
font-size: 1rem;
display: flex;
align-content: baseline;
gap: 0.3em;
}
button.icon svg, button.icon svg * {
fill: white;
color: white;
stroke: white;
}
dialog {
border: 1px solid rgba(95, 158, 160, 0.5);
}
dialog::backdrop {
background: rgba(151, 159, 159, 0.39);
}
dialog {
width: 400px;
max-width: 100vh;
}
-3
View File
@@ -5,11 +5,8 @@ window.addEventListener('load', () => {
const action = el.querySelector(".dropdown-action");
const content = el.querySelector(".dropdown-content");
console.log(action, content, el.offsetWidth, content.offsetWidth);
action.addEventListener('click', () => {
content.classList.toggle('selected');
console.log(content.offsetWidth - action.offsetWidth);
content.style.marginLeft = `-${(content.offsetWidth - action.offsetWidth)}px`;
})
})