@@ -25,6 +25,13 @@ export default runExtension({
25
25
"Your Oura Ring personal access token, accessible from https://cloud.ouraring.com/personal-access-tokens." ,
26
26
action : { type : "input" , placeholder : "xxxxxx" } ,
27
27
} ,
28
+ {
29
+ id : "use-attributes" ,
30
+ name : "Use plain text" ,
31
+ description :
32
+ "Toggles the usage of attributes on import." ,
33
+ action : { type : "switch" } ,
34
+ } ,
28
35
] ,
29
36
} ) ;
30
37
@@ -45,6 +52,7 @@ export default runExtension({
45
52
const pageTitle = getPageTitleByBlockUid ( blockUid ) ;
46
53
const dateFromPage = window . roamAlphaAPI . util . pageTitleToDate ( pageTitle ) ;
47
54
const token = args . extensionAPI . settings . get ( "token" ) ;
55
+ const useAttributes = args . extensionAPI . settings . get ( "use-attributes" ) ;
48
56
if ( ! token ) {
49
57
window . roamAlphaAPI . updateBlock ( {
50
58
block : {
@@ -131,6 +139,7 @@ export default runExtension({
131
139
] )
132
140
. then ( ( [ sleepData , activityData , readinessData ] ) => {
133
141
const sleep = sleepData . sleep [ 0 ] ;
142
+ const attributeColon = useAttributes ? ':' : '::' ;
134
143
if ( ! sleep ) {
135
144
bullets . push (
136
145
`There is no sleep data available for ${ formattedDate } `
@@ -140,20 +149,20 @@ export default runExtension({
140
149
const formattedStart = format ( new Date ( bedtime_start ) , "hh:mm:ss" ) ;
141
150
const formattedEnd = format ( new Date ( bedtime_end ) , "hh:mm:ss" ) ;
142
151
bullets . push (
143
- `Bedtime Start:: ${ formattedStart } ` ,
144
- `Bedtime End:: ${ formattedEnd } ` ,
145
- `Sleep Score:: ${ sleep . score } ` ,
146
- `Sleep Efficiency:: ${ sleep . efficiency } ` ,
147
- `Sleep Duration:: ${ secondsToTimeString ( sleep . duration ) } ` ,
148
- `Total Sleep:: ${ secondsToTimeString ( sleep . total ) } ` ,
149
- `Total Awake:: ${ secondsToTimeString ( sleep . awake ) } ` ,
150
- `Sleep Latency:: ${ secondsToTimeString ( sleep . onset_latency ) } ` ,
151
- `Light Sleep:: ${ secondsToTimeString ( sleep . light ) } ` ,
152
- `Rem Sleep:: ${ secondsToTimeString ( sleep . rem ) } ` ,
153
- `Deep Sleep:: ${ secondsToTimeString ( sleep . deep ) } ` ,
154
- `Resting Heart Rate:: ${ sleep . hr_lowest } ` ,
155
- `Average Heart Rate:: ${ sleep . hr_average } ` ,
156
- `Heart Rate Variability:: ${ sleep . rmssd } `
152
+ `Bedtime Start${ attributeColon } ${ formattedStart } ` ,
153
+ `Bedtime End${ attributeColon } ${ formattedEnd } ` ,
154
+ `Sleep Score${ attributeColon } ${ sleep . score } ` ,
155
+ `Sleep Efficiency${ attributeColon } ${ sleep . efficiency } ` ,
156
+ `Sleep Duration${ attributeColon } ${ secondsToTimeString ( sleep . duration ) } ` ,
157
+ `Total Sleep${ attributeColon } ${ secondsToTimeString ( sleep . total ) } ` ,
158
+ `Total Awake${ attributeColon } ${ secondsToTimeString ( sleep . awake ) } ` ,
159
+ `Sleep Latency${ attributeColon } ${ secondsToTimeString ( sleep . onset_latency ) } ` ,
160
+ `Light Sleep${ attributeColon } ${ secondsToTimeString ( sleep . light ) } ` ,
161
+ `Rem Sleep${ attributeColon } ${ secondsToTimeString ( sleep . rem ) } ` ,
162
+ `Deep Sleep${ attributeColon } ${ secondsToTimeString ( sleep . deep ) } ` ,
163
+ `Resting Heart Rate${ attributeColon } ${ sleep . hr_lowest } ` ,
164
+ `Average Heart Rate${ attributeColon } ${ sleep . hr_average } ` ,
165
+ `Heart Rate Variability${ attributeColon } ${ sleep . rmssd } `
157
166
) ;
158
167
}
159
168
@@ -167,14 +176,14 @@ export default runExtension({
167
176
const formattedStart = format ( new Date ( day_start ) , "hh:mm:ss" ) ;
168
177
const formattedEnd = format ( new Date ( day_end ) , "hh:mm:ss" ) ;
169
178
bullets . push (
170
- `Day Start:: ${ formattedStart } ` ,
171
- `Day End:: ${ formattedEnd } ` ,
172
- `Activity Score:: ${ activity . score } ` ,
173
- `Low Activity:: ${ secondsToTimeString ( activity . low * 60 ) } ` ,
174
- `Medium Activity:: ${ secondsToTimeString ( activity . medium * 60 ) } ` ,
175
- `High Activity:: ${ secondsToTimeString ( activity . high * 60 ) } ` ,
176
- `Rest Activity:: ${ secondsToTimeString ( activity . rest * 60 ) } ` ,
177
- `Steps:: ${ activity . steps } `
179
+ `Day Start${ attributeColon } ${ formattedStart } ` ,
180
+ `Day End${ attributeColon } ${ formattedEnd } ` ,
181
+ `Activity Score${ attributeColon } ${ activity . score } ` ,
182
+ `Low Activity${ attributeColon } ${ secondsToTimeString ( activity . low * 60 ) } ` ,
183
+ `Medium Activity${ attributeColon } ${ secondsToTimeString ( activity . medium * 60 ) } ` ,
184
+ `High Activity${ attributeColon } ${ secondsToTimeString ( activity . high * 60 ) } ` ,
185
+ `Rest Activity${ attributeColon } ${ secondsToTimeString ( activity . rest * 60 ) } ` ,
186
+ `Steps${ attributeColon } ${ activity . steps } `
178
187
) ;
179
188
}
180
189
@@ -184,7 +193,7 @@ export default runExtension({
184
193
`There is no activity data available for ${ formattedDate } `
185
194
) ;
186
195
} else {
187
- bullets . push ( `Readiness Score:: ${ readiness . score } ` ) ;
196
+ bullets . push ( `Readiness Score${ attributeColon } ${ readiness . score } ` ) ;
188
197
}
189
198
190
199
const base = getOrderByBlockUid ( blockUid ) ;
0 commit comments