Skip to content

Refactor post and comment handling; enhance sharing logic#13

Open
Pdzly wants to merge 15 commits into
whysodank:masterfrom
Pdzly:feature/comment_link
Open

Refactor post and comment handling; enhance sharing logic#13
Pdzly wants to merge 15 commits into
whysodank:masterfrom
Pdzly:feature/comment_link

Conversation

@Pdzly

@Pdzly Pdzly commented May 7, 2025

Copy link
Copy Markdown
Contributor

Refactored post and comment functionalities by introducing MemePost and optimizing metadata handling. Updated comment scroll behavior and added an advanced sharing flow via Web Share API and Clipboard.

I did NOT implement the case when there are too many comments to fit in one batch ( and "when" replies are implemented that needs to handled too )

grafik

URL:
http://local-whysodank.com/posts/a8316130c26f43ff8639006dc670c86c/comment/5249bbecbf0b4c32acc68d21d3f7330a

Title will be:
user.username - comment on post.title

One thing i could not find out how to do really is for metadata the html body text.

Refactored post and comment functionalities by introducing `MemePost` and optimizing metadata handling. Updated comment scroll behavior and added an advanced sharing flow via Web Share API and Clipboard. Adjusted configurations and documentation for frontend and container compatibility improvements.
@Pdzly Pdzly marked this pull request as draft May 8, 2025 03:49
@Pdzly

Pdzly commented May 8, 2025

Copy link
Copy Markdown
Contributor Author

I have found some issues will fix them

@isik-kaplan

Copy link
Copy Markdown
Contributor

Can you also split this into two PRs so we can work on the dev environment part in another PR?

I think instead of having complete different compose files maybe we can use extends feature of docker compose which may allow us to just change small parts instead of repeating everything - also instead of a docker-dev-frontend docker-dev-backend etc I'd prefer a single docker-compose-dev that has volumes to both front-end and back-end code and works with auto refreshes on both backend and front-end

@Pdzly

Pdzly commented May 8, 2025

Copy link
Copy Markdown
Contributor Author

I tried to do that always, but the auto refresh is really unreliable "though" docker. But we can still try it.

@Pdzly

Pdzly commented May 8, 2025

Copy link
Copy Markdown
Contributor Author

Reverted all the changes with the local env

Pdzly and others added 6 commits May 8, 2025 17:08
Removed unnecessary console.log statements used for debugging postId and commentId. This cleanup improves code readability and avoids cluttering the console during runtime.
@Pdzly Pdzly marked this pull request as ready for review May 11, 2025 09:17
# Conflicts:
#	wsd-frontend/src/app/(app)/posts/[hex]/page.tsx

@isik-kaplan isik-kaplan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can merge this if you just move some code around and optionally add the comment body to the metadata (if you want I can handle that part)

My comments are mostly ocd fueled nitpicks and trying to follow some unwritten conventions I have:

  • Keep the metadata functions definitions in the page component files
  • 1 component 1 file (for stuff under /wsd/)
  • Write reusable stuff if we can and prioritize declarative ui instead of imperative
  • Try to keep the ui consistent as much as we can even if the previous decisions were wrong(if there are wrong we should try to change it all at once so that the ui is still consistent)

But other than these this is a great addition thank you.

I also have a design question:

image

I made the background black for the selected comment, do you think this makes it "pop" more? Totally your decision, if you want we can keep it with the border/outline you have

Comment thread wsd-frontend/next.config.mjs Outdated
Comment thread wsd-frontend/src/app/(app)/posts/[hex]/comment/[commentHex]/page.tsx Outdated
Comment thread wsd-frontend/src/app/(app)/posts/[hex]/page.tsx Outdated
Comment thread wsd-frontend/src/components/wsd/MemeComment/MemeComment.tsx Outdated
if (!_.isUndefined(comment)) {
const commentData = includesType(comment, 'user', 'User')

// @TODO: Handle comment body

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you looking to render the comment and then return the text? That might be slightly complicated, we can render the comments on the backend but we can't get the text easily, we can throw in something like jsdom to emulate dom and use some dom method to get the text, that's the only method I can think of right now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes but i dont know how to do it really, i would rather butcher your fine code even more.

Comment thread wsd-frontend/src/components/wsd/MemeComment/MemeComment.tsx Outdated
Comment thread wsd-frontend/src/components/wsd/MemeComment/MemeComment.tsx Outdated
Pdzly added 2 commits May 16, 2025 19:58
Removed an unnecessary console.log statement that appeared to be a debugging artifact. This change cleans up the code and improves maintainability by removing unused code.
@Pdzly

Pdzly commented May 16, 2025

Copy link
Copy Markdown
Contributor Author

If you are able could you do the comment body? As i have no clue.

@Pdzly

Pdzly commented May 16, 2025

Copy link
Copy Markdown
Contributor Author

grafik
Updated style

Replaced custom scroll logic in `MemeComment` with the reusable `ScrollToHashContainer` component. Improved code structure by simplifying properties while preserving existing functionality for smooth scrolling and highlighting targeted comments.
@Pdzly

Pdzly commented May 16, 2025

Copy link
Copy Markdown
Contributor Author

@isik-kaplan done all of your comments, let me know if this is ok.

The only thing that is left is the comment body parsing.

@isik-kaplan

Copy link
Copy Markdown
Contributor

This looks good, thank you, I'll add the comment body stuff asap and merge it

Pdzly added 2 commits June 3, 2025 17:44
…ure/comment_link

# Conflicts:
#	wsd-frontend/next.config.mjs
#	wsd-frontend/src/app/(app)/posts/[hex]/page.tsx
#	wsd-frontend/src/components/wsd/MemeComment/MemeComment.tsx
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.

2 participants