Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
add donate menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Mar 11, 2024
1 parent 3d80b8d commit 0464d35
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 71 deletions.
3 changes: 3 additions & 0 deletions src/main/kotlin/org/freenet/website/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.freenet.website.pages.developers.developersPage
import org.freenet.website.pages.homePage
import org.freenet.website.pages.faq.faqPage
import org.freenet.website.pages.blog.BlogRssPlugin
import org.freenet.website.pages.donate.donatePage
import org.freenet.website.util.HealthCheckPlugin
import org.freenet.website.util.UrlToPathSegmentsRF
import org.freenet.website.util.recordVisit
Expand Down Expand Up @@ -76,6 +77,7 @@ suspend fun main() {
is NavItem.Development -> developersPage()
is NavItem.Faq -> faqPage()
is NavItem.Blog -> blogPage(activeNavItem.number)
is NavItem.Donate -> donatePage()
else -> error("Unknown Item: $activeNavItem")
}
}
Expand All @@ -98,6 +100,7 @@ private fun WebBrowser.pathToNavItem() = url.map(UrlToPathSegmentsRF)
"dev" -> NavItem.Development
"faq" -> NavItem.Faq
"blog" -> NavItem.Blog(if (pathSegments.size > 1) pathSegments[1].toIntOrNull() else null)
"donate" -> NavItem.Donate
else -> NavItem.Home
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/org/freenet/website/navigationBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fun Component.navComponent(activeItem: KVal<NavItem>) {

div { div ->
div.classes("navbar-brand")
for (ni in listOf(NavItem.Home, NavItem.Development, NavItem.Faq, NavItem.Blog(null))) {
for (ni in listOf(NavItem.Home, NavItem.Development, NavItem.Faq, NavItem.Blog(null), NavItem.Donate)) {
a { a ->
a.classes(activeItem.map { if (it == ni) "navbar-item is-active" else "navbar-item" })
if (ni.icon != null) {
Expand Down Expand Up @@ -47,4 +47,5 @@ sealed class NavItem(val html: String, val link: String, val icon: String? = nul
"Freenet Blog: ${Github?.discussions?.discussionsByNumber?.get(number)?.title ?: "Not Found"}"
}
}
data object Donate : NavItem("Donate", "/donate", "donate", "Freenet: Donate")
}
70 changes: 0 additions & 70 deletions src/main/kotlin/org/freenet/website/pages/about/aboutPage.kt

This file was deleted.

87 changes: 87 additions & 0 deletions src/main/kotlin/org/freenet/website/pages/donate/donatePage.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package org.freenet.website.pages.donate

import kweb.*
import kweb.components.Component
import kweb.state.KVar
import kweb.state.render
import kweb.util.json


fun Component.donatePage() {
h2().classes("title", "is-small").text("Donate to Freenet")
p().text(
"""
Founded in 2001, Freenet is a 501c3 non-profit organization dedicated to the development and
propagation of technologies for open and democratic information distribution over the Internet.
We advocate for unrestricted exchange of intellectual, scientific, literary, social, artistic,
creative, human rights, and cultural expressions, free from interference by state, private,
or special interests.
""".trimIndent()
)

h2().classes("title", "is-small").text("Donate via PayPal or Credit Card")
a { a ->
a["href"] = "https://www.paypal.com/donate?hosted_button_id=EQ9E7DPHB6ETY"
img { img ->
img["src"] = "https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif"
img["alt"] = "Donate with PayPal"
}
}

h2().classes("title", "is-small").text("Donate via Cryptocurrency")
p().innerHTML(
"""
Freenet is <b>not</b> a cryptocurrency, but we do accept cryptocurrency donations. For large donations (over $5,000) please contact us before sending. For smaller donations, please use the following wallets:
""".trimIndent()
)

table {
thead {
tr {
th().text("Cryptocurrency")
th().text("Address")
}
}
tbody {
tr {
td().text("Bitcoin")
td {
input { input ->
input.setAttributes("readonly" to true.json)
input.setAttributes("value" to "3M3fbA7RDYdvYeaoR69cDCtVJqEodo9vth".json)
input.setAttributes("onclick" to "this.select();".json)
}
}
}
tr {
td().text("Zcash")
td {
input { input ->
input.setAttributes("readonly" to true.json)
input.setAttributes("value" to "t1VHw1PHgzvMqEEd31ZBt3Vyy2UrG4J8utB".json)
input.setAttributes("onclick" to "this.select();".json)
}
}
}
tr {
td().text("Ethereum")
td {
input { input ->
input.setAttributes("readonly" to true.json)
input.setAttributes("value" to "0x79158A5Dbd9C0737CB27411817BD2759f5b9a9Ae".json)
input.setAttributes("onclick" to "this.select();".json)
}
}
}

}
}
}

private fun Component.renderPage(html: KVar<String?>) {
render(html) { html ->
if (html != null) {
section().classes("section").innerHTML(html)
}
}
}

0 comments on commit 0464d35

Please sign in to comment.