Skip to content

Commit 152ba05

Browse files
committed
feat(orgues): ✨ afegeix les descripcions
Signed-off-by: Albert Mañosa <[email protected]>
1 parent b875085 commit 152ba05

File tree

331 files changed

+8218
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+8218
-36
lines changed

src/app/[locale]/(markdown)/layout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ export default async function Layout({
88
const { locale } = await params;
99
setRequestLocale(locale);
1010

11-
return (
12-
<div className="flex flex-col-reverse lg:flex-row flex-1">{children}</div>
13-
);
11+
return children;
1412
}

src/app/[locale]/(markdown)/orgues/[provincia]/[comarca]/[municipi]/[edifici]/[orgue]/page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Scaffold } from "@/components/scaffold";
55
import { route } from "@/lib/route";
66
import { getTranslations, setRequestLocale } from "next-intl/server";
77
import { OrguesOrgueParams } from "./layout";
8+
import { TOC } from "@/components/toc";
9+
import { findMDXHeadings } from "@/mdx-components";
810

911
export default async function Page({
1012
params,
@@ -18,6 +20,12 @@ export default async function Page({
1820
const { provincia, comarca, municipi, edifici, orgue } =
1921
orgueNavigation(navigation);
2022

23+
const Content = (
24+
await import(
25+
`/src/content/orgues/${provincia.link}/${comarca.link}/${municipi.link}/${edifici.link}/${orgue.link}.md`
26+
)
27+
).default;
28+
2129
return (
2230
<Scaffold
2331
breadcrumbFragments={[
@@ -61,6 +69,7 @@ export default async function Page({
6169
},
6270
{ label: orgue.nom, position: 7 },
6371
]}
72+
aside={<TOC headings={findMDXHeadings(Content({}))} />}
6473
>
6574
<h1>
6675
{edifici.nom}
@@ -84,6 +93,7 @@ export default async function Page({
8493
}
8594
/>
8695
</div>
96+
<Content />
8797
</Scaffold>
8898
);
8999
}

src/app/[locale]/(markdown)/orgues/[provincia]/[comarca]/[municipi]/[edifici]/page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Scaffold } from "@/components/scaffold";
55
import { route } from "@/lib/route";
66
import { getTranslations, setRequestLocale } from "next-intl/server";
77
import { OrguesEdificiParams } from "./layout";
8+
import { TOC } from "@/components/toc";
9+
import { findMDXHeadings } from "@/mdx-components";
810

911
export default async function Page({
1012
params,
@@ -17,6 +19,12 @@ export default async function Page({
1719
const t = await getTranslations("metadata");
1820
const { provincia, comarca, municipi, edifici } = orgueNavigation(navigation);
1921

22+
const Content = (
23+
await import(
24+
`/src/content/orgues/${provincia.link}/${comarca.link}/${municipi.link}/${edifici.link}.md`
25+
)
26+
).default;
27+
2028
return (
2129
<Scaffold
2230
breadcrumbFragments={[
@@ -50,6 +58,7 @@ export default async function Page({
5058
},
5159
{ label: edifici.nom, position: 6 },
5260
]}
61+
aside={<TOC headings={findMDXHeadings(Content({}))} />}
5362
>
5463
<h1>{edifici.nom}</h1>
5564
<div className="not-prose flex justify-between items-baseline">
@@ -69,6 +78,7 @@ export default async function Page({
6978
}
7079
/>
7180
</div>
81+
<Content />
7282
</Scaffold>
7383
);
7484
}

src/components/scaffold.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,26 @@ export function Scaffold({
1414
>) {
1515
return (
1616
<>
17-
<main
18-
className={cn(
19-
"col-span-2 prose dark:prose-invert pt-8 mx-auto sm:max-md:px-8 px-4 md:px-0",
20-
aside && "lg:ms-auto lg:me-0",
21-
)}
22-
>
23-
<PageBreadcrumb
24-
fragments={breadcrumbFragments}
25-
className="not-prose mb-8"
26-
/>
27-
{children}
17+
<main className="flex flex-col-reverse lg:flex-row flex-1">
18+
<div
19+
className={cn(
20+
"prose dark:prose-invert col-span-2 pt-8 mx-auto sm:max-md:px-8 px-4 md:px-0",
21+
aside && "lg:ms-auto lg:me-0",
22+
)}
23+
>
24+
<PageBreadcrumb
25+
fragments={breadcrumbFragments}
26+
className="not-prose mb-8"
27+
/>
28+
{children}
29+
</div>
30+
{aside ? (
31+
// TODO(albertms10): mostra la TOC a la versió mòbil
32+
<aside className="container prose hidden lg:block sm:max-md:px-8 md:px-0 w-full lg:max-w-[14rem] lg:pt-20 mx-auto lg:ms-10 lg:me-auto lg:pb-32">
33+
{aside}
34+
</aside>
35+
) : null}
2836
</main>
29-
{aside ? (
30-
// TODO(albertms10): mostra la TOC a la versió mòbil
31-
<aside className="container prose hidden lg:block sm:max-md:px-8 md:px-0 w-full lg:max-w-[14rem] lg:pt-20 mx-auto lg:ms-10 lg:me-auto lg:pb-32">
32-
{aside}
33-
</aside>
34-
) : null}
3537
</>
3638
);
3739
}

src/components/toc.tsx

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,60 @@
11
"use client";
22

3+
import { cn } from "@/lib/utils";
4+
import type { HeadingElement } from "@/mdx-components";
35
import type { ReactNode } from "react";
46
import ScrollSpy from "react-scrollspy-navigation";
57

6-
export function TOC({
7-
headings,
8-
}: Readonly<{ headings: { id: string; label: ReactNode }[] }>) {
8+
export interface TOCItem {
9+
id: string;
10+
heading: HeadingElement;
11+
headings?: TOCItem[];
12+
label: ReactNode;
13+
}
14+
15+
export interface TOCProps {
16+
headings: TOCItem[];
17+
}
18+
19+
export function TOC({ headings }: Readonly<TOCProps>) {
20+
function tocList(items: TOCItem[], className?: string) {
21+
return (
22+
<ol className={cn("flex flex-col gap-2", className)}>
23+
{items.map((item) => tocListItem(item))}
24+
</ol>
25+
);
26+
}
27+
28+
function tocListItem(item: TOCItem) {
29+
return (
30+
<li key={item.id} className="leading-tight flex flex-col gap-2">
31+
<a
32+
href={`#${item.id}`}
33+
className="text-primary/80 hover:text-primary data-[active=true]:text-aco data-[active=true]:font-bold"
34+
>
35+
{item.label}
36+
</a>
37+
{item.headings?.length ? tocList(item.headings, "ps-4") : <></>}
38+
</li>
39+
);
40+
}
41+
942
return (
1043
<ScrollSpy
1144
activeAttr
1245
rootMargin="180px"
1346
onClickEach={(e) => {
1447
const heading = (e.target as HTMLElement).getAttribute("href");
15-
if (!heading || !/^#[a-z-]+$/.test(heading)) return;
48+
console.log("hhhh", heading);
49+
if (!heading || !/^#[0-9a-z-]+$/.test(heading)) return;
1650
window.location.href = heading;
1751
}}
1852
>
1953
<nav className="not-prose sticky top-24 text-sm">
2054
<header className="font-bold uppercase tracking-wide text-primary/60 mb-4">
2155
Taula de continguts
2256
</header>
23-
<ul className="flex flex-col gap-2">
24-
{headings.map(({ label, id }) => (
25-
<li key={id} className="leading-tight">
26-
<a
27-
href={`#${id}`}
28-
className="text-primary/80 hover:text-primary data-[active=true]:text-aco data-[active=true]:font-bold"
29-
>
30-
{label}
31-
</a>
32-
</li>
33-
))}
34-
</ul>
57+
{tocList(headings)}
3558
</nav>
3659
</ScrollSpy>
3760
);

src/content/orgues/barcelona.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
layout: base/bc-provincia
3+
---
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
layout: base/bc-comarca
3+
---
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
layout: base/bc-municipi
3+
---
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
layout: base/orgue
3+
redirect_from:
4+
- pages/orgues/barcelona/alt-penedes/santa-fe/santa-maria
5+
- orgues/santa-fe
6+
7+
fotos:
8+
- nom: santa-fe-2.jpg
9+
alt: Façana de l'orgue
10+
autor: Isidre Vallès
11+
portada: 38%
12+
- nom: santa-fe-4.jpg
13+
alt: Consola de l'orgue
14+
autor: Isidre Vallès
15+
- nom: santa-fe-1.jpg
16+
alt: Tubs
17+
autor: Isidre Vallès
18+
- nom: santa-fe-5.jpg
19+
alt: Façana de l'orgue
20+
caption: Isidre Vallès tocant el seu orgue.
21+
autor: Isidre Vallès
22+
---
23+
24+
L'orgue fou construït per Isidre Vallès i Vallès l'any 2001 i acabat l'any 2003. La primera part de
25+
l'orgue es va inaugurar el 6 d'octubre 2001 (dia de santa Fe). Amb una benedicció acompanyada a
26+
l'orgue per Pere Güell i un concert a càrrec de Jonatan Carbó, orgue, Neus Calaf, soprano, Jesús Salius,
27+
oboè i Miquel Benito, flauta de bec.
28+
29+
La inauguració de l'orgue acabat es va fer el 6 d'octubre de 2003. L'orgue va ser re-beneït per mossèn
30+
Jaume Verdoy i el concert inaugural el va oferir Josep Maria Escalona i Canyet, organista de la catedral de Barcelona.
31+
Des de la primera inauguració, l'orgue s'ha tocat a totes les festes de precepte. Cada any, pels vols de
32+
Santa Fe, s'organitza un concert d'orgue sol o amb altres instruments. Enguany (2022) s'ha celebrat la XXI edició.
33+
34+
### Disposició
35+
36+
Els vuit primers tubs del violó sonen sempre.
37+
38+
{% include disposicions/disposicio.html %}
39+
40+
### Galeria fotogràfica
41+
42+
{% include orgues/gallery-grid.html %}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
layout: base/bc-municipi
3+
---

0 commit comments

Comments
 (0)