I wrote a little deno script that arranges cards in a Kinopio space in reverse-chronological order. This is a bud of an idea where I could use Kinopio as a log with the most recent stuff on top. And this is all automatically done.
For future:
- Abstract secrets
- Put in repository
- Experiment with grid layout
- Comment cards are excluded
- Comment cards that are connected move relatively with the card it is connected to. This way I can annotate.
1const jsonResponse = await fetch("https://api.kinopio.club/space/<space ID>")
2const spaceJson = await jsonResponse.json()
3// console.log(spaceJson);
4
5const cards = spaceJson.cards
6const sortedCards = cards.sort((a: any, b: any) => a.createdAt < b.createdAt)
7
8console.log(sortedCards)
9
10const patchCard = async (card: any) => {
11 const headers = new Headers({
12 "Content-Type": "application/json",
13 "Cache-Control": "must-revalidate, no-store, no-cache, private",
14 Authorization: "<API KEY>",
15 })
16 try {
17 const response = await fetch("https://api.kinopio.club/card", {
18 method: "PATCH",
19 headers,
20 body: JSON.stringify(card),
21 })
22 await response.json()
23 } catch (error) {
24 console.error(error)
25 }
26}
27
28let currentY = 200
29const PADDING = 24
30for (const card of sortedCards) {
31 console.log(card.id, card.y, currentY)
32 if (card.x !== 100 || card.y !== currentY) {
33 patchCard({ ...card, x: 100, y: currentY })
34 }
35 currentY += card.height + PADDING
36}
Also here: https://gist.github.com/bentsai/5014dd575358e7e56d85146aac86a018