From 540c86f93f92990ec78ba0a9181e61fc81708705 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Sun, 8 Dec 2024 22:43:50 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Drop=20buggy=20"solved=20times"?= =?UTF-8?q?=20at=20the=20end=20of=20each=20advent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdventOfTheDayBuilder.tsx | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/website/blog/2024-12-01-advent-of-pbt-day-1/AdventOfTheDayBuilder.tsx b/website/blog/2024-12-01-advent-of-pbt-day-1/AdventOfTheDayBuilder.tsx index ec9861734a9..3ba5e56fc2e 100644 --- a/website/blog/2024-12-01-advent-of-pbt-day-1/AdventOfTheDayBuilder.tsx +++ b/website/blog/2024-12-01-advent-of-pbt-day-1/AdventOfTheDayBuilder.tsx @@ -147,44 +147,12 @@ export function buildAdventOfTheDay(options: Options) { placeholder={`Example of answer:\n${placeholderForm}`} >
-
- - -
+ ); } - function SolvedTimes() { - const [times, setTimes] = useState(null); - useEffect(() => { - async function update() { - try { - const response = await fetch(`https://api.counterapi.dev/v1/fast-check/AdventOfPBT2024Day${day}Success`); - const data = await response.json(); - const count = data.count || 0; - setTimes(count); - } catch (err) { - setTimes(-1); - } - } - update(); - }, []); - - return ( - - {times === null - ? 'Loading the solve count...' - : times === 0 - ? 'Be the first to solve this challenge!' - : times === -1 - ? 'Unable to retrieve the solve count at the moment.' - : `This puzzle has been solved ${times} time${times > 1 ? 's' : ''}!`} - - ); - } - return { AdventPlaygroundOfTheDay, FormOfTheDay }; }