Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ticruz38
Copy link
Collaborator

@ticruz38 ticruz38 commented Nov 29, 2024

#455

The rendering architecture needs to change, since we switch on kind only within NoteContent. With e.g. feeds, it will make more sense to swap out rendering for the entirety of the note instead. Kind handlers should only show up on non-kind-1 notes, and probably be integrated more tightly with the content. Also use a different icon.

I don't have the context or state of Coracle at the time of this comment but from what I can see in the code, I have some questions:

  • You do still switch NoteContent based on kind.
  • By entirety of the note do you mean having NoteActions embedded in NoteContent? I like both being separated still.
  • Kind Handlers are tightly integrated with the note content, as it seems each handlers has a kind "attached" to it. You are already switching handlers based on the Note kind. Or you want to use another means, aside from the note kind, to filter out the Note handler?
  • The icon choice is quite limited on Font-Awesome, I came up with the fa-list icon, which seems more appropriate, for a wider range of icon I personally use iconify, but that's a big departure from font-awesome, even though iconify support font-awesome too. It does add some dependencies that you need to be confortable with.

@ticruz38
Copy link
Collaborator Author

ticruz38 commented Dec 2, 2024

https://github.com/ticruz38/coracle/tree/fix/open-with-iconify

Check this branch out for an iconify version

@staab staab changed the base branch from master to dev December 2, 2024 17:29
@staab
Copy link
Collaborator

staab commented Dec 2, 2024

The iconify version looks better, but we shouldn't add a dependency. See if you can get something like that into Icon.svelte in svg format (although with an arrow would be preferable). I often use https://www.flaticon.com/ for stuff like this.

For an illustration of what I mean, certain note kinds should ideally be able to take over the layout of the profile picture etc. to differentiate them from normal notes. Here's how a feed event currently looks:

Screenshot 2024-12-02 at 9 40 55 AM

Which obviously is not ideal. Here's an example of how it might look:

Screenshot 2024-12-02 at 9 46 25 AM

This is going to be very hairy to accomplish, since it'll require allowing NoteContentX components to call NoteActions internally, or maybe use crazy slots. Then, of course, there are quotes, which are already convoluted to avoid circular dependencies. The simplest solution might be to add logic to Note.svelte, but that's going to be ugly too. I'd really like the solution to be very clean, since there is so much mission-critical stuff going on in these files.

@ticruz38
Copy link
Collaborator Author

ticruz38 commented Dec 5, 2024

I'm halfway there. Here's what I have done so far:

  • Removed a lot of logic from Note.svelte, renaming it to Thread.svelte. It now defines the layout for each thread in the feed. A thread consists of a note and its replies and/or parents.
  • NoteContent.svelte is now NoteKind.svelte (to be renamed Note.svelte). NoteKind aggregates a NoteHeader, NoteContent, and NoteActions (footer) together. This allows us to remove the NoteHeader for certain NoteKind types, such as the Feed Event in your example.
  • NoteActions now takes on the bulk of the logic, such as counting/executing zaps, likes, replies, etc. This removes a ton of code from Note.svelte (now Thread.svelte) that was previously passed via props to the NoteActions component.

What's left to do:

  • The NoteReply component will use a store to set which note is being replied to or is still a draft, instead of relying on the replyCtrl binding.
  • Make sure I did not drop any CSS subtlety during the refactor

@ticruz38
Copy link
Collaborator Author

ticruz38 commented Dec 5, 2024

What could be nice trying:

  • Use svelte-infinite-scroll. This component allows us to determine what is visible on screen, which might give us an opportunity to optimise performance by only requesting/computing information for the elements on-screen or nearby. I'm thinking mostly of NoteActions.svelte, this one is probably the most expensive.

@staab staab modified the milestone: 0.6.0 Dec 5, 2024
Copy link
Collaborator

@staab staab left a comment

Choose a reason for hiding this comment

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

Interesting, looks fine so far, but I'm curious to see what it would look like applied to specific note kinds (e.g. feeds)

@staab
Copy link
Collaborator

staab commented Dec 5, 2024

I've gone ahead and bumped this update to 0.6.0 since it's more substantial than I was expecting.

@ticruz38 ticruz38 force-pushed the fix/open-with branch 4 times, most recently from 1bd9f3a to 84ae5c2 Compare December 12, 2024 13:19
@ticruz38
Copy link
Collaborator Author

This PR primarily refactor the Note.svelte component now renamed FeedItem.svelte

Note.svelte now represent just a single note in the feed and is divided into 3 parts: header, content and actions (footer).
It is now easier to fine tune the display depending on the note kind.

The "Open With" action now uses Niels' icon.

@ticruz38 ticruz38 requested a review from staab December 13, 2024 13:32
@staab
Copy link
Collaborator

staab commented Dec 13, 2024

Looks pretty good, can you fix conflicts? Also, can we get the icon to be a little thicker? The lines are skinnier than font-awesome's, so it looks sort of disabled.

@ticruz38
Copy link
Collaborator Author

rebased dev and increase open-with stroke width

Comment on lines 46 to 51
const openOptions = () => {
showOptions = true
}
const setOpts = e => {
opts = {...opts, ...e.detail}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like you've undone some of my changes, options are no longer working correctly on replies

Comment on lines 166 to 153
{#if showBorder}
<!-- {#if showBorder}
<AltColor background class="absolute -top-4 z-none h-5 w-1" />
{/if}
<div
transition:slide|local
class="note-reply relative my-2 gap-1"
bind:this={container}
on:click|stopPropagation>
{/if} -->
<div transition:slide|local class="note-reply relative my-2 gap-1" on:click|stopPropagation>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks unresolved

Copy link
Collaborator

@staab staab left a comment

Choose a reason for hiding this comment

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

Just a couple small things, when resolving conflicts try to keep the changes made upstream rather than revert them

@staab staab merged commit 417e1b5 into coracle-social:dev Dec 18, 2024
2 checks passed
staab pushed a commit that referenced this pull request Dec 30, 2024
* hide `open with` for kind 1 and change the icon

* refactor note thread

* - Rename Thread to FeedItem
- Refactor reply state

* - fix NoteActions when logged out
- add openWith icon

* rename NoteKind to Note

* fine tune the padding for feed note

* increase open-with icon stroke-width

* fix rebase

* merge fix
staab pushed a commit that referenced this pull request Jan 15, 2025
* hide `open with` for kind 1 and change the icon

* refactor note thread

* - Rename Thread to FeedItem
- Refactor reply state

* - fix NoteActions when logged out
- add openWith icon

* rename NoteKind to Note

* fine tune the padding for feed note

* increase open-with icon stroke-width

* fix rebase

* merge fix
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