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