From 3fa32ec57c65c8f5266709f12a33d1d4420cd018 Mon Sep 17 00:00:00 2001 From: counterweight Date: Mon, 19 May 2025 23:44:55 +0200 Subject: [PATCH] exercise 1.8 and 1.9 --- parts/1/uniCafe/src/App.jsx | 49 +++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/parts/1/uniCafe/src/App.jsx b/parts/1/uniCafe/src/App.jsx index 1ab4c6b..7155b64 100644 --- a/parts/1/uniCafe/src/App.jsx +++ b/parts/1/uniCafe/src/App.jsx @@ -32,6 +32,39 @@ const App = () => { return good / computeTotalCount(); }; + const isThereAnyFeedback = () => { + return computeTotalCount() !== 0; + }; + + let feedbackSection; + if (isThereAnyFeedback()) { + feedbackSection = ( + <> + + + + + + + + ); + } else { + feedbackSection = ( + <> +

No feedback given.

+ + ); + } + return (
@@ -54,21 +87,7 @@ const App = () => { buttonText="bad" />
- - - - - - + {feedbackSection}
); // Buttons