Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[client] Highlight linked comments to identify them #845

Merged
merged 6 commits into from
May 20, 2022

Conversation

BBaoVanC
Copy link
Contributor

@BBaoVanC BBaoVanC commented Apr 24, 2022

Fixes #838

TODO:

  • Figure out the best way to do styling
  • Docs
  • Tests (check that .isso-target gets applied properly)

@ix5 ix5 marked this pull request as draft April 24, 2022 00:41
@ix5 ix5 added client (Javascript) client code and CSS feature labels Apr 24, 2022
@ix5 ix5 added this to the 0.13 milestone Apr 24, 2022
@ix5 ix5 added the improvement Not a new feature, but makes Isso more pleasant to use label Apr 24, 2022
@BBaoVanC BBaoVanC force-pushed the highlight-linked-comment branch 3 times, most recently from cdd1c1c to b0da339 Compare May 7, 2022 22:46
@BBaoVanC BBaoVanC marked this pull request as ready for review May 7, 2022 22:50
@BBaoVanC BBaoVanC marked this pull request as draft May 7, 2022 22:52
@BBaoVanC
Copy link
Contributor Author

BBaoVanC commented May 7, 2022

@ix5 Can you take a look at this please?

I have CSS added to set a background color included. I don't think that separating it out like what we did in #844 makes sense because this feature should be included by default. It's also different since it doesn't require any configuration by the site owner to function.

Also, I did figure out how to get it not to conflict with #844. By not setting the 100% keyframe, it automatically just fades out to whatever background color is the fallback for the element.

Let me know if there's a better place for the hashchange event listener, and if window.addEventListener is the right function to use for it; I wasn't really sure what to do with it.

@BBaoVanC BBaoVanC marked this pull request as ready for review May 7, 2022 23:14
@ix5
Copy link
Member

ix5 commented May 7, 2022

Hey @BBaoVanC, I'm off to a well-deserved break, starting tomorrow. So I won't be able to review your changes for about a week.

Let's do a deal: You figure out a solution and submit draft PRs to at least some of these open issues which I think you're more than capable of solving:

... and I'll be happy to take some time to review this highlighting PR once I get back ;-)

Would also be nice if at some of these low hanging fruits could be fixed:

@BBaoVanC
Copy link
Contributor Author

BBaoVanC commented May 7, 2022

Hey @BBaoVanC, I'm off to a well-deserved break, starting tomorrow. So I won't be able to review your changes for about a week.

Let's do a deal: You figure out a solution and submit draft PRs to at least some of these open issues which I think you're more than capable of solving:

* [Make name/URL/e-mail editable #111](https://github.com/posativ/isso/issues/111)

* [Counter problem #448](https://github.com/posativ/isso/issues/448)

* [Bugs with indented code #465](https://github.com/posativ/isso/issues/465)

* [[client] Clean up and standardize client CSS #859](https://github.com/posativ/isso/issues/859)

* Race conditions / re-arranging parts in [[client] js: Fetch public conf once from /config; embed.js: Preserve default config values #821](https://github.com/posativ/isso/pull/821) and [[client] `fetchComments` is adding another PostBox even if there is already one displayed #842](https://github.com/posativ/isso/issues/842)

... and I'll be happy to take some time to review this highlighting PR once I get back ;-)

Would also be nice if at some of these low hanging fruits could be fixed:

* [Log out of admin interface #552](https://github.com/posativ/isso/issues/552)

* [Isso always calls count even if not needed #771](https://github.com/posativ/isso/issues/771)

I'll take a look at those. Hope you have a nice break!

@BBaoVanC BBaoVanC force-pushed the highlight-linked-comment branch 2 times, most recently from daef1d8 to fdcadad Compare May 10, 2022 00:43
Copy link
Member

@ix5 ix5 left a comment

Choose a reason for hiding this comment

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

I have CSS added to set a background color included. I don't think that separating it out like what we did in #844 makes sense because this feature should be included by default. It's also different since it doesn't require any configuration by the site owner to function.

That's fine. As commented inline, the yellow is a bit jarring at night, but yellow is universally accepted as a marker/highlight/attention color. Maybe once there's a dark mode someone can style it differently. Keep as-is for now.

Let me know if there's a better place for the hashchange event listener, and if window.addEventListener is the right function to use for it; I wasn't really sure what to do with it.

I'm not qualified to comment on event listeners, my JS knowledge is pretty bad. I found this SO answer which seems to suggest a similar thing. Availability of Caniuse: hashchange seems good.

As for stuffing this piece of code into init(): IMO that file is already quite overloaded. Maybe shoving everything related to timers and events into a separate file (that can be stubbed/mocked) would simplify testing a good bit.

Several places rely on window.location.*. Unifying that would be a nice first step.
E.g. this is just a stupid duplication:
https://github.com/posativ/isso/blob/fdcadaddcd87fe97fbd7ca328a2ef7ea56eccb87/isso/js/app/api.js#L7
https://github.com/posativ/isso/blob/fdcadaddcd87fe97fbd7ca328a2ef7ea56eccb87/isso/js/embed.js#L74

isso/css/isso.css Outdated Show resolved Hide resolved
isso/css/isso.css Show resolved Hide resolved
isso/js/embed.js Show resolved Hide resolved
isso/js/embed.js Outdated Show resolved Hide resolved
@ix5
Copy link
Member

ix5 commented May 16, 2022

Would you mind adding a small styling guide to the docs? (Perhaps under "Tips & Tricks", 1-2 lines should be enough).

Code-wise, this looks good right now.

@BBaoVanC
Copy link
Contributor Author

Would you mind adding a small styling guide to the docs? (Perhaps under "Tips & Tricks", 1-2 lines should be enough).

Code-wise, this looks good right now.

I added some docs, now all that's left is a small test if possible which just makes sure that .isso-target gets applied when going to like #isso-1 for example.

@ix5 ix5 changed the title Highlight linked comments to identify them [client] Highlight linked comments to identify them May 20, 2022
@ix5
Copy link
Member

ix5 commented May 20, 2022

Added some tests. Thank you and looking forward to reviewing other great contributions!

@ix5 ix5 merged commit 1015aaa into isso-comments:master May 20, 2022
@BBaoVanC BBaoVanC deleted the highlight-linked-comment branch May 20, 2022 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client (Javascript) client code and CSS feature improvement Not a new feature, but makes Isso more pleasant to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[client] When scrolling to a linked comment, it should have some highlight
2 participants