Rename old python folder.
This commit is contained in:
parent
b45d4fa8dc
commit
0f2f3094e0
@ -98,4 +98,11 @@ a.router-link-active{
|
||||
}
|
||||
a:hover{
|
||||
color: white;
|
||||
}
|
||||
|
||||
div#app{
|
||||
height: 95vh;
|
||||
}
|
||||
div#table{
|
||||
height: 100%;
|
||||
}
|
||||
@ -17,6 +17,10 @@
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.ht__active_highlight, .ht__highlight {
|
||||
background: unset;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
filter: contrast(85%);
|
||||
}
|
||||
@ -24,6 +28,9 @@
|
||||
.invert {
|
||||
filter: invert();
|
||||
}
|
||||
.active-hour{
|
||||
background: white !important;
|
||||
}
|
||||
|
||||
.day-of-week{
|
||||
text-transform: uppercase;
|
||||
|
||||
@ -41,10 +41,17 @@ class AppwriteService {
|
||||
return await this.getUser();
|
||||
}
|
||||
|
||||
getEntries = async (date=null, numEntries=25) => {
|
||||
if(date == null){date = DateTime.now()}
|
||||
|
||||
date = DateTime.fromISO(date);
|
||||
getEntries = async (date=null, numEntries=null) => {
|
||||
if(date == null){
|
||||
date = DateTime.fromObject({
|
||||
year: DateTime.now().toFormat("y"),
|
||||
month: 1,
|
||||
day: 2
|
||||
});
|
||||
}
|
||||
else{
|
||||
date = DateTime.fromISO(date);
|
||||
}
|
||||
|
||||
var firstEntry = (await this.database.listDocuments(
|
||||
this.databaseId, this.collectionId,
|
||||
@ -54,6 +61,10 @@ class AppwriteService {
|
||||
|
||||
var offset = Math.floor(date.diff(referenceDate).as("days")) - 1;
|
||||
|
||||
if (numEntries == null) {
|
||||
numEntries = Math.floor(DateTime.now().diff(referenceDate).as("days")) + 7;
|
||||
}
|
||||
|
||||
return (await this.database.listDocuments(
|
||||
this.databaseId, this.collectionId,
|
||||
[
|
||||
|
||||
@ -45,7 +45,7 @@ function getHourClass(i) {
|
||||
10: "lime"
|
||||
}
|
||||
if(i > 10){
|
||||
i = Math.round(i/10) - 1
|
||||
i = Math.ceil(i/10) - 1
|
||||
}
|
||||
if (i == null) {
|
||||
return "";
|
||||
@ -117,7 +117,7 @@ const ExampleComponent = defineComponent({
|
||||
rowHeaders: false,
|
||||
readOnly: false,
|
||||
width: '100%',
|
||||
height: 'auto',
|
||||
height: '100%',
|
||||
rowHeights: '22px',
|
||||
colWidths(i) {
|
||||
if((i > 1) && (i < 26)){
|
||||
@ -149,23 +149,59 @@ const ExampleComponent = defineComponent({
|
||||
},
|
||||
async mounted(){
|
||||
this.user = await appwrite.getUser();
|
||||
this.entries = await appwrite.getEntries(null,5);
|
||||
this.entries = await appwrite.getEntries();
|
||||
this.updateTable();
|
||||
this.subscribe();
|
||||
this.fixSelectionBug();
|
||||
//this.lazyLoadEntries();
|
||||
this.scrollToEnd();
|
||||
this.selectCurrentCell();
|
||||
},
|
||||
created () {
|
||||
window.addEventListener('wheel', debounce(this.handleScroll, 500, true));
|
||||
// window.addEventListener('wheel', debounce(this.handleScroll, 500, true));
|
||||
},
|
||||
unmounted () {
|
||||
window.removeEventListener('wheel', debounce(this.handleScroll, 500, true));
|
||||
// window.removeEventListener('wheel', debounce(this.handleScroll, 500, true));
|
||||
},
|
||||
updated() {
|
||||
this.scrollToEnd();
|
||||
},
|
||||
methods: {
|
||||
selectCurrentCell(){
|
||||
var nowRow = this.entries.findIndex((e) =>
|
||||
DateTime.fromISO(e.date).toISODate() == DateTime.now().toISODate()) - 1;
|
||||
var nowCol = parseInt(DateTime.now().toFormat("HH")) + 1;
|
||||
this.hotRef.selectCell(nowRow, nowCol);
|
||||
},
|
||||
scrollToEnd() {
|
||||
this.hotRef.scrollViewportTo(
|
||||
this.entries.length - 10
|
||||
);
|
||||
},
|
||||
async lazyLoadEntries(){
|
||||
var earliestDate = DateTime.fromObject({
|
||||
year: DateTime.now().toFormat("y"),
|
||||
month: 1,
|
||||
day: 1
|
||||
});
|
||||
var numEntries = Math.floor(DateTime.now().diff(earliestDate).as("days"));
|
||||
console.log("Grabbing " + numEntries + " entries starting from " + earliestDate.toISODate());
|
||||
var newEntries = await appwrite.getEntries(
|
||||
earliestDate.plus({days: 1}),
|
||||
numEntries);
|
||||
var entries = this.entries;
|
||||
newEntries.reverse().forEach((e) => {
|
||||
entries.unshift(e);
|
||||
})
|
||||
this.entries = entries;
|
||||
this.hotRef.scrollViewportTo(129);
|
||||
},
|
||||
setActiveHourHeader(){
|
||||
var timeString = DateTime.now().toFormat("hh a");
|
||||
var currentTimeHeader = Array.from(document.querySelectorAll("th"))
|
||||
.find(el => el.innerText == timeString);
|
||||
currentTimeHeader.className = "invert";
|
||||
var timeString = DateTime.now().toFormat("h a");
|
||||
console.log(timeString);
|
||||
var moot = Array.from(document.querySelectorAll("th"));
|
||||
var poot = moot.filter((e) => { return e.innerText == timeString});
|
||||
poot[0].classList.add("active-hour");
|
||||
},
|
||||
async handleScroll(e){
|
||||
if(e.deltaY > 0){
|
||||
@ -235,6 +271,23 @@ const ExampleComponent = defineComponent({
|
||||
updateTable(){
|
||||
this.hotRef = this.$refs.wrapper.hotInstance;
|
||||
this.hotRef.loadData(this.entries);
|
||||
},
|
||||
rewrite(d){
|
||||
var emptyEntry = {
|
||||
date: d.toISODate(),
|
||||
hours: [],
|
||||
mood: null,
|
||||
comments: ""
|
||||
}
|
||||
appwrite.updateEntry(emptyEntry);
|
||||
console.log("Updated " + d.toISODate());
|
||||
},
|
||||
rewriteEntries(){
|
||||
const startDate = DateTime.fromISO("2023-12-10");
|
||||
const endDate = DateTime.fromISO("2023-12-31");
|
||||
for(var d = startDate; d <= endDate; d = d.plus({days: 1})){
|
||||
setTimeout(this.rewrite(d), 500);
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@ -247,7 +300,7 @@ export default ExampleComponent;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button @click="concatEntries">Fuck</button>
|
||||
<button @click="this.setActiveHourHeader()">Fuck</button>
|
||||
<!-- <div>{{ entries }}</div>
|
||||
|
||||
<ul>
|
||||
@ -255,7 +308,9 @@ export default ExampleComponent;
|
||||
{{ e }}
|
||||
</li>
|
||||
</ul> -->
|
||||
<hot-table ref="wrapper" :settings="hotSettings" :data="entries"></hot-table>
|
||||
<div id="table">
|
||||
<hot-table ref="wrapper" :settings="hotSettings" :data="entries"></hot-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user