aboutsummaryrefslogtreecommitdiff
path: root/src/views/index.pug
blob: 9f5142be9b58ebd0a161246d58c48f10f8a10c4b (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
71
72
73
74
include ../mixins/post
include ../mixins/header
include ../mixins/head
include ../utils
  - var viewQuery = query && query.view ? query.view : 'compact'
  - var sortQuery = query && query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot'
doctype html
html
  +head("home")
  include ../mixins/subUtils

  body
    main#content
      +header(user)
      div.hero
        div.sub-title
          h1 
            if isMulti
              a(href=`/?sort=${sortQuery}&view=${viewQuery}`) lurker
            else
              a(href=`/r/${subreddit}?sort=${sortQuery}&view=${viewQuery}`)
                | 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.sort-details
          summary.sorting sorting by #{query.sort + (query.t?' '+query.t:'')}
          div.sort-opts
            div
              a(href=`/r/${subreddit}?sort=hot&view=${viewQuery}`) hot
            div
              a(href=`/r/${subreddit}?sort=new&view=${viewQuery}`) new
            div
              a(href=`/r/${subreddit}?sort=rising&view=${viewQuery}`) rising
            div
              a(href=`/r/${subreddit}?sort=top&view=${viewQuery}`) top
            div
              a(href=`/r/${subreddit}?sort=top&t=day&view=${viewQuery}`) top day
            div
              a(href=`/r/${subreddit}?sort=top&t=week&view=${viewQuery}`) top week
            div
              a(href=`/r/${subreddit}?sort=top&t=month&view=${viewQuery}`) top month
            div
              a(href=`/r/${subreddit}?sort=top&t=year&view=${viewQuery}`) top year
            div
              a(href=`/r/${subreddit}?sort=top&t=all&view=${viewQuery}`) top all
        details.sort-details
          summary.sorting viewing as #{viewQuery}
          div.sort-opts
            div
              a(href=`/r/${subreddit}?sort=${sortQuery}&view=compact`) compact
            div
              a(href=`/r/${subreddit}?sort=${sortQuery}&view=card`) card

      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 ⟶