-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome_schedule.qmd
70 lines (60 loc) · 2.12 KB
/
home_schedule.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
title: "Schedule"
pagetitle: "RaukR 2025 • Schedule"
date: ""
format:
html:
toc: false
number-sections: false
page-layout: full
---
```{r}
#| eval: false
#| echo: false
# <iframe width="100%" height="100%" src="https://docs.google.com/spreadsheets/d/e/2PACX-1vSIci4xlYTisAysZOricXo1DtN7xCxy0cAy3q2vHSPAPt-NP_XGVHmwzZ7DUJUVyEdHOwdwWN3AkorX/pubhtml?gid=0&single=true&widget=true&headers=false"></iframe>
```
::: {.schedule}
```{r}
#| eval: true
#| echo: false
#| fig-height: 6
library(googlesheets4)
library(lubridate)
library(readr)
library(toastui)
library(dplyr)
library(tidyr)
fn_rle <- function(x){
r <- rle(x)
return(rep(paste(r$values,1:length(r$values),sep="-"),times=r$lengths))
}
googlesheets4::gs4_deauth()
url_schedule = "https://docs.google.com/spreadsheets/d/1svAmuAzNRG3Ujj73qbC9DsOSzZ7jGyol79pLxuLD_fg"
dfr <- googlesheets4::read_sheet(url_schedule, sheet="schedule-vertical", col_types = "c") %>%
#filter(!is.na(type)) %>%
mutate(time=as.character(time)) %>%
tidyr::fill(date, .direction="down") %>%
tidyr::drop_na(type) %>%
mutate(start=lubridate::dmy_hm(paste(.$date, .$time))) %>%
mutate(end=start+lubridate::dminutes(30)) %>%
mutate(grp=paste0(fn_rle(type),"-",fn_rle(title)),.by=date) %>%
group_by(date,grp) %>%
summarise(type=type[1],body=body[1],title=title[1],start=start[1],end=tail(end,n=1)) %>%
ungroup() %>%
mutate(calendarId=as.character(as.integer(as.factor(type)))) %>%
mutate(start=as.character(lubridate::ymd_hms(start)),end=as.character(lubridate::ymd_hms(end))) %>%
dplyr::select(calendarId,title,body,start,end,type) %>%
mutate(category="time")
colors <- data.frame(
id=c("1","2","3","4","5"),
name=sort(unique(dfr$type)),
color=c(rep("#2c3e50",5)),
backgroundColor=c("#fcf3cf","#a9dfbf","#fae5d3","#e8daef","#d6eaf8"),
borderColor=c("#f7dc6f","#7dcea0","#f0b27a","#bb8fce","#85c1e9")
)
rownames(colors) <- colors$id
calendar(dfr, view="week", navigation=TRUE, defaultDate=as.Date("2024-06-10"), height=790) %>%
cal_week_options(startDayOfWeek = 1, hourStart=8, hourEnd=21, eventView="time", showNowIndicator = TRUE) %>%
cal_props(colors)
```
:::