diff --git a/docs/src/components/AnswerNumber.astro b/docs/src/components/AnswerNumber.astro deleted file mode 100644 index ff4fb50..0000000 --- a/docs/src/components/AnswerNumber.astro +++ /dev/null @@ -1,15 +0,0 @@ ---- -const { challengeNumber } = Astro.props; -const response = await fetch(`https://api.github.com/search/issues?q=repo:tomalaforge/angular-challenges+is:pr+label:"${challengeNumber}"+label:"answer"&per_page=1`); -const { total_count } = await response.json(); ---- - -{total_count ?
Answered by {total_count} people
: null } - - diff --git a/docs/src/components/ChallengeFooter.astro b/docs/src/components/ChallengeFooter.astro index 8d8feec..a47fa2d 100644 --- a/docs/src/components/ChallengeFooter.astro +++ b/docs/src/components/ChallengeFooter.astro @@ -2,6 +2,7 @@ import VideoButton from './VideoButton.astro'; import ClipboardCopy from './ClipboardCopy.astro'; import { getEntry } from 'astro:content'; +import AnsweredUser from './github/AnsweredUser.svelte'; const { lang } = Astro.props; const { author, challengeNumber, title, blogLink, videoLink, command } = Astro.props.entry.data; @@ -11,27 +12,6 @@ const authorLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=la 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}`; -let items = []; -let page = 1; -let error = false; -try { -while (true) { - const response = await fetch(`https://api.github.com/search/issues?q=repo:tomalaforge/angular-challenges+is:pr+label:"${challengeNumber}"+label:"answer"&per_page=100&page=${page}`); - if (!response.ok) { - throw new Error('Network response was not ok'); - } - const { items: new_items, total_count } = await response.json(); - if (!new_items || new_items.length === 0) break; - items.push(...new_items); - - if(total_count < page * 100) break; - - page++; -} -} catch (e) { - error = true; -} - ---
@@ -71,7 +51,7 @@ while (true) {
- ❖ {items.length > 0 ? items.length : ''} {data['challenge.footer.communityAnswers']}* + ❖ {data['challenge.footer.communityAnswers']}* @@ -92,20 +72,7 @@ while (true) { }
-{error ? null : -
-
Answered by
- {(items ?? []).map((item) => ( - - ))} -
} +