-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexp-today-updated.js
31 lines (28 loc) · 994 Bytes
/
exp-today-updated.js
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
//!js
const now = Query.Utils.today(false);
const query = async () => {
let dv = Query.DataView(protyle, item, top);
const todayState = dv.useState('today', now); //Only update the state once.
let updatedState = dv.useState('updated-docs', []);
if (now === todayState.value) {
dv.addmd('#### Today\'s Updated Documents');
let updatedDoc = await Query.sql(`
select * from blocks where type='d' and updated like '${todayState.value}%'
order by updated desc
`);
dv.addtable(updatedDoc, {
fullwidth: true,
cols: ['box', 'hpath', 'updated'],
});
let state = updatedDoc.omit('ial', 'path', 'hash', 'fcontent');
updatedState(state);
} else {
dv.addmd(`#### Updated Documents on ${todayState.value}`)
dv.addtable(updatedState(), {
fullwidth: true,
cols: ['box', 'hpath', 'updated'],
});
}
dv.render();
}
return query();