From 3273c65ef82123bf5edbe6d8616630b20a993ce1 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 11 Aug 2024 03:13:10 +0200 Subject: Giant refactoring of the codebase --- template/about.templ | 52 +++++++++ template/base.go | 3 + template/base.templ | 51 +++++++++ template/coins.templ | 53 +++++++++ template/coins_designs.templ | 41 +++++++ template/coins_designs_nl.templ | 43 +++++++ template/coins_mintages.templ | 112 +++++++++++++++++++ template/language.templ | 54 +++++++++ template/navbar.templ | 241 ++++++++++++++++++++++++++++++++++++++++ template/root.templ | 23 ++++ 10 files changed, 673 insertions(+) create mode 100644 template/about.templ create mode 100644 template/base.go create mode 100644 template/base.templ create mode 100644 template/coins.templ create mode 100644 template/coins_designs.templ create mode 100644 template/coins_designs_nl.templ create mode 100644 template/coins_mintages.templ create mode 100644 template/language.templ create mode 100644 template/navbar.templ create mode 100644 template/root.templ (limited to 'template') diff --git a/template/about.templ b/template/about.templ new file mode 100644 index 0000000..d7dfa06 --- /dev/null +++ b/template/about.templ @@ -0,0 +1,52 @@ +package template + +import "git.thomasvoss.com/euro-cash.eu/lib" + +const ( + contactEmail = `mail@euro-cash.eu` + repoLinkStart = `` + linkEnd = `` +) + +templ About() { + {{ p := ctx.Value("printer").(lib.Printer) }} +
+ @navbar() +

{ p.T("About Us") }

+
+
+

{ p.T("Open Source") }

+

+ @templ.Raw(p.T("This website is an open project, and a collaboration between developers, translators, and researchers. All source code, data, images, and more for the website are open source and can be found %shere%s. This site is licensed under the BSD 0-Clause license giving you the full freedom to do whatever you would like with any of the content on this site.", repoLinkStart, linkEnd)) +

+

{ p.T("Contact Us") }

+

+ @templ.Raw(p.T("While we try to stay as up-to-date as possible and to fact check our information, it is always possible that we get something wrong, lack a translation, or are missing some piece of data you may have. In such a case don’t hesitate to contact us; we’ll try to get the site updated or fixed as soon as possible. You are always free to contribute via a git patch if you are more technically included, but if not you can always send an email to %s or contact ‘@onetruemangoman’ on Discord.", contactEmail)) +

+

{ p.T("Special Thanks") }

+ + + + + + + + + + + + + +
{ p.T("Development") }{ p.T("Research") }{ p.T("Translations") }
+ Jessika Wexler, + Lyyli Savolainen, + Ralf Nadel + + Elín Hjartardóttir, + Storm Sørensen + + Thomas Voss, + Védís Indriðadóttir +
+
+} diff --git a/template/base.go b/template/base.go new file mode 100644 index 0000000..392b1c2 --- /dev/null +++ b/template/base.go @@ -0,0 +1,3 @@ +//go:generate templ generate -log-level warn + +package template diff --git a/template/base.templ b/template/base.templ new file mode 100644 index 0000000..bd8c082 --- /dev/null +++ b/template/base.templ @@ -0,0 +1,51 @@ +package template + +import "git.thomasvoss.com/euro-cash.eu/lib" + +templ Base(body templ.Component) { + {{ p := ctx.Value("printer").(lib.Printer) }} + + + + + + + Euro Cash + + + + @body + + + +} diff --git a/template/coins.templ b/template/coins.templ new file mode 100644 index 0000000..ef1b0a1 --- /dev/null +++ b/template/coins.templ @@ -0,0 +1,53 @@ +package template + +import "git.thomasvoss.com/euro-cash.eu/lib" + +const newsLinkStart = `` + +templ Coins() { + {{ p := ctx.Value("printer").(lib.Printer) }} +
+ @navbar() +

{ p.T("Euro Coins") }

+
+
+

+ @templ.Raw(p.T("On this section of the site you can find everything there is to know about the coins of the Eurozone. For the latest news on coin- and design releases, check out the %snews%s tab!", newsLinkStart, linkEnd)) +

+
+
+ +
+
+} diff --git a/template/coins_designs.templ b/template/coins_designs.templ new file mode 100644 index 0000000..de47482 --- /dev/null +++ b/template/coins_designs.templ @@ -0,0 +1,41 @@ +package template + +import ( + "fmt" + "strings" + + "git.thomasvoss.com/euro-cash.eu/lib" +) + +var varietiesLinkStart = `` + +func makeURL(c lib.Country) templ.SafeURL { + url := fmt.Sprintf("/coins/designs/%s", c.Code) + return templ.SafeURL(url) +} + +templ CoinsDesigns() { + {{ p := ctx.Value("printer").(lib.Printer) }} +
+ @navbar() +

{ p.T("Euro Coin Designs") }

+
+
+

+ @templ.Raw(p.T("Here you’ll be able to view all the coin designs for each country in the Eurozone. This section of the site doesn’t include minor varieties such as different mintmarks or errors; those are on the %svarieties%s page.", varietiesLinkStart, linkEnd)) +

+
+
+
+} diff --git a/template/coins_designs_nl.templ b/template/coins_designs_nl.templ new file mode 100644 index 0000000..819b294 --- /dev/null +++ b/template/coins_designs_nl.templ @@ -0,0 +1,43 @@ +package template + +import "git.thomasvoss.com/euro-cash.eu/lib" + +templ CoinsDesignsNl() { + {{ p := ctx.Value("printer").(lib.Printer) }} +
+ @navbar() +

{ p.T("Dutch Euro Coin Designs") }

+
+
+
+ Netherlands Queen Beatrix €0.50 Coin + Netherlands King Willem-Alexander €0.50 Coin +
+
+ Netherlands Queen Beatrix €1 Coin + Netherlands King Willem-Alexander €1 Coin +
+

+ { p.T("From the years 1999–2013 all Dutch euro coins featured the portrait of Queen Beatrix of the Netherlands. After her abdication from the throne in 2013 the designs of all denominations were changed to feature the portrait of the new King Willem-Alexander. After her abdication the direction in which the monarchs portrait faced was flipped; a tradition dating back to the earliest coins of the Kingdom of the Netherlands.") } +

+

+ { p.T("Coins featuring both monarchs contain text reading ‘BEATRIX KONINGIN DER NEDERLANDEN’ (‘BEATRIX QUEEN OF THE NETHERLANDS’) and ‘Willem-Alexander Koning der Nederlanden’ (‘Willem-Alexander King of the Netherlands’) respectively.") } +

+

+ + { p.T("The €1 and €2 coins featuring King Willem-Alexander were minted with a much lower relief than most euro coins of the same denomination. As a result it is not uncommon for these coins to appear worn after little use in circulation.") } +

+
+} diff --git a/template/coins_mintages.templ b/template/coins_mintages.templ new file mode 100644 index 0000000..b6ed2de --- /dev/null +++ b/template/coins_mintages.templ @@ -0,0 +1,112 @@ +package template + +import ( + "strconv" + + "git.thomasvoss.com/euro-cash.eu/lib" + "git.thomasvoss.com/euro-cash.eu/lib/mintage" +) + +const muntrolpakketLinkStart = `` + +var denoms = [...]float64{ + 0.01, 0.02, 0.05, 0.10, + 0.20, 0.50, 1.00, 2.00, +} + +templ CoinsMintages() { + {{ + code := ctx.Value("code").(string) + set := ctx.Value("set").(mintage.Set) + p := ctx.Value("printer").(lib.Printer) + }} +
+ @navbar() +

{ p.T("Euro Coin Mintages") }

+
+
+

+ { p.T("Here you’ll be able to view all the known mintages for all coins. You’ll also be able to filter on country, denomination, etc. If you have any mintage data that’s missing from our site, feel free to contact us.") } +

+
+ if code == "nl" { +

{ p.T("Additional Notes") }

+
    +
  • + @templ.Raw(p.T("Most coins from the years 2003–2016 are listed as NIFC coins while other popular sources such as Numista claim they were minted for circulation. For more information on why others are wrong, %sclick here%s.", muntrolpakketLinkStart, linkEnd)) +
  • +
  • + { p.T("In 2003 Numista calculated a total of %d coins issued for coin sets per denomination. Our own calculations found only %d. Numista also forgot to include the many hundred thousand coins from the coin roll sets that were produced.", 217503, 177003) } +
  • +
+ } +
+
+
+ +
+ + + +
+
+ +
+
+ + + + for _, x := range denoms { + + } + + + for _, row := range set.Circ { + + + for _, col := range row.Cols { + switch col { + case mintage.Unknown: + + case 0: + + default: + + } + } + + } + +
{ p.T("Year") }{ p.Money(x, false) }
+ if row.Mintmark != "" { + { strconv.Itoa(row.Year) } { row.Mintmark } + } else { + { strconv.Itoa(row.Year) } + } + { p.T("Unknown") }{ p.N(col) }
+
+
+
+} diff --git a/template/language.templ b/template/language.templ new file mode 100644 index 0000000..1b48295 --- /dev/null +++ b/template/language.templ @@ -0,0 +1,54 @@ +package template + +import ( + "strings" + + "git.thomasvoss.com/euro-cash.eu/lib" +) + +templ Language() { + {{ p := ctx.Value("printer").(lib.Printer) }} +
+ @navbar() +

{ p.T("Select Your Language") }

+
+
+

+ { p.T("Select your preferred language to use on the site.") } +

+

+ If you are an American user, it’s suggested that you select + American English instead of British English. This will ensure that + dates will be formatted with the month before the day. +

+
+

{ p.T("Eurozone Languages") }

+ @languageGrid(true) +

{ p.T("Other Languages") }

+ @languageGrid(false) +
+} + +templ languageGrid(eurozone bool) { +
+
+ for _, loc := range lib.Locales { + if loc.Eurozone == eurozone { + + } + } +
+
+} diff --git a/template/navbar.templ b/template/navbar.templ new file mode 100644 index 0000000..2aceac2 --- /dev/null +++ b/template/navbar.templ @@ -0,0 +1,241 @@ +package template + +import "git.thomasvoss.com/euro-cash.eu/lib" + +templ navbar() { + {{ p := ctx.Value("printer").(lib.Printer) }} +
+} + +css noMargin() { + margin: 0; +} diff --git a/template/root.templ b/template/root.templ new file mode 100644 index 0000000..657314c --- /dev/null +++ b/template/root.templ @@ -0,0 +1,23 @@ +package template + +import "git.thomasvoss.com/euro-cash.eu/lib" + +templ Root() { + {{ p := ctx.Value("printer").(lib.Printer) }} +
+ @navbar() +
+

{ p.T("The Euro Cash Compendium") }

+

+ { p.T("United in") } + { p.T("diversity") } + { p.T("cash") } +

+
+
+
+

+ { p.T("Welcome to the Euro Cash Compendium. This sites aims to be a resource for you to discover everything there is to know about the coins and banknotes of the Euro, a currency that spans 26 countries and 350 million people. We also have dedicated sections of the site for collectors.") } +

+
+} -- cgit v1.2.3