summaryrefslogtreecommitdiff
path: root/desk/web/components/thread-preview.hoon
blob: 758f6d359d53a23e4db334f7ebc311d43fe672e6 (plain)
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
/-  tp=trill-post, cnt=contact 
/+  lib=boke, sigil=sigil-sigil, sr=sortug, plib=trill-utils, ui=trill-ui, wall
/=  user  /web/components/user

|_  [t=thread:tp contacts=whoms:cnt =bowl:gall]
+*  wal  ~(. wall src.bowl)
++  is-blog  (~(has in tags.t) 'blog')
++  pat  %-  trip  %-  spat  ?:  is-blog  (blog-path:lib t)  (weld /board path.t)
++  wide
:: =/  blocks  (abbreviate-post:plib content.p.fn 500)
=/  u  (user ship.pid.t contacts 40)
=/  reply-count  (scow:parsing:sr %ud (lent replies.t))
=/  ttags  (tags:wal ~(tap in tags.t))
;div.thread-preview
  ;div.thread-author
    ;+  -.u
    ;+  +.u
  ==
  ;div.thread-name
    ;div
      ;a/"{pat}"
      ;h2:"{(trip title.t)}"
      ==
      ;div.thread-tags
        ;*  %+  turn  ttags  |=  tg=@t  ;a.tag/"/board?t={(trip tg)}": {(trip tg)}
      ==
    ==
  ==
  ;div.reply-count
    ;div:"Posted {(post-date-ago:lib id.pid.t now.bowl %tam)} ago"
    ;div:"{reply-count} replies"
  ==
  ;div.dates
    ;*  last-reply  
  ==
==
++  last-reply  ^-  marl
  ?~  replies.t  ~
  =/  usr  (user ship.i.replies.t contacts 40)
  ;+  ;div.last-reply
        ;span: Last reply {(post-date-ago:lib id.i.replies.t now.bowl %tam)} ago
        ;div.last-reply-author
          ;span: by
          ;+  name.usr
        ==
      ==
++  mobile
  =/  usr  (user ship.pid.t contacts 40)
  =/  reply-count  (scow:parsing:sr %ud (lent replies.t))

;a.thread-preview/"{pat}"
;div.thread-inner
  ;h2:"{(trip title.t)}"
  ;div.meta
    ;div.author
      ;div.by-author
        ;span:"by"
        ;+  +.usr
      ==
      ;div:"{(post-date-ago:lib id.pid.t now.bowl %yau)} ago"
    ==
    ;*  ?~  replies.t  ~
    ;+  ;div.reply
          ;div:"{reply-count} replies"
          ;div: Last {(post-date-ago:lib id.i.replies.t now.bowl %tam)} ago
        ==
  ==
==
==
--