Skip to content

Handing in Project Happy Thought - #55

Open
RPaemurd wants to merge 2 commits into
Technigo:mainfrom
RPaemurd:main
Open

Handing in Project Happy Thought#55
RPaemurd wants to merge 2 commits into
Technigo:mainfrom
RPaemurd:main

Conversation

@RPaemurd

@RPaemurd RPaemurd commented Dec 12, 2025

Copy link
Copy Markdown

Comment thread src/App.jsx
Comment on lines +35 to +56
<Route path="/" element={
<>
<header className="mt-10 text-center text-sm text-gray-500">
created by Rebecca Sighed &nbsp;|&nbsp;
<Link
to='/about'
className="text-[#ff7a63ff] underline hover:text-red-700"
>
About this app
</Link>
</header>
<ThoughtForm addThought={addThought} />
<ThoughtList thoughts={thoughts}
onLike={handleLike} />

</>
} />

{/* About-page: Only shows the About component */}
<Route path="/about" element={<About />} />

</Routes>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So nice with this extra route, explaning the project. I liked it a lot! :)

@@ -0,0 +1,37 @@
import { formatDistanceToNow } from 'date-fns';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are really many ways to display time, this was a new one for me :)

Comment thread src/api/thoughts.js
Comment on lines +1 to +25
const API_URL = 'https://happy-thoughts-api-4ful.onrender.com/thoughts';

export const fetchThoughts = async () => {
const response = await fetch(API_URL);
if (!response.ok) throw new Error('Failed to fetch thoughts');
return response.json();
};

export const postNewThought = async (message) => {
const response = await fetch(API_URL,{
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ message: message })
});
if (!response.ok) throw new Error('Could not send the thought');
return response.json();
};

export const likeThought = async (id) => {
const response = await fetch(API_URL + "/" + id + "/like", {
method: 'POST',

});
return response.json();
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to have this in a separate file, makes it more readable and easy to follow 👌🏽

createdAt: new Date().toISOString()
};
setThoughts([newToughtObject, ...thoughts]);
}; */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you forgot to delete this commented out code ;)

@marinalendt marinalendt left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work Rebecca, as always! Your code is to nice and easy to read, its well organized. I really like that you tried out the react route :D The infopart, gives it a nice twist! Also nice that you used Tailwind.
I saw that you forgot a commented out part in your Thoughtslist, maybe delete that one.
Otherwise, great job, and keep ut the good work! :D

Comment thread src/App.jsx Outdated
created by Rebecca Sighed &nbsp;|&nbsp;
<Link
to='/about'
className="text-[#ff7a63ff] underline hover:text-red-700"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#ff7a63ff is the same as just #ff7a63 :).
The last two just defines the opacity.

Comment thread src/api/thoughts.js
@@ -0,0 +1,25 @@
const API_URL = 'https://happy-thoughts-api-4ful.onrender.com/thoughts';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One central place for the api url and the api methods, nice!

@Npahlfer Npahlfer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally very good, you even used the react router before we started with it, nice! I would have wanted to see some of the stretch goals though :).
Also nice that you are mixing it up with tailwind. Good job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants