Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ec8f82de8 | ||
|
|
61fb5007f3 | ||
|
|
cb0486e907 | ||
|
|
7275e8aa3b | ||
|
|
2f261eb6c9 | ||
|
|
ebc9fb7f51 | ||
|
|
4fba4927cd | ||
|
|
d52d11e57e | ||
|
|
c723932fbf | ||
|
|
698ed2c808 | ||
|
|
664380eea6 | ||
|
|
f733d687ab | ||
|
|
2b910c93a0 | ||
|
|
0fe0420790 | ||
|
|
a0c6b4cd99 | ||
|
|
af80cc3839 | ||
|
|
b66319118b |
No files matched your search
+60
@@ -128,3 +128,63 @@ button:hover, .button:hover, input[type="submit"]:hover {
|
||||
margin: 0.8rem auto 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Kartet på forsiden går kant i kant: portalens .hero er en smal,
|
||||
polstret spalte, så kartet fikk marg over og på sidene. Spalten
|
||||
flyttes inn til teksten under, og kartet får hele bredden. */
|
||||
.hero.hero-module {
|
||||
max-width: none;
|
||||
padding: 0 0 2.5rem;
|
||||
}
|
||||
.hero.hero-module .hero-copy {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
max-width: 46rem;
|
||||
margin: 0 auto;
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
/* Ordmerket står til venstre, i flukt med innholdet under, og
|
||||
innloggingen til høyre på samme linje. */
|
||||
.hero.hero-module .hero-top {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.hero.hero-module .hero-top .session {
|
||||
position: static;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
/* Forsiden: ordmerket og innloggingen øverst, over kartet, og
|
||||
spørsmålet i det blå båndet løftet litt opp over kartets nedre
|
||||
kant, der kartet allerede glir over i siden. */
|
||||
.hero.hero-module {
|
||||
position: relative;
|
||||
}
|
||||
.hero.hero-module .hero-copy .hero-top {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 3;
|
||||
box-sizing: border-box;
|
||||
max-width: 46rem;
|
||||
margin: 0 auto;
|
||||
padding: 1rem 1.5rem;
|
||||
}
|
||||
/* En tynn hinne av sidens farge øverst på kartet, så ordmerket og
|
||||
«Logg inn» leses over gatene. */
|
||||
.hero.hero-module .hero-piece::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 6rem;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
background: linear-gradient(to bottom, var(--paper, #fffceb) 15%, transparent);
|
||||
}
|
||||
.hero.hero-module .hero-copy h1 {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
margin-top: -3.5rem;
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// Tomter from above, on the landing page: a map of the village, the
|
||||
// river path and the playgrounds, turning slowly under the heading.
|
||||
//
|
||||
// Everything comes from this site's own origin: portal serves MapLibre
|
||||
// (/maplibre-gl.js, /maplibre-gl.css), a raster style (/map/style.json)
|
||||
// and the tiles (/map/tiles/...), fetching them from Mapbox itself with
|
||||
// the token kept on the server. No third party loads in the page.
|
||||
// Without MAPBOX_TOKEN on the instance the style answers 404, and the
|
||||
// hero is simply empty: the heading stands on the page's own paper.
|
||||
//
|
||||
// The map is a picture, not a tool: no panning, no zoom, hidden from
|
||||
// screen readers. prefers-reduced-motion keeps it still.
|
||||
|
||||
const STYLE_ID = 'tomtervel-hero-style';
|
||||
|
||||
// Between the station, the river path and the playgrounds; the same
|
||||
// place the report form's map opens on (questions/melde-fra).
|
||||
const CENTER = [11.004, 59.6635];
|
||||
const ZOOM = 13.8;
|
||||
const PITCH = 42;
|
||||
const DEGREES_PER_SECOND = 1.4;
|
||||
|
||||
const CSS = `
|
||||
.tomtervel-map {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tomtervel-map .maplibregl-map,
|
||||
.tomtervel-map .tomtervel-map-canvas {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
/* Softer than the street map's own colours, so the heading reads. */
|
||||
.tomtervel-map canvas {
|
||||
filter: saturate(0.55) contrast(0.92) brightness(1.04);
|
||||
}
|
||||
/* The map fades into the page at the bottom, under the copy. */
|
||||
.tomtervel-map::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background: linear-gradient(to bottom,
|
||||
transparent 45%,
|
||||
var(--paper, #fffceb) 100%);
|
||||
}
|
||||
.tomtervel-map .maplibregl-ctrl-attrib {
|
||||
font-size: 10px;
|
||||
background: var(--card-bg, rgba(255, 255, 255, 0.6));
|
||||
}
|
||||
.tomtervel-map .maplibregl-ctrl-bottom-right {
|
||||
z-index: 2;
|
||||
}
|
||||
`;
|
||||
|
||||
function ensureStyle() {
|
||||
if (document.getElementById(STYLE_ID)) return;
|
||||
const style = document.createElement('style');
|
||||
style.id = STYLE_ID;
|
||||
style.textContent = CSS;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
|
||||
const reducedMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
let maplibreLoading = null;
|
||||
|
||||
// MapLibre once per document, from portal's own copy.
|
||||
function loadMaplibre() {
|
||||
if (window.maplibregl) return Promise.resolve(window.maplibregl);
|
||||
if (maplibreLoading) return maplibreLoading;
|
||||
if (!document.querySelector('link[href="/maplibre-gl.css"]')) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = '/maplibre-gl.css';
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
maplibreLoading = new Promise((resolve, reject) => {
|
||||
const existing = document.querySelector('script[src="/maplibre-gl.js"]');
|
||||
const script = existing || document.createElement('script');
|
||||
script.addEventListener('load', () => resolve(window.maplibregl), { once: true });
|
||||
script.addEventListener('error', () => reject(new Error('maplibre did not load')), { once: true });
|
||||
if (!existing) {
|
||||
script.src = '/maplibre-gl.js';
|
||||
script.async = true;
|
||||
document.head.appendChild(script);
|
||||
} else if (window.maplibregl) {
|
||||
resolve(window.maplibregl);
|
||||
}
|
||||
}).catch((err) => {
|
||||
maplibreLoading = null;
|
||||
throw err;
|
||||
});
|
||||
return maplibreLoading;
|
||||
}
|
||||
|
||||
class MapHero {
|
||||
constructor(container) {
|
||||
ensureStyle();
|
||||
this.root = document.createElement('div');
|
||||
this.root.className = 'tomtervel-map';
|
||||
this.root.setAttribute('aria-hidden', 'true');
|
||||
container.appendChild(this.root);
|
||||
this.stopped = false;
|
||||
this.ready = this.start().catch(() => {
|
||||
// No maps on this instance, or MapLibre missing: an empty
|
||||
// piece, and the page goes on.
|
||||
});
|
||||
}
|
||||
|
||||
async start() {
|
||||
// Ask for the style first: 404 means maps are off here.
|
||||
const res = await fetch('/map/style.json', { credentials: 'same-origin' });
|
||||
if (!res.ok || this.stopped) return;
|
||||
const style = await res.json();
|
||||
const maplibregl = await loadMaplibre();
|
||||
if (this.stopped) return;
|
||||
|
||||
const el = document.createElement('div');
|
||||
el.className = 'tomtervel-map-canvas';
|
||||
this.root.appendChild(el);
|
||||
|
||||
this.map = new maplibregl.Map({
|
||||
container: el,
|
||||
style,
|
||||
center: CENTER,
|
||||
zoom: ZOOM,
|
||||
pitch: PITCH,
|
||||
bearing: 0,
|
||||
interactive: false,
|
||||
attributionControl: { compact: true },
|
||||
fadeDuration: 0,
|
||||
});
|
||||
|
||||
await new Promise((resolve) => {
|
||||
this.map.once('load', resolve);
|
||||
this.map.once('error', resolve);
|
||||
});
|
||||
if (this.stopped || reducedMotion()) return;
|
||||
|
||||
this.last = performance.now();
|
||||
const turn = (now) => {
|
||||
if (this.stopped) return;
|
||||
const dt = Math.min(now - this.last, 100) / 1000;
|
||||
this.last = now;
|
||||
if (!document.hidden) {
|
||||
this.map.setBearing((this.map.getBearing() + DEGREES_PER_SECOND * dt) % 360);
|
||||
}
|
||||
this.raf = requestAnimationFrame(turn);
|
||||
};
|
||||
this.raf = requestAnimationFrame(turn);
|
||||
}
|
||||
|
||||
stop() {
|
||||
this.stopped = true;
|
||||
if (this.raf) cancelAnimationFrame(this.raf);
|
||||
if (this.map) this.map.remove();
|
||||
this.root.remove();
|
||||
}
|
||||
}
|
||||
|
||||
export function mount(container) {
|
||||
return new MapHero(container);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -24,10 +24,12 @@ alternatives:
|
||||
label: Navn
|
||||
type: text
|
||||
placeholder: Kari Nordmann
|
||||
profile: name
|
||||
- name: email
|
||||
label: E-post
|
||||
type: email
|
||||
placeholder: kari@eksempel.no
|
||||
profile: email
|
||||
- name: hva
|
||||
label: Hva har du mest lyst til å være med på?
|
||||
type: select
|
||||
|
||||
+2
-12
@@ -1,20 +1,9 @@
|
||||
name: Hva gjør Tomter Vel, og hva kan du få her?
|
||||
name: Hva gjør vi, og hva finner du her?
|
||||
description: For Tomters ve og vel, siden 1947. Velforeningen drives på fritida av naboene dine, og det du sier fra om her, havner hos en komité eller styret.
|
||||
responsible:
|
||||
name: Redaksjonen i Tomter Vel
|
||||
contact: post@tomtervel.no
|
||||
group: redaktor
|
||||
slideshow:
|
||||
max_height: 34
|
||||
slides:
|
||||
- image: images/elvestien-jernbanebroen.webp
|
||||
caption: Jernbanebroen over Hobølelva, sett fra lufta mot nord
|
||||
width: 1300
|
||||
height: 780
|
||||
- image: images/elvestien-infotavle.webp
|
||||
caption: Elvestien, med infotavla ved elva
|
||||
width: 1400
|
||||
height: 1050
|
||||
alternatives:
|
||||
- name: Velforeningen for Tomter siden 1947
|
||||
description: Sju komiteer jobber på fritida for bygda vår, fra elvestien og lekeplassene til trafikken og julegrantenningen.
|
||||
@@ -126,6 +115,7 @@ alternatives:
|
||||
label: Navn
|
||||
type: text
|
||||
placeholder: Kari Nordmann
|
||||
profile: name
|
||||
- name: sak
|
||||
label: Hvilken sak gjelder det?
|
||||
type: text
|
||||
|
||||
@@ -23,17 +23,23 @@ alternatives:
|
||||
- name: name
|
||||
label: Navn
|
||||
type: text
|
||||
profile: name
|
||||
- name: adresse
|
||||
label: Adresse
|
||||
type: text
|
||||
placeholder: Tomterveien 12
|
||||
profile: street_address
|
||||
profile_save: true
|
||||
- name: email
|
||||
label: E-post
|
||||
type: email
|
||||
profile: email
|
||||
- name: telefon
|
||||
label: Telefon
|
||||
type: tel
|
||||
placeholder: 123 45 678
|
||||
profile: phone_number
|
||||
profile_save: true
|
||||
description: Ha adressen i Tomter, en e-post du bruker og telefonnummeret ditt klart. Telefonnummeret går på kravet om kontingent, så kasserer finner betalingen din igjen.
|
||||
icon: lucide:user-plus
|
||||
encouragements:
|
||||
@@ -57,10 +63,13 @@ alternatives:
|
||||
label: Navn
|
||||
type: text
|
||||
placeholder: Ola Nordmann
|
||||
profile: name
|
||||
- name: adresse
|
||||
label: Adresse
|
||||
type: text
|
||||
placeholder: Ny adresse i Tomter
|
||||
profile: street_address
|
||||
profile_save: true
|
||||
- name: hva_er_nytt
|
||||
label: Hva vil du endre?
|
||||
type: textarea
|
||||
|
||||
@@ -18,6 +18,9 @@ alternatives:
|
||||
- name: Hvem leser dette
|
||||
description: Trafikkomiteen leser meldingen din. Haster det, når du styret på post@tomtervel.no.
|
||||
icon: lucide:car
|
||||
- name: Hull i veien, gatelys eller skilt
|
||||
description: Det kan du også melde rett til den som har ansvaret for veien, på [FiksGataMi](https://www.fiksgatami.no/sendcase). Der går meldingen til kommunen, fylket eller Statens vegvesen, alt etter hvem som eier veien. Meld det gjerne her også, så vet trafikkomiteen om det og kan følge det opp.
|
||||
icon: lucide:map-pin
|
||||
- name: Det velet har fått til
|
||||
description: 30 km/t gjennom sentrum på fylkesvei 120 kom på plass i 2025, etter at velet hadde spilt det inn flere ganger. I 2023 søkte velet om fortau i svingen langs Tomterveien mot kirken.
|
||||
icon: lucide:traffic-cone
|
||||
@@ -41,6 +44,7 @@ alternatives:
|
||||
type: email
|
||||
optional: true
|
||||
placeholder: ola.nordmann@epost.no
|
||||
profile: email
|
||||
description: Fortell hva du så, hvor det var, og legg gjerne igjen e-posten din hvis vi trenger å spørre mer.
|
||||
icon: lucide:alert-triangle
|
||||
encouragements:
|
||||
|
||||
@@ -24,10 +24,12 @@ alternatives:
|
||||
label: Navn
|
||||
type: text
|
||||
placeholder: Kari Nordmann
|
||||
profile: name
|
||||
- name: email
|
||||
label: E-post
|
||||
type: email
|
||||
placeholder: kari@eksempel.no
|
||||
profile: email
|
||||
- name: har_eller_trenger
|
||||
type: hidden
|
||||
value: Jeg trenger en hånd
|
||||
@@ -58,10 +60,12 @@ alternatives:
|
||||
label: Navn
|
||||
type: text
|
||||
placeholder: Kari Nordmann
|
||||
profile: name
|
||||
- name: email
|
||||
label: E-post
|
||||
type: email
|
||||
placeholder: kari@eksempel.no
|
||||
profile: email
|
||||
- name: har_eller_trenger
|
||||
type: hidden
|
||||
value: Jeg kan gi en hånd
|
||||
@@ -92,10 +96,12 @@ alternatives:
|
||||
label: Navn
|
||||
type: text
|
||||
placeholder: Ola Nordmann
|
||||
profile: name
|
||||
- name: email
|
||||
label: E-post
|
||||
type: email
|
||||
placeholder: ola@eksempel.no
|
||||
profile: email
|
||||
- name: har_eller_trenger
|
||||
label: Har du eller trenger du
|
||||
type: select
|
||||
|
||||
@@ -5,6 +5,12 @@ wordmark_invert: false
|
||||
wordmark_height: 2.4
|
||||
stylesheet: custom.css
|
||||
favicon: images/logo.svg
|
||||
# Tomter from above on the landing page: this repo's own module, served
|
||||
# at /site/hero.js. The map comes from portal's own proxy, so it needs
|
||||
# MAPBOX_TOKEN on the instance; without it the piece is empty.
|
||||
hero:
|
||||
kind: module
|
||||
module: hero.js
|
||||
# Who mail from this site comes from (delivered by gdo through kasse's
|
||||
# postfix). kasse signs @tomtervel.no with its own DKIM key (selector
|
||||
# `kasse`), and the vel's SPF lets kasse send beside Zoho, so the mail
|
||||
|
||||
Reference in new issue
Block a user