Add RSS button to navbar

This commit is contained in:
Zed
2019-09-15 11:29:14 +02:00
parent 8912c53f23
commit 6c479ff7ec
9 changed files with 18 additions and 12 deletions

View File

@@ -39,9 +39,10 @@ proc showSingleTimeline(name, after, agent: string; query: Option[Query];
if profile.username.len == 0:
return ""
let rssUrl = profile.username & "/rss"
let profileHtml = renderProfile(profile, timeline, await railFut, prefs, path)
return renderMain(profileHtml, prefs, title, pageTitle(profile),
pageDesc(profile), path)
pageDesc(profile), path, rss=rssUrl)
proc showMultiTimeline(names: seq[string]; after, agent: string; query: Option[Query];
prefs: Prefs; path, title: string): Future[string] {.async.} =

View File

@@ -50,7 +50,7 @@
width: 5px;
top: 2px;
margin-bottom: 0;
margin-left: -5px;
margin-left: -2.5px;
}
}

View File

@@ -5,7 +5,7 @@ import ../utils, ../types
const doctype = "<!DOCTYPE html>\n"
proc renderNavbar*(title, path: string): VNode =
proc renderNavbar*(title, path, rss: string): VNode =
buildHtml(nav(id="nav", class="nav-bar container")):
tdiv(class="inner-nav"):
tdiv(class="item"):
@@ -14,11 +14,13 @@ proc renderNavbar*(title, path: string): VNode =
a(href="/"): img(class="site-logo", src="/logo.png")
tdiv(class="item right"):
if rss.len > 0:
icon "rss", title="RSS Feed", href=rss
icon "info-circled", title="About", href="/about"
iconReferer "cog", "/settings", path, title="Preferences"
proc renderMain*(body: VNode; prefs: Prefs; title="Nitter"; titleText=""; desc="";
path="/"; `type`="article"; video=""; images: seq[string] = @[]): string =
proc renderMain*(body: VNode; prefs: Prefs; title="Nitter"; titleText=""; desc=""; path="/";
rss=""; `type`="article"; video=""; images: seq[string] = @[]): string =
let node = buildHtml(html(lang="en")):
head:
link(rel="stylesheet", `type`="text/css", href="/css/style.css")
@@ -48,7 +50,7 @@ proc renderMain*(body: VNode; prefs: Prefs; title="Nitter"; titleText=""; desc="
meta(property="og:video:secure_url", content=video)
body:
renderNavbar(title, path)
renderNavbar(title, path, rss)
tdiv(id="content", class="container"):
body