From c09ab868d42a5c15f36e2ba9f55a9668da46e157 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 8 Aug 2023 20:43:00 +0100 Subject: Nicifies Lallans issues --- src/components/LallansIssue.astro | 37 ++++++++++++++++++++++ src/components/LallansIssueContributions.astro | 29 +++++++++++++++++ src/components/LallansIssueContributors.astro | 18 +++++++++++ src/i18n/translations/site.ts | 6 +++- .../furthsettins/lallans/[issueNumber].astro | 5 ++- src/types/LallansIssue.d.ts | 4 +-- 6 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 src/components/LallansIssue.astro create mode 100644 src/components/LallansIssueContributions.astro create mode 100644 src/components/LallansIssueContributors.astro (limited to 'src') diff --git a/src/components/LallansIssue.astro b/src/components/LallansIssue.astro new file mode 100644 index 0000000..e57a33c --- /dev/null +++ b/src/components/LallansIssue.astro @@ -0,0 +1,37 @@ +--- +import translate from "../i18n/translate"; +import tSite from '../i18n/translations/site'; +import type LallansIssue from "../types/LallansIssue"; +import type Locale from "../types/Locale"; +import LallansIssueContributions from "./LallansIssueContributions.astro"; +import LallansIssueContributors from "./LallansIssueContributors.astro"; + +interface Props { + issue: LallansIssue; + locale: Locale; +} + +const { issue, locale } = Astro.props; +const t = translate(locale); +--- + +
+
+

{ t(tSite, 'lallans') } { issue.issueNumber }

+

{ issue.description[locale] }

+
+ +
+ + +
+
+ +{ 'contributions' in issue ? ( + + ) : ( + 'contributors' in issue ? ( + + ) : (<>) + ) +} \ No newline at end of file diff --git a/src/components/LallansIssueContributions.astro b/src/components/LallansIssueContributions.astro new file mode 100644 index 0000000..73634a2 --- /dev/null +++ b/src/components/LallansIssueContributions.astro @@ -0,0 +1,29 @@ +--- +import translate from "../i18n/translate"; +import tSite from '../i18n/translations/site'; +import type { Contribution } from '../types/LallansIssue'; +import type Locale from '../types/Locale'; + +interface Props { + contributions: Contribution[]; + locale: Locale; +} + +const { contributions, locale } = Astro.props; +const t = translate(locale); +--- + +
+

Contributions

+
    + { contributions.map(contribution => ( +
  • + { contribution.title } + { 'author' in contribution ? ( + { t(tSite, 'by') } { contribution.author } + ) : (<>) + } +
  • + ))} +
+
\ No newline at end of file diff --git a/src/components/LallansIssueContributors.astro b/src/components/LallansIssueContributors.astro new file mode 100644 index 0000000..4149e11 --- /dev/null +++ b/src/components/LallansIssueContributors.astro @@ -0,0 +1,18 @@ +--- +import type { Contributor } from '../types/LallansIssue'; + +interface Props { + contributors: Contributor[]; +} + +const { contributors } = Astro.props; +--- + +
+

Contributors

+
    + { contributors.map(contributor => ( +
  • { contributor }
  • + ))} +
+
\ No newline at end of file diff --git a/src/i18n/translations/site.ts b/src/i18n/translations/site.ts index 6699619..726f22c 100644 --- a/src/i18n/translations/site.ts +++ b/src/i18n/translations/site.ts @@ -12,7 +12,11 @@ const siteTranslations = { 'lallans': { 'sco': 'Lallans', 'en-GB': 'Lallans', - } + }, + 'by': { + 'sco': 'bi', + 'en-GB': 'by', + }, }; type Keys = keyof typeof siteTranslations; diff --git a/src/pages/[locale]/furthsettins/lallans/[issueNumber].astro b/src/pages/[locale]/furthsettins/lallans/[issueNumber].astro index 78afe1f..d6d7257 100644 --- a/src/pages/[locale]/furthsettins/lallans/[issueNumber].astro +++ b/src/pages/[locale]/furthsettins/lallans/[issueNumber].astro @@ -3,10 +3,10 @@ import Page from '../../../../layouts/Page.astro'; import localeStaticPaths from '../../../../lib/localeStaticPaths'; import translate from '../../../../i18n/translate'; import tFurthsettins from '../../../../i18n/translations/pages/furthsettins'; -import tSite from '../../../../i18n/translations/site'; import type Locale from '../../../../types/Locale'; import { getLallansIssue } from '../../../../data/lallans'; import type LallansIssueNumber from '../../../../types/LallansIssueNumber'; +import LallansIssue from '../../../../components/LallansIssue.astro'; export async function getStaticPaths() { const lallansIssueNumbers = Object.keys(getLallansIssue) as `${LallansIssueNumber}`[]; @@ -24,6 +24,5 @@ const issue = await getLallansIssue[issueNumber](); --- -

{ t(tSite, 'lallans') } { issueNumber }

-

{ issue.description[locale] }

+
\ No newline at end of file diff --git a/src/types/LallansIssue.d.ts b/src/types/LallansIssue.d.ts index 2f6355d..d8339b1 100644 --- a/src/types/LallansIssue.d.ts +++ b/src/types/LallansIssue.d.ts @@ -17,7 +17,7 @@ type LallansIssue = { Record ); -type Contributor = string; -type Contribution = { author?: string, title: string }; +export type Contributor = string; +export type Contribution = { author?: string, title: string }; export default LallansIssue; \ No newline at end of file -- cgit v1.2.3