diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index da50dd1..537484a 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -93,6 +93,7 @@ export default defineConfig({ TableOfContents: './src/components/TableOfContents.astro', PageTitle: './src/components/PageTitle.astro', MobileMenuFooter: './src/components/MobileMenuFooter.astro', + SiteTitle: './src/components/SiteTitle.astro', }, defaultLocale: 'root', locales, diff --git a/docs/src/components/ActionButtonFooter.astro b/docs/src/components/ActionButtonFooter.astro index 76213a3..b9346ca 100644 --- a/docs/src/components/ActionButtonFooter.astro +++ b/docs/src/components/ActionButtonFooter.astro @@ -11,17 +11,17 @@ const { data } = await getEntry('i18n', lang); diff --git a/docs/src/components/AnswerNumber.astro b/docs/src/components/AnswerNumber.astro new file mode 100644 index 0000000..634c4bc --- /dev/null +++ b/docs/src/components/AnswerNumber.astro @@ -0,0 +1,15 @@ +--- +const { challengeNumber } = Astro.props; +const response = await fetch(`https://api.github.com/search/issues?q=repo:tomalaforge/angular-challenges+is:pr+label:%22${challengeNumber}%22+label:%22answer%22&per_page=1`); +const { total_count } = await response.json(); +--- + +
Answered by {total_count} people
+ + diff --git a/docs/src/components/Author.astro b/docs/src/components/Author.astro index d2a8cb5..3ac6d1b 100644 --- a/docs/src/components/Author.astro +++ b/docs/src/components/Author.astro @@ -31,9 +31,9 @@ const { name, twitter, linkedin, github, data } = Astro.props; display: flex; gap: 0.5rem; align-items: center; - margin-top: -1rem; font-size: var(--sl-text-xs); color: var(--sl-color-gray-3); + width: max-content; } .icon { diff --git a/docs/src/components/ChallengeFooter.astro b/docs/src/components/ChallengeFooter.astro index cdf3eef..f295be1 100644 --- a/docs/src/components/ChallengeFooter.astro +++ b/docs/src/components/ChallengeFooter.astro @@ -10,6 +10,19 @@ const { data } = await getEntry('i18n', lang); const authorLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A${challengeNumber}+label%3A"answer+author"`; const communityLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A${challengeNumber}+label%3Aanswer+sort%3Areactions-%2B1-desc`; const npxCommand = `npx nx serve ${command}`; + +const response = await fetch(`https://api.github.com/search/issues?q=repo:tomalaforge/angular-challenges+is:pr+label:%22${challengeNumber}%22+label:%22answer%22`); +const { total_count, items } = await response.json(); + +let count = 1; +while(total_count > count*30) { + const response = await fetch(`https://api.github.com/search/issues?q=repo:tomalaforge/angular-challenges+is:pr+label:%22${challengeNumber}%22+label:%22answer%22&page=${count}`); + const { items: new_items } = await response.json(); + if(new_items && new_items.length === 0) break; + items.push(...new_items); + count++; +} + ---
@@ -49,7 +62,7 @@ const npxCommand = `npx nx serve ${command}`;
- ❖ {data['challenge.footer.communityAnswers']}* + ❖ {total_count} {data['challenge.footer.communityAnswers']}* @@ -70,6 +83,20 @@ const npxCommand = `npx nx serve ${command}`; }
+
+
Answered by
+ {(items ?? []).map((item) => ( + + ))} +
+ @@ -93,5 +120,17 @@ const npxCommand = `npx nx serve ${command}`; gap: 0.25rem; margin-top: 3rem; } + + + .solution-container { + margin-top: 3rem; + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + + img { + border-radius: 50%; + } + } diff --git a/docs/src/components/Content.astro b/docs/src/components/Content.astro index 7e2b020..c468b84 100644 --- a/docs/src/components/Content.astro +++ b/docs/src/components/Content.astro @@ -6,23 +6,27 @@ import Author from './Author.astro'; import ChallengeFooter from './ChallengeFooter.astro'; import CommentSection from './CommentSection.astro'; import ContributorsFooter from './ContributorsFooter.astro'; +import AnswerNumber from './AnswerNumber.astro'; const { lang } = Astro.props; const { data } = await getEntry('i18n', lang); const { challengeNumber } = Astro.props.entry.data; const author = Astro.props.entry.data.author ? await getEntry(Astro.props.entry.data.author) : null; const renderCommentSection = !Astro.props.entry.data.noCommentSection; + --- -{ challengeNumber && author && - } +{ challengeNumber ?
+ { author ? : null} + +
:null} -{challengeNumber && -} +{challengeNumber ? + : null} { renderCommentSection && } @@ -30,9 +34,12 @@ const renderCommentSection = !Astro.props.entry.data.noCommentSection; diff --git a/docs/src/components/MyIcon.astro b/docs/src/components/MyIcon.astro index 6543db0..25327f4 100644 --- a/docs/src/components/MyIcon.astro +++ b/docs/src/components/MyIcon.astro @@ -9,14 +9,15 @@ interface Props { class?: string; } -const { name, label, size = '1em', color } = Astro.props; +const { name, label, size = '1em', color, fill="currentColor", stroke="none", viewBox="0 0 24 24" } = Astro.props; const a11yAttrs = label ? ({ 'aria-label': label } as const) : ({ 'aria-hidden': 'true' } as const); --- - @@ -27,5 +28,6 @@ const a11yAttrs = label ? ({ 'aria-label': label } as const) : ({ 'aria-hidden': font-size: var(--sl-icon-size, 1em); width: 1em; height: 1em; + stroke-width: 2; } diff --git a/docs/src/components/SiteTitle.astro b/docs/src/components/SiteTitle.astro new file mode 100644 index 0000000..4a3ef71 --- /dev/null +++ b/docs/src/components/SiteTitle.astro @@ -0,0 +1,52 @@ +--- +import { getEntry } from 'astro:content'; +import type { Props } from '@astrojs/starlight/props'; +import Default from '@astrojs/starlight/components/SiteTitle.astro'; +import MyIcon from './MyIcon.astro'; +const { challengeNumber } = Astro.props.entry.data; +const { lang } = Astro.props; +const { data } = await getEntry('i18n', lang); + +const response = await fetch(`https://api.github.com/repos/tomalaforge/angular-challenges`); +const { stargazers_count, forks } = await response.json(); + + + + +--- + + + + + +
+ + +
{stargazers_count}
+
+ +
+ +
{forks}
+
+
+ + diff --git a/docs/src/components/icons.ts b/docs/src/components/icons.ts index 5ec7e19..bc4fcfe 100644 --- a/docs/src/components/icons.ts +++ b/docs/src/components/icons.ts @@ -1,6 +1,6 @@ export const Icons = { heart: - '', - fillHeart: - '', + '', + star: '', + fork: '', }; diff --git a/docs/src/content/docs/es/index.mdx b/docs/src/content/docs/es/index.mdx index f6b752c..291ca75 100644 --- a/docs/src/content/docs/es/index.mdx +++ b/docs/src/content/docs/es/index.mdx @@ -70,7 +70,7 @@ import SubscriptionForm from '../../../components/SubscriptionForm.astro'; diff --git a/docs/src/content/docs/fr/index.mdx b/docs/src/content/docs/fr/index.mdx index c16bc02..b7a929f 100644 --- a/docs/src/content/docs/fr/index.mdx +++ b/docs/src/content/docs/fr/index.mdx @@ -69,7 +69,7 @@ import SubscriptionForm from '../../../components/SubscriptionForm.astro'; diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx index f95e452..4e53c06 100644 --- a/docs/src/content/docs/index.mdx +++ b/docs/src/content/docs/index.mdx @@ -73,7 +73,7 @@ import SubscriptionForm from '../../components/SubscriptionForm.astro'; class="action" href="https://github.com/sponsors/tomalaforge" alt="Sponsor link"> - + Sponsor the Project diff --git a/docs/src/content/docs/pt/index.mdx b/docs/src/content/docs/pt/index.mdx index 068c538..eb73104 100644 --- a/docs/src/content/docs/pt/index.mdx +++ b/docs/src/content/docs/pt/index.mdx @@ -85,7 +85,7 @@ import SubscriptionForm from '../../../components/SubscriptionForm.astro'; diff --git a/docs/src/content/docs/ru/index.mdx b/docs/src/content/docs/ru/index.mdx index 35fe566..a4060a5 100644 --- a/docs/src/content/docs/ru/index.mdx +++ b/docs/src/content/docs/ru/index.mdx @@ -75,7 +75,7 @@ import SubscriptionForm from '../../../components/SubscriptionForm.astro';