Skip to content

Commit

Permalink
Fixed loading problem + added some spans for themes
Browse files Browse the repository at this point in the history
  • Loading branch information
YukiGasai committed Aug 21, 2022
1 parent 35cbc74 commit 83e1b6c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-google-calendar",
"name": "Obsidian Google Calendar",
"version": "1.2.0",
"version": "1.2.1",
"minAppVersion": "0.12.0",
"description": "Interact with your Google Calendar from Inside Obsidian",
"author": "YukiGasai",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-sample-plugin",
"version": "1.2.0",
"version": "1.2.1",
"description": "Interact with your Google Calendar from Inside Obsidian",
"main": "main.js",
"scripts": {
Expand Down
59 changes: 34 additions & 25 deletions src/svelte/ScheduleComp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
import { onDestroy } from "svelte";
export let timeSpan = 4;
export let timeSpan = 7;
export let date = window.moment();
let interval;
let days: Map<string, GoogleEvent[]> = new Map();
let loading = false;
let events = [];
const getEvents = async () => {
days.clear();
loading = true;
const events = await googleListEvents(date, date.clone().add(timeSpan, "day"));
const newEvents = await googleListEvents(date, date.clone().add(timeSpan, "day"));
//only reload if events change
if(JSON.stringify(newEvents) == JSON.stringify(events)){
return;
}
days.clear();
events = newEvents;
events.forEach(event => {
const key = event.start.date ?
window.moment(event.start.date).format("DD MMM, ddd") :
Expand All @@ -40,7 +45,7 @@
}else{
const start = window.moment(event.start.dateTime).format("hh:mma");
const end = window.moment(event.end.dateTime).format("hh:mma");
return `${start} - ${end}`
return `${start}-${end}`
}
}
Expand Down Expand Up @@ -106,12 +111,14 @@
<div class="dayEvents">
{#each events as event}
<div class="dayEvent" on:click="{(e) => goToEvent(event,e)}">
<div class="{event.recurringEventId ? "recurringCircle" : "circle"}" style:background="{getColorFromEvent(event)}"></div>
<div class="{event.recurringEventId ? "recurringCircleContainer" : "circleContainer"}">
<div class="circle" style:background="{getColorFromEvent(event)}"></div>
</div>
<div class="timeContainer">
{getDateString(event)}
<span>{getDateString(event)}</span>
</div>
<div class="eventTitleContainer">
{event.summary}
<span>{event.summary}</span>
</div>

</div>
Expand All @@ -129,6 +136,7 @@
padding: 10px;
}
.scheduleContent{
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -194,33 +202,34 @@
background-color: rgba(128, 128, 128, 0.129);
}
.circle{
width: 10px;
min-width: 10px;
height: 10px;
border-radius: 50%;
margin-right: 10px;
}
.recurringCircle{
.recurringCircleContainer,
.circleContainer{
position: relative;
width: 10px;
min-width: 10px;
height: 10px;
border-radius: 50%;
margin-right: 10px;
display: flex;
width: 30px;
min-width: 30px;
height: 30px;
align-items: center;
justify-content: center;
}
.recurringCircle::after{
.recurringCircleContainer::after{
content: "";
position: absolute;
width: 30px;
height: 30px;
left:-100%;
text-align: center;
line-height: 30px;
font-size: 30px;
top:-11px;
color:white;
white-space: nowrap;
}
.circle{
width: 10px;
min-width: 10px;
height: 10px;
border-radius: 50%;
}
.timeContainer{
Expand Down

0 comments on commit 83e1b6c

Please sign in to comment.