hswaw/site: add merch page

Change-Id: Ic6e1b5366706e62648cc8e1524751afc22912a45
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1944
Reviewed-by: q3k <q3k@hackerspace.pl>
changes/44/1944/2
q3k 2024-03-25 14:01:21 +00:00 committed by q3k
parent b1f274fd6f
commit c1f60e0a22
11 changed files with 168 additions and 79 deletions

View File

@ -122,4 +122,5 @@ func (s *service) registerHTTP(mux *http.ServeMux) {
mux.HandleFunc("/event/", s.handleEvent)
mux.HandleFunc("/robots.txt", s.handleRobotsTxt)
mux.HandleFunc("/", s.handleIndex)
mux.HandleFunc("/merch", s.handleMerch)
}

View File

@ -73,12 +73,6 @@ body {
}
}
.about img {
width: 100%;
display: block;
margin: 0 auto;
}
#top {
display: flex;
flex-direction: row;
@ -229,16 +223,11 @@ body {
}
.img-wrapper {
position: relative;
height: 0;
padding-bottom: 60%;
}
.img-wrapper > img {
position: absolute;
width: 100%;
height: 100%;
left: 0;
object-fit: contain;
}
@ -248,11 +237,11 @@ body {
padding: 0;
margin: 0;
justify-content: center;
flex-wrap: wrap;
}
.gallery-nav > li {
margin: 0;
padding: 0;
display: block;
}
.gallery-nav > li:hover {
background-color: var(--darkbgaccent);
@ -268,6 +257,31 @@ body {
padding-top: 7px;
}
.gallery-img {
margin-top: 5px;
gap: 10px;
}
.gallery-img > li > a {
display: block;
text-decoration: none;
padding: 0;
width: 100%;
height: auto;
}
.gallery-img > li > a > img {
width: 100%;
}
.gallery-img > li:hover {
background-color: initial;
opacity: 70%;
}
.gallery-img > li.active {
background-color: initial;
}
.bottom {
display: flex;
flex-direction: column;
@ -404,3 +418,19 @@ li i {
animation: none !important;
}
}
.button {
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
height: 60px;
width: 200px;
background-color: var(--secondary);
margin: 20px auto;
}
.button:hover{
color: var(--primary100);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 KiB

View File

@ -5,6 +5,8 @@ go_embed_data(
name = "templates",
srcs = [
"index.html",
"merch.html",
"base.html",
],
package = "templates",
)

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<meta charset="utf-8">
<!-- https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission -->
<title>Warszawski Hackerspace</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/static/site/landing.css"/>
<link rel="stylesheet" href="/static/site/fonts.css"/>
<link rel="stylesheet" href="/static/leaflet/leaflet.css"/>
<style>
</style>
<div id="ledsFloater">
<div id="ledsWrapper">
<div id="leds">
</div>
</div>
</div>
<div id="page">
<header id="top">
<div id="logo">
<img src="/static/site/neon-syrenka.svg" />
</div>
<div class="type">
<h1>Warszawski Hackerspace</h1>
</div>
</header>
<nav id="quicklinks">
<ul>
<li><a href="/">Informacje</a></li>
<li><a href="/merch" style="color: var(--secondary)">Koszulki!</a></li>
<li><a href="https://wiki.hackerspace.pl/">Wiki</a></li>
<li><a href="https://profile.hackerspace.pl/">Konto</a></li>
<li><a href="https://wiki.hackerspace.pl/partners">Partnerzy</a></li>
<li><a href="https://wiki.hackerspace.pl/kontakt">Kontakt</a></li>
{{ if eq .AtError nil }}
{{ $count := len .AtStatus.Users }}
<li>
<a href="https://at.hackerspace.pl">Osób w spejsie: <b>{{ $count }}</b></a>
</li>
{{ end }}
</ul>
</nav>
<div class="bottom">
{{ block "content" . }} {{ end }}
</div>
</div>
{{ block "footer" . }} {{ end }}
<script>
document.querySelectorAll('.gallery-wrapper').forEach(galleryWrapper => {
const img = galleryWrapper.querySelector('.img-wrapper img')
const links = galleryWrapper.querySelectorAll('.gallery-nav > li > a')
links.forEach(link => {
link.onclick = e => {
e.preventDefault()
links.forEach(x => x.parentNode.classList.remove('active'))
const li = e.currentTarget.parentNode
li.classList.add('active')
const name = li.dataset.name
if ('startViewTransition' in document) {
document.startViewTransition(() => {
img.src = `/static/site/${ name }.jpg`
})
} else {
img.src = `/static/site/${ name }.jpg`
}
}
})
})
</script>
<script src="/static/site/led.js" crossorigin="" type="module" ></script>

View File

@ -1,43 +1,4 @@
<!DOCTYPE html>
<meta charset="utf-8">
<!-- https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission -->
<title>Warszawski Hackerspace</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/static/site/landing.css"/>
<link rel="stylesheet" href="/static/site/fonts.css"/>
<link rel="stylesheet" href="/static/leaflet/leaflet.css"/>
<style>
</style>
<div id="ledsFloater">
<div id="ledsWrapper">
<div id="leds">
</div>
</div>
</div>
<div id="page">
<header id="top">
<div id="logo">
<img src="/static/site/neon-syrenka.svg" />
</div>
<div class="type">
<h1>Warszawski Hackerspace</h1>
</div>
</header>
<nav id="quicklinks">
<ul>
<li><a href="https://wiki.hackerspace.pl/">Wiki</a></li>
<li><a href="https://profile.hackerspace.pl/">Konto</a></li>
<li><a href="https://wiki.hackerspace.pl/partners">Partnerzy</a></li>
<li><a href="https://wiki.hackerspace.pl/kontakt">Kontakt</a></li>
{{ if eq .AtError nil }}
{{ $count := len .AtStatus.Users }}
<li>
<a href="https://at.hackerspace.pl">Osób w spejsie: <b>{{ $count }}</b></a>
</li>
{{ end }}
</ul>
</nav>
<div class="bottom">
{{ block "content" . }}
<section class="gallery-wrapper" id="pit">
<div class="img-wrapper">
<img src="/static/site/pit1.jpg" />
@ -102,9 +63,9 @@
Jeśli nalegasz, mamy rzadko aktualizowane konta na <a href="https://social.hackerspace.pl/@hswaw">Fediverse (Mastodon)</a>, <a href="https://twitter.com/hackerspacepl">Twitterze</a> i <a href="https://www.facebook.com/hackerspacepl">Facebooku</a>. Lepiej jednak kontaktować się z nami <a href="https://wiki.hackerspace.pl/kontakt">przez IRC, Matrixa lub mejlowo</a>.
</p>
</div>
</div>
</div>
{{ end }}
{{ block "footer" . }}
<script>
window.loadMap = () => {
let map = L.map('map', {
@ -119,29 +80,6 @@ window.loadMap = () => {
L.marker([52.24158, 20.9848]).addTo(map);
}
document.querySelectorAll('.gallery-wrapper').forEach(galleryWrapper => {
const img = galleryWrapper.querySelector('.img-wrapper img')
const links = galleryWrapper.querySelectorAll('.gallery-nav > li > a')
links.forEach(link => {
link.onclick = e => {
e.preventDefault()
links.forEach(x => x.parentNode.classList.remove('active'))
const li = e.currentTarget.parentNode
li.classList.add('active')
const name = li.dataset.name
if ('startViewTransition' in document) {
document.startViewTransition(() => {
img.src = `/static/site/${ name }.jpg`
})
} else {
img.src = `/static/site/${ name }.jpg`
}
}
})
})
</script>
<script src="/static/leaflet/leaflet.js" crossorigin="" onload="loadMap()"></script>
<script src="/static/site/led.js" crossorigin="" type="module" ></script>
{{ end }}

View File

@ -0,0 +1,34 @@
{{ block "content" . }}
<div class="about">
<h2>Koszulki "Dekompilacja"</h2>
<p>
</p>
W związku z Pewną Aferą, postanowiliśmy wydać serię pierwszych (albo no, pierwszych od dawna) <b>t-shirtów</b> naszego spejsu.
<p>
Nie wiesz o co chodzi? <a href="https://zaufanatrzeciastrona.pl/post/o-trzech-takich-co-zhakowali-prawdziwy-pociag-a-nawet-30-pociagow/">Czytaj tu</a>.
</p>
<p>
Koszulki są do kupienia <a href="https://qrde.pl/produkt/oryginalna-koszulka-dekompilacja-od-warszawskiego-hackerspaceu-x-dragon-sector">u naszego partnera</a>. Każdy t-shirt wspiera Hackerspace!
</p>
<section class="gallery-wrapper">
<div class="img-wrapper">
<img src="/static/site/tshirt-1.jpg">
</div>
<ul class="gallery-nav gallery-img">
<li data-name="tshirt-1" class="active"><a href="#"><img src="/static/site/tshirt-1.jpg" alt="Black Warsaw Hackerspace 'Dekompilacja' tshirt, front view" /></a></li>
<li data-name="tshirt-2"><a href="#"><img src="/static/site/tshirt-2.jpg" alt="Black Warsaw Hackerspace 'Dekompilacja' tshirt, closeup view" /></a></li>
<li data-name="tshirt-3"><a href="#"><img src="/static/site/tshirt-3.jpg" alt="White Warsaw Hackerspace 'Dekompilacja' tshirt, front view" /></a></li>
<li data-name="tshirt-4"><a href="#"><img src="/static/site/tshirt-4.jpg" alt="White Warsaw Hackerspace 'Dekompilacja' tshirt, closeup view" /></a></li>
</ul>
</section>
<a href = "https://qrde.pl/produkt/oryginalna-koszulka-dekompilacja-od-warszawskiego-hackerspaceu-x-dragon-sector" style="text-decoration:none">
<p class = "button">
KUP TUTAJ
</p>
</a>
<p>
Zastanawiasz się czy warto wspierać kulturę hackerską? Przekonaj się <a href = "https://pl.wikipedia.org/wiki/Spo%C5%82eczno%C5%9B%C4%87_haker%C3%B3w">tutaj</a>!
</p>
</div>
{{ end }}

View File

@ -43,7 +43,8 @@ func parseTemplates(names ...string) (*template.Template, error) {
}
var (
tmplIndex = template.Must(parseTemplates("index"))
tmplIndex = template.Must(parseTemplates("index", "base"))
tmplMerch = template.Must(parseTemplates("merch", "base"))
)
// render attempts to render a given Go template with data into the HTTP
@ -74,6 +75,17 @@ func (s *service) handleIndex(w http.ResponseWriter, r *http.Request) {
})
}
func (s *service) handleMerch(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
atStatus, atError := getAt(ctx)
render(w, tmplMerch, map[string]interface{}{
"AtStatus": atStatus,
"AtError": atError,
})
}
func (s *service) handleRobotsTxt(w http.ResponseWriter, r *http.Request) {
// Allow everyone everywhere. We don't really host much on hackerspace.pl anyway.
fmt.Fprintf(w, "User-agent: *\n")