This commit is contained in:
sairaj mote 2020-09-30 03:22:17 +05:30
parent 9c1053769a
commit 398f14e85e
4 changed files with 62 additions and 5 deletions

View File

@ -30,6 +30,10 @@ body[data-theme=dark] {
--text-color-light: 170, 170, 170; --text-color-light: 170, 170, 170;
--foreground-color: 26, 26, 26; --foreground-color: 26, 26, 26;
--background-color: #111; --background-color: #111;
--dark-shade: #222;
--hue: 255;
--saturation: 39%;
--lightness: 70%;
background-color: var(--background-color); background-color: var(--background-color);
} }
body[data-theme=dark] .balance:nth-of-type(3) { body[data-theme=dark] .balance:nth-of-type(3) {
@ -154,6 +158,10 @@ button:disabled ~ .loader {
flex-direction: column; flex-direction: column;
} }
.justify-right {
margin-left: auto;
}
.space-between { .space-between {
justify-content: space-between; justify-content: space-between;
} }
@ -1236,7 +1244,7 @@ sm-panel {
#settings_page > h4 { #settings_page > h4 {
margin-top: 2rem; margin-top: 2rem;
margin-bottom: 0.5rem; margin-bottom: 0.4rem;
} }
#settings_page p { #settings_page p {
color: rgba(var(--text-color), 0.7); color: rgba(var(--text-color), 0.7);
@ -1244,6 +1252,9 @@ sm-panel {
#settings_page sm-button { #settings_page sm-button {
margin-top: 0.8rem; margin-top: 0.8rem;
} }
#settings_page .flex {
max-width: 60ch;
}
@media only screen and (max-width: 640px) { @media only screen and (max-width: 640px) {
#home_page, #deposit { #home_page, #deposit {

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,10 @@ body[data-theme="dark"]{
--text-color-light: 170, 170, 170; --text-color-light: 170, 170, 170;
--foreground-color: 26, 26, 26; --foreground-color: 26, 26, 26;
--background-color: #111; --background-color: #111;
--dark-shade: #222;
--hue: 255;
--saturation: 39%;
--lightness: 70%;
background-color: var(--background-color); background-color: var(--background-color);
.balance:nth-of-type(3){ .balance:nth-of-type(3){
color: rgba(var(--text-color), 1); color: rgba(var(--text-color), 1);
@ -153,6 +157,10 @@ button {
flex-direction: column; flex-direction: column;
} }
.justify-right{
margin-left: auto;
}
.space-between { .space-between {
justify-content: space-between; justify-content: space-between;
} }
@ -1299,7 +1307,7 @@ sm-panel{
#settings_page{ #settings_page{
& > h4{ & > h4{
margin-top: 2rem; margin-top: 2rem;
margin-bottom: 0.5rem; margin-bottom: 0.4rem;
} }
p{ p{
color: rgba(var(--text-color), 0.7); color: rgba(var(--text-color), 0.7);
@ -1307,6 +1315,9 @@ sm-panel{
sm-button{ sm-button{
margin-top: 0.8rem; margin-top: 0.8rem;
} }
.flex{
max-width: 60ch;
}
} }
@media only screen and (max-width: 640px) { @media only screen and (max-width: 640px) {
#home_page, #deposit{ #home_page, #deposit{

View File

@ -828,6 +828,11 @@
</svg> </svg>
</div> </div>
</section> </section>
<h4>Theme</h4>
<div class="flex">
<p>Toggle dark theme</p>
<sm-switch id="theme_switcher" class="justify-right"></sm-switch>
</div>
<h4>My UPIs</h4> <h4>My UPIs</h4>
<div class="upi-container"></div> <div class="upi-container"></div>
<p class="empty-state">Add UPI address for easier access during various transactions.</p> <p class="empty-state">Add UPI address for easier access during various transactions.</p>
@ -1337,6 +1342,35 @@
notifications.clearAll() notifications.clearAll()
notify('We are back online.', '', '', true) notify('We are back online.', '', '', true)
}) })
let themeSwitcher = document.getElementById('theme_switcher')
if (localStorage.theme === "dark") {
nightlight()
themeSwitcher.checked = true;
} else {
daylight()
themeSwitcher.checked = false;
}
function daylight() {
document.body.setAttribute("data-theme", "light");
}
function nightlight() {
document.body.setAttribute("data-theme", "dark");
}
themeSwitcher.addEventListener('change', function(e){
if(this.checked){
nightlight();
localStorage.setItem("theme", "dark");
}
else{
daylight();
localStorage.setItem("theme", "light");
}
})
// function required for popups or modals to appear // function required for popups or modals to appear
class Stack { class Stack {
constructor() { constructor() {
@ -1746,7 +1780,8 @@
}) })
document.getElementById('settings_page').addEventListener('change', e => { document.getElementById('settings_page').addEventListener('change', e => {
setPrimaryUPI(e.target.value) if(e.target.closest('.upi-container'))
setPrimaryUPI(e.target.value)
}) })
document.getElementById('settings_page').addEventListener('click', async e => { document.getElementById('settings_page').addEventListener('click', async e => {
if(e.target.closest('.remove') && await confirmation('Do you want to remove this UPI address?', 'No', 'Remove UPI')){ if(e.target.closest('.remove') && await confirmation('Do you want to remove this UPI address?', 'No', 'Remove UPI')){
@ -1788,7 +1823,7 @@
function showTransactionDetails(obj){ function showTransactionDetails(obj){
let {type, timeStamp, } = obj; let {type, timeStamp, } = obj;
if(type === 'payCashier') if(type === 'payCashier')
type = 'Pay through cashier' type = 'Paid through cashier'
transactionType.textContent = type transactionType.textContent = type
transactionTime.textContent = formatedTime(timeStamp) transactionTime.textContent = formatedTime(timeStamp)
showPage('transaction_page') showPage('transaction_page')