Compare commits

...

2 commits

Author SHA1 Message Date
sinavir
e645024f38 Add tooltips in FilterBar 2022-07-28 01:57:27 +02:00
sinavir
4dc2343917 Support ical calendars 2022-07-28 01:50:33 +02:00
2 changed files with 5 additions and 2 deletions

View file

@ -26,7 +26,7 @@
$: chevron = collapsed ? 'chevron-expand' : 'chevron-contract'; $: chevron = collapsed ? 'chevron-expand' : 'chevron-contract';
</script> </script>
<span class="cal w-100 d-block" on:click={handleClick}> <span title={value} class="cal w-100 d-block" on:click={handleClick}>
<Icon name={icon} class="ms-2" /> <Icon name={icon} class="ms-2" />
<span class="ms-1 d-inline-block cal-title">{value}</span> <span class="ms-1 d-inline-block cal-title">{value}</span>
<span class="float-end"> <span class="float-end">

View file

@ -1,4 +1,5 @@
import STATIC_LOCATIONS from './static-ens-locations.json' import STATIC_LOCATIONS from './static-ens-locations.json'
import ICAL from 'ical.js'
// https://stackoverflow.com/a/35970186 // https://stackoverflow.com/a/35970186
function invertColor(hex) { function invertColor(hex) {
@ -208,7 +209,9 @@ function mkExportUrl(id, { cloud }) {
function fetchCalendar(id, cal, extra = {}) { function fetchCalendar(id, cal, extra = {}) {
return fetch(mkCalendarUrl(id, cal, extra), { credentials: 'omit' }) return fetch(mkCalendarUrl(id, cal, extra), { credentials: 'omit' })
.then(resp => resp.json()) .then( cal.isICS
? resp => resp.text().then(text => ICAL.parse(text))
: resp => resp.json())
.catch(err => console.error(err)) .catch(err => console.error(err))
} }