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 --- templates/about.templ | 52 --------- templates/base.go | 63 ---------- templates/base.templ | 59 ---------- templates/coins.templ | 53 --------- templates/coins_designs.templ | 41 ------- templates/coins_designs_nl.templ | 43 ------- templates/language.templ | 54 --------- templates/navbar.templ | 241 --------------------------------------- templates/root.templ | 23 ---- 9 files changed, 629 deletions(-) delete mode 100644 templates/about.templ delete mode 100644 templates/base.go delete mode 100644 templates/base.templ delete mode 100644 templates/coins.templ delete mode 100644 templates/coins_designs.templ delete mode 100644 templates/coins_designs_nl.templ delete mode 100644 templates/language.templ delete mode 100644 templates/navbar.templ delete mode 100644 templates/root.templ (limited to 'templates') diff --git a/templates/about.templ b/templates/about.templ deleted file mode 100644 index 8add2dd..0000000 --- a/templates/about.templ +++ /dev/null @@ -1,52 +0,0 @@ -package templates - -import "git.thomasvoss.com/euro-cash.eu/i18n" - -const ( - contactEmail = `mail@euro-cash.eu` - repoLinkStart = `` - linkEnd = `` -) - -templ About() { - {{ p := ctx.Value("printer").(i18n.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/templates/base.go b/templates/base.go deleted file mode 100644 index 76a4da6..0000000 --- a/templates/base.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:generate templ generate -log-level warn - -package templates - -import ( - "fmt" - "slices" - - "git.thomasvoss.com/euro-cash.eu/i18n" - "golang.org/x/text/collate" - "golang.org/x/text/language" -) - -type country struct { - code, name string -} - -type sortType int - -const ( - sortByCode sortType = iota - sortByName -) - -func countries(p i18n.Printer, sort sortType) []country { - xs := []country{ - {code: "AD", name: p.T("Andorra")}, - {code: "AT", name: p.T("Austria")}, - {code: "BE", name: p.T("Belgium")}, - {code: "CY", name: p.T("Cyprus")}, - {code: "DE", name: p.T("Germany")}, - {code: "EE", name: p.T("Estonia")}, - {code: "ES", name: p.T("Spain")}, - {code: "FI", name: p.T("Finland")}, - {code: "FR", name: p.T("France")}, - {code: "GR", name: p.T("Greece")}, - {code: "HR", name: p.T("Croatia")}, - {code: "IE", name: p.T("Ireland")}, - {code: "IT", name: p.T("Italy")}, - {code: "LT", name: p.T("Lithuania")}, - {code: "LU", name: p.T("Luxembourg")}, - {code: "LV", name: p.T("Latvia")}, - {code: "MC", name: p.T("Monaco")}, - {code: "MT", name: p.T("Malta")}, - {code: "NL", name: p.T("Netherlands")}, - {code: "PT", name: p.T("Portugal")}, - {code: "SI", name: p.T("Slovenia")}, - {code: "SK", name: p.T("Slovakia")}, - {code: "SM", name: p.T("San Marino")}, - {code: "VA", name: p.T("Vatican City")}, - } - switch sort { - case sortByCode: - case sortByName: - c := collate.New(language.MustParse(p.Locale.Bcp)) - slices.SortFunc(xs, func(x, y country) int { - return c.CompareString(x.name, y.name) - }) - default: - panic(fmt.Sprintf("Attempted to sort by invalid sortType=%d", sort)) - } - return xs -} diff --git a/templates/base.templ b/templates/base.templ deleted file mode 100644 index e6c4a1d..0000000 --- a/templates/base.templ +++ /dev/null @@ -1,59 +0,0 @@ -package templates - -import "git.thomasvoss.com/euro-cash.eu/i18n" - -templ Base(head, body templ.Component) { - {{ p := ctx.Value("printer").(i18n.Printer) }} - - - - - - - Euro Cash - - if head != nil { - @head - } - - - if body != nil { - @body - } - - - -} diff --git a/templates/coins.templ b/templates/coins.templ deleted file mode 100644 index 050d7e8..0000000 --- a/templates/coins.templ +++ /dev/null @@ -1,53 +0,0 @@ -package templates - -import "git.thomasvoss.com/euro-cash.eu/i18n" - -const newsLinkStart = `` - -templ Coins() { - {{ p := ctx.Value("printer").(i18n.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/templates/coins_designs.templ b/templates/coins_designs.templ deleted file mode 100644 index 4732ab0..0000000 --- a/templates/coins_designs.templ +++ /dev/null @@ -1,41 +0,0 @@ -package templates - -import ( - "fmt" - "strings" - - "git.thomasvoss.com/euro-cash.eu/i18n" -) - -var varietiesLinkStart = `` - -func makeURL(c country) templ.SafeURL { - url := fmt.Sprintf("/coins/designs/%s", strings.ToLower(c.code)) - return templ.SafeURL(url) -} - -templ CoinsDesigns() { - {{ p := ctx.Value("printer").(i18n.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/templates/coins_designs_nl.templ b/templates/coins_designs_nl.templ deleted file mode 100644 index d0d82da..0000000 --- a/templates/coins_designs_nl.templ +++ /dev/null @@ -1,43 +0,0 @@ -package templates - -import "git.thomasvoss.com/euro-cash.eu/i18n" - -templ CoinsDesignsNl() { - {{ p := ctx.Value("printer").(i18n.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/templates/language.templ b/templates/language.templ deleted file mode 100644 index 58dc8b6..0000000 --- a/templates/language.templ +++ /dev/null @@ -1,54 +0,0 @@ -package templates - -import ( - "strings" - - "git.thomasvoss.com/euro-cash.eu/i18n" -) - -templ Language() { - {{ p := ctx.Value("printer").(i18n.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 i18n.Locales { - if loc.Eurozone == eurozone { - - } - } -
-
-} diff --git a/templates/navbar.templ b/templates/navbar.templ deleted file mode 100644 index f0b030c..0000000 --- a/templates/navbar.templ +++ /dev/null @@ -1,241 +0,0 @@ -package templates - -import "git.thomasvoss.com/euro-cash.eu/i18n" - -templ navbar() { - {{ p := ctx.Value("printer").(i18n.Printer) }} - -} - -css noMargin() { - margin: 0; -} diff --git a/templates/root.templ b/templates/root.templ deleted file mode 100644 index bfe9210..0000000 --- a/templates/root.templ +++ /dev/null @@ -1,23 +0,0 @@ -package templates - -import "git.thomasvoss.com/euro-cash.eu/i18n" - -templ Root() { - {{ p := ctx.Value("printer").(i18n.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