aboutsummaryrefslogtreecommitdiff
path: root/src/views/index.pug
blob: 0f00efed93bf5ba6247ed02bdf6540d8ea8b640f (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
include ../mixins/post
include ../mixins/header
include ../mixins/head
include ../utils
doctype html
html
  +head("home")
  include ../mixins/subUtils

  body
    main#content
      +header(user)
      div.hero
        div.sub-title
          h1 
            if isMulti
              a(href=`/`) lurker
            else
              a(href=`/r/${subreddit}`)
                | r/#{subreddit}
          if !isMulti
            div#button-container
              if isSubbed
                button(onclick=`toggleSub('${subreddit}')` id=`thinger_${subreddit}`) unsubscribe
              else
                button(onclick=`toggleSub('${subreddit}')` id=`thinger_${subreddit}`) subscribe
        if about && !isMulti
          div.about #{about.public_description}
        else 
          div.about 
            | consider donating to 
            a(href="https://donate.stripe.com/dR62bTaZH1295Da4gg") oppiliappan
            |, author of lurker
        hr
        details
          summary.sorting sorting by #{query.sort + (query.t?' '+query.t:'')}
          div.sort-opts
            div
              a(href=`/r/${subreddit}?sort=hot`) hot
            div
              a(href=`/r/${subreddit}?sort=new`) new
            div
              a(href=`/r/${subreddit}?sort=rising`) rising
            div
              a(href=`/r/${subreddit}?sort=top`) top
            div
              a(href=`/r/${subreddit}?sort=top&t=day`) top day
            div
              a(href=`/r/${subreddit}?sort=top&t=week`) top week
            div
              a(href=`/r/${subreddit}?sort=top&t=month`) top month
            div
              a(href=`/r/${subreddit}?sort=top&t=year`) top year
            div
              a(href=`/r/${subreddit}?sort=top&t=all`) top all

      if posts
        each child in posts.posts
          +post(child.data, currentUrl)

        if posts.after
          div.footer
            div.footer-item
              - var newQuery = {...query, after: posts.after}
              a(href=`/r/${subreddit}?${encodeQueryParams(newQuery)}`) next ⟶