optimize for production according to tailwindcss

main
samerbam 1 year ago
parent e8b8ebf0ea
commit 0188280ce1

@ -5,8 +5,8 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
<title>Test</title> <title>Test</title>
<script src="https://cdn.tailwindcss.com"></script> <!-- <script src="https://cdn.tailwindcss.com"></script> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css" /> <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css" /> -->
<link rel="stylesheet" type="text/css" href="styles.css"> <link rel="stylesheet" type="text/css" href="styles.css">
</head> </head>
@ -263,38 +263,7 @@
animation: 150 animation: 150
}); });
</script> </script>
<!-- jsDelivr :: Swiper :: Latest (https://www.jsdelivr.com/package/npm/swiper) -->
<!-- <script src="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.js"></script>
<script type="text/javascript">
var defaults = {
pagination: '.swiper-pagination',
slidesPerView: 3,
freeMode: true,
freeModeSticky: false,
freeModeMomentumRatio: 0.25,
freeModeVelocityRatio: 0.25,
freeModeMinimumVelocity: 0.1,
mousewheelControl: true,
mousewheelSensitivity: 0.5,
loop: false,
loopAdditionalSlides: 5,
direction: 'vertical',
slideToClickedSlide: true,
centeredSlides: true
};
new Swiper(
'.swiper-container.hours',
Object.assign({}, defaults, { initialSlide: 13})
);
new Swiper(
'.swiper-container.minutes',
Object.assign({}, defaults, { initialSlide: 37})
);
new Swiper('.swiper-container.seconds', defaults);
</script> -->
<!-- jsDelivr :: Day.js :: Latest (https://www.jsdelivr.com/package/npm/dayjs) --> <!-- jsDelivr :: Day.js :: Latest (https://www.jsdelivr.com/package/npm/dayjs) -->
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/customParseFormat.js"></script> <script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/customParseFormat.js"></script>
@ -305,241 +274,13 @@
document.getElementById("startTimeLabel").innerHTML = now.format("h:mm a") document.getElementById("startTimeLabel").innerHTML = now.format("h:mm a")
document.getElementById("endTimeLabel").innerHTML = now.add(1, 'h').format("h:mm a") document.getElementById("endTimeLabel").innerHTML = now.add(1, 'h').format("h:mm a")
document.getElementById("timeInput").value = dayjs().format("HH:mm") document.getElementById("timeInput").value = dayjs().format("HH:mm")
// console.log(dayjs().format("HH:mm"))
// console.log(dayjs().add(1, 'h').format("HH:mm"))
</script> </script>
<!-- Auth0 for login prompt -->
<script src="https://cdn.auth0.com/js/auth0-spa-js/2.0/auth0-spa-js.production.js"></script> <script src="https://cdn.auth0.com/js/auth0-spa-js/2.0/auth0-spa-js.production.js"></script>
<script>
// $('#getTokenPopup').click(async () => {
// const token = await auth0.getTokenWithPopup({
// authorizationParams: {
// audience: 'https://mydomain/api/',
// scope: 'read:rules'
// }
// });
// });
// import { createAuth0Client } from '@auth0/auth0-spa-js';
// let jToken = ""
// function loginAction(e) {
// auth0.createAuth0Client({
// domain: 'dev-kazsp1tz0e7t5d07.us.auth0.com',
// clientId: 'Pw2MvNmIAJUA4THZzsZTEeqkXnCTHYr3'
// }).then(a0 => {
// const token = a0.getTokenWithPopup({
// authorizationParams: {
// audience: 'https://RecieptTodos.imsam.ca',
// scope: 'todos:all'
// }
// });
// token.then(t => {
// // document.getElementById("loginPanel").classList.add("hidden")
// // console.log(t)
// jToken = t
// getTodosFromAPI()
// // document.getElementById("testToken").innerHTML = t
// // fetch('/api/todos/get?' + new URLSearchParams({
// // date: dayjs().format("YYYY-MM-DD"),
// // }), {
// // method: 'GET',
// // withCredentials: true,
// // credentials: 'include',
// // headers: {
// // 'Authorization': "Bearer " + t,
// // }
// // }).then(re => {
// // re.json().then(jso => {
// // console.log(jso)
// // for (let todo of jso.todos) {
// // console.log(todo)
// // // function addTask(defaultTimeRange="", defaultTaskText="New Task", editable=true) {
// // addTask(defaultTimeRange=todo.time, defaultTaskText=todo.text, editable=false)
// // }
// // })
// // // var items = JSON.parse(re.json())
// // // console.log(items.json)
// // })
// //TODO: Make call with token to backend to load all current todos
// })
// });
// };
// function getTodosFromAPI() {
// document.getElementById("loginPanel").classList.add("hidden")
// console.log(jToken)
// // console.log(t)
// // jToken = t
// // document.getElementById("testToken").innerHTML = t
// fetch('/api/todos/get?' + new URLSearchParams({
// date: dayjs().format("YYYY-MM-DD"),
// }), {
// method: 'GET',
// withCredentials: true,
// credentials: 'include',
// headers: {
// 'Authorization': "Bearer " + jToken,
// }
// }).then(re => {
// re.json().then(jso => {
// console.log(jso)
// for (let todo of jso.todos) {
// console.log(todo)
// // function addTask(defaultTimeRange="", defaultTaskText="New Task", editable=true) {
// addTask(defaultTimeRange=todo.time, defaultTaskText=todo.text, editable=false)
// }
// })
// // var items = JSON.parse(re.json())
// // console.log(items.json)
// })
// //TODO: Make call with token to backend to load all current todos
// }
// document.getElementById("loginButton").addEventListener('click', loginAction)
// document.getElementById("loginButton").addEventListener('click', (e) => {
// auth0.createAuth0Client({
// domain: 'dev-kazsp1tz0e7t5d07.us.auth0.com',
// clientId: 'Pw2MvNmIAJUA4THZzsZTEeqkXnCTHYr3'
// }).then(a0 => {
// const token = a0.getTokenWithPopup({
// authorizationParams: {
// audience: 'https://RecieptTodos.imsam.ca',
// scope: 'todos:all'
// }
// });
// token.then(t => {
// document.getElementById("loginPanel").classList.add("hidden")
// console.log(t)
// jToken = t
// // document.getElementById("testToken").innerHTML = t
// fetch('/api/todos/get?' + new URLSearchParams({
// date: dayjs().format("YYYY-MM-DD"),
// }), {
// method: 'GET',
// withCredentials: true,
// credentials: 'include',
// headers: {
// 'Authorization': "Bearer " + t,
// }
// }).then(re => {
// re.json().then(jso => {
// console.log(jso)
// for (let todo of jso.todos) {
// console.log(todo)
// // function addTask(defaultTimeRange="", defaultTaskText="New Task", editable=true) {
// addTask(defaultTimeRange=todo.time, defaultTaskText=todo.text, editable=false)
// }
// })
// // var items = JSON.parse(re.json())
// // console.log(items.json)
// })
// //TODO: Make call with token to backend to load all current todos
// })
// });
<!-- Google auth for calendar access on first launch -->
// }); <script src="https://accounts.google.com/gsi/client" defer></script>
</script>
<!-- Google auth for calendar access on first launch-->
<script src="https://accounts.google.com/gsi/client"></script>
<script type="text/javascript">
// let first_run = null
// let test =
// console.log(test)
// let client = null
// async function mainAsync() {
// console.log('huh')
// async function check_first_run() {
// let res = await fetch("/api/first_run")
// let resJ = await res.json()
// return resJ
// // return fetch("/api/first_run").then(r => {
// // return r.json().then(j => {
// // first_run = j
// // console.log(j)
// // return j
// // })
// // })
// }
// let first_run_status = await check_first_run()
// if (first_run_status["status"] === "First Run") {
// document.getElementById("googleAuthModel").classList.remove("hidden")
// let code_receiver_uri = "/api/google/update"
// client = google.accounts.oauth2.initCodeClient({
// client_id: '186960779149-ejtu6hh3kdatlouau80h2pivt4tv3hd0.apps.googleusercontent.com',
// scope: 'https://www.googleapis.com/auth/calendar.readonly',
// ux_mode: 'popup',
// callback: (response) => {
// const xhr = new XMLHttpRequest();
// xhr.open('POST', code_receiver_uri, true);
// xhr.setRequestHeader('Content-Type', 'application/json');
// xhr.setRequestHeader('Authorization', 'Bearer ' + jToken);
// // Set custom header for CRSF
// xhr.setRequestHeader('X-Requested-With', 'XmlHttpRequest');
// xhr.onload = function() {
// console.log('Auth code response: ' + xhr.responseText);
// document.getElementById("googleAuthModel").classList.add("hidden")
// };
// xhr.send(JSON.stringify({"code": response.code}));
// console.log(xhr)
// console.log(response.code)
// },
// });
// }
// // console.log(test)
// // console.log(first_run)
// // function check_first_run() {
// // let first_run = ""
// // const req = new XMLHttpRequest();
// // // req.addEventListener("load", reqListener);
// // req.open("GET", "/api/first_run", false);
// // req.onload = function() {
// // first_run = req.responseText
// // // console.log(first_run)
// // }
// // req.send();
// // return first_run
// // console.log(first_run)
// // }
// // console.log(check_first_run())
// }
// mainAsync()
</script>
<script src="scripts.js"></script> <script src="scripts.js"></script>
</body> </body>

File diff suppressed because one or more lines are too long

@ -0,0 +1,204 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
body {
touch-action: manipulation;
}
#radios {
position: relative;
background-color:rgba(239,239,240,1);
z-index:5;
width: 245.5px;
border-radius: 10px;
margin-top: 15px;
}
input[type="radio"] {
display: none;
}
#bckgrnd,
.labels {
width: 120px;
height: 66px;
text-align: center;
display: inline-block;
margin-right: -3px;
z-index: 2;
cursor: pointer;
}
.labels {
padding-top: 7.5px;
}
#bckgrnd {
width: 115px;
height: 55px;
background-color: white;
border: .5px solid rgba(0,0,0,0.04);
box-shadow: 0 3px 8px 0 rgba(0,0,0,0.12), 0 3px 1px 0 rgba(0,0,0,0.04);
position: absolute;
left: 5px;
top: 5px;
border-radius: 7px;
z-index: -1;
}
#rad1:checked ~ #bckgrnd {
transform: translateX(0);
transition: transform 0.3s ease-in-out;
}
#rad2:checked ~ #bckgrnd {
transform: translateX(120px);
transition: transform 0.3s ease-in-out;
}
.picker {
position: relative;
width: 300px;
overflow: hidden;
margin: 1rem auto 0;
outline: 1px solid #ccc;
padding: 0 30px;
}
.swiper-container {
width: 80px;
height: 210px;
float: left;
}
.swiper-slide {
text-align: center;
font-size: 2rem;
display: flex;
justify-content: center;
align-items: center;
user-select: none;
opacity: 0.25;
transition: opacity 0.3s ease;
cursor: default;
font-weight: bold;
-webkit-tap-highlight-color: transparent;
}
.swiper-slide-prev,
.swiper-slide-next {
cursor: pointer;
}
.swiper-slide-active {
opacity: 1;
}
.vizor {
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
height: 70px;
position: absolute;
top: 50%;
left: 1rem;
right: 1rem;
transform: translateY(-50%);
font-size: 2rem;
line-height: 62px;
}
.vizor:before,
.vizor:after {
content: ':';
display: inline-block;
line-height: inherit;
height: 100%;
position:absolute;
top: 0;
transform: translateX(-50%);
}
.vizor:before {
left: 95px;
}
.vizor:after {
left: 175px;
}
.arrows .swiper-container:after,
.arrows .swiper-container:before {
content: "";
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border-style: solid;
border-width: 4px;
border-color: transparent;
opacity: 0.5;
}
.arrows .swiper-container:before {
top: 0.5rem;
border-top-width: 0;
border-bottom-color: currentColor;
}
.arrows .swiper-container:after {
bottom: 0.5rem;
border-bottom-width: 0;
border-top-color: currentColor;
}
/*.donate-now {*/
/* list-style-type: none;*/
/* margin: 25px 0 0 0;*/
/* padding: 0;*/
/*}*/
/*.donate-now li {
float: left;
margin: 0 5px 0 0;
width: 100px;
height: 40px;
position: relative;
}*/
/*.donate-now label,
.donate-now input {
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}*/
/*.donate-now input[type="radio"] {
opacity: 0.01;
z-index: 100;
}*/
.donate-now input[type="radio"]:checked+label { /*, .Checked+label */
border-color: rgb(79 70 229);
}
/*.donate-now label {
padding: 5px;
border: 1px solid #CCC;
cursor: pointer;
z-index: 90;
}
.donate-now label:hover {
background: #DDD;
} */

@ -0,0 +1,16 @@
{
"name": "thermaltodos",
"version": "1.0.0",
"description": "Prints out your daily google calander events using a thermal printer.",
"scripts": {
"build": "npx tailwindcss -i ./application/static/styles_raw.css -o ./application/static/styles.css --minify",
"auto_build": "npx tailwindcss -i ./application/static/styles_raw.css -o ./application/static/styles.css --watch",
"test": "uvicorn application.main:app --host 127.0.0.1 --port 8000 --reload"
},
"repository": {
"type": "git",
"url": "https://git.imsam.ca/sam/ThermalTodos.git"
},
"author": "Sam",
"license": ""
}

@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['/application/static/*.{html,js}'],
theme: {
extend: {},
},
plugins: [],
}
Loading…
Cancel
Save