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

feat: add nests (a.k.a namespaces) #4112

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

andresmanelli
Copy link

Hello,

First of all, thank you for this amazing tool. I love the simplicity of it and the clean UI.

What I'm missing is the ability to separate personal/work/other notes (maybe it is there, and I couldn't find it).

Anyway, I thought of giving it a try, so I added what I called nests: basically, a group of notes that belong to a namespace.

I'm no front-end developer, so there are a couple of things missing.
For the moment, there are only two hard-coded nests in the UI.

  • Get the user's nests and show their names in the menu
  • Add/Remove nests from the UI
  • Others?

I added the nest filter to several requests, so you can switch back and forth without issues:

nests

Let me know what you think.

@RoccoSmit
Copy link
Contributor

Adding some issues to align PR with other's request
#3830
#3984

@RoccoSmit
Copy link
Contributor

RoccoSmit commented Nov 9, 2024

@andresmanelli, can you provide some more context around what you are after / how you see nests working.

From the code if look like, as you mentioned, 1 nest can have many memos allowing you to group memos into their own context space. From the gif It look like on the FE you using nests as a tag filter. e.g. When you click on a nest the metadata records are not filtered for the nest group. The gif shows the tags are shared across nests. Is this intended? If so, can the same functionality be achieved expanding on the existing tag infrastructure?

Do you see nests only being used on on the home page or are shared spaces such as explore and the user pages also needing to make use of them in some way?

@andresmanelli
Copy link
Author

@andresmanelli, can you provide some more context around what you are after / how you see nests working.

Sure @RoccoSmit, let's say I want to work on my personal notes, my work-related notes, and some project-specific notes. I wouldn't want to mix all of them in the UI, I'd prefer to switch between these namespaces and see their content.

From the code if look like, as you mentioned, 1 nest can have many memos allowing you to group memos into their own context space. From the gif It look like on the FE you using nests as a tag filter. e.g. When you click on a nest the metadata records are not filtered for the nest group. The gif shows the tags are shared across nests. Is this intended?

Actually no, I did't quite get how the tags are read from the database, so I couldn't get that done. I think tags that are created in notes of a nest should be show for that nest, but not for the others.

If so, can the same functionality be achieved expanding on the existing tag infrastructure?

I don't think using tags to filter a namespace is a great idea, as it would require using specific tag names to identify nests (maybe there is another way?). Using a specific database column seems cleaner to me. It does not pollute the rest of the functionality.

Do you see nests only being used on on the home page or are shared spaces such as explore and the user pages also needing to make use of them in some way?

I didn't filter the explore page, as I think it is intended to show everything that is Public or Protected (independently of the nest currently being used). Could you explain to me what do you mean by user pages ?


Also, I did not look into the resources for the moment. I think they should be filtered using the related memo's nest (in the resources page).

@andresmanelli
Copy link
Author

Hey @RoccoSmit I added some changes:

  • Use the nest name nests/id as parameter to filters
  • Correctly filter metadata
  • Display actual nest information in the nest list
  • Add the nest_service

I will try to add the nest creation and the default nest selection in the user settings to have an "mvp" of this feature ready.

Thanks again for your comments.

@RoccoSmit
Copy link
Contributor

@andresmanelli, good work with the POC. My suggestion at this point, before you spend more time on it, would be to get @boojack and/or @johnnyjoygh 's input on if this feature fits in with their long term view of Memos (this is usually part of issue reviews) so that you have an understanding on if this feature will be merged or not

@andresmanelli
Copy link
Author

@RoccoSmit of course, I understand!

I will probably add those two last things anyway to be able to use this, but I'll wait for comments on whether they find it interesting.

@johnnyjoygh
Copy link
Collaborator

@andresmanelli I think the Supernotes Collection could be a more fitting solution for the problem you're trying to solve. It allows users to organize their notes into distinct collections, which effectively separates different contexts or categories (like personal, work, and project-specific notes) without mixing them up in the UI. Each collection serves as a namespace, giving you the ability to group related notes together while keeping them isolated from other collections.

store/db/mysql/memo.go Outdated Show resolved Hide resolved
store/db/postgres/memo.go Outdated Show resolved Hide resolved
store/migration/sqlite/prod/0.23/00__reactions.sql Outdated Show resolved Hide resolved
store/migration/sqlite/prod/0.23/00__reactions.sql Outdated Show resolved Hide resolved
store/migration/sqlite/prod/0.23/00__reactions.sql Outdated Show resolved Hide resolved
store/migration/sqlite/prod/LATEST.sql Outdated Show resolved Hide resolved
Comment on lines +232 to +237
_, err = s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID,
Key: storepb.UserSettingKey_NEST,
Value: &storepb.UserSetting_Nest{
Nest: fmt.Sprintf("%d", nest.ID),
},
Copy link
Contributor

@RoccoSmit RoccoSmit Nov 13, 2024

Choose a reason for hiding this comment

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

Wondering if this value needs to be stored in the db or if adding it to the local storage on the FE would be sufficient for users to still get the nets they were previously looking at on for e.g. reload.

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure if it is kept upon user sign-out (on a per-user basis) ? For the time being I added the line const [nest] = useLocalStorage("nest", "none"); in CommonContextProvider.tsx but I'm not really sure how or if that works as expected.

So I also kept the database entry (and fixed the sql migration).

server/router/api/v1/nest_service.go Outdated Show resolved Hide resolved
server/router/api/v1/nest_service.go Outdated Show resolved Hide resolved
store/db/sqlite/nest.go Outdated Show resolved Hide resolved
@RoccoSmit
Copy link
Contributor

Some additional general notes from testing and code review.

  • Are you set on the name nests? Can we use something a bit more descriptive. I'm assuming you are referring to memos nested under a common group, but space, collections or categories would be more descriptive.
  • When user 1 views memos from user 2 on the explore page the other user's tags dont show on the right
  • Nests crud will need to be discussed further as its not currently possible to edit/delete a nest form the UI
  • The navigation will need to be modified so that its easier to see what part of the left nav is nest specific and what parts are global

@andresmanelli
Copy link
Author

@johnnyjoygh thanks for the feedback!

I looked into Supernotes Collections, and I see it shares the basic concept of organizing notes in categories (based on filters, which is quite nice).

One subtle difference, is that all the notes keep sharing tags for example, or calendar view (maybe all metadata, but I didn't spend a lot of time testing).

I think collections could be also used on top of nests (different filter sets for different contexts). Does that make sense?

@andresmanelli
Copy link
Author

andresmanelli commented Nov 14, 2024

* Are you set on the name `nests`? Can we use something a bit more descriptive. I'm assuming you are referring to memos nested under a common group, but space, collections or categories would be more descriptive.

@RoccoSmit Not at all, I actually chose nest as a pun, because of the bird on the home page :) Sadly I didn't find a nest icon to be more explicit. Anyway, I don't mind changing that.

* When user 1 views memos from user 2 on the explore page the other user's tags dont show on the right

I fixed that in my latest commits, moving the nest filter under the EXPLORE page check. Though, the tags don't seem to refresh when switching between home/explore if I don't reload. I didn't get why.

* Nests crud will need to be discussed further as its not currently possible to edit/delete a nest form the UI

Agree.

* The navigation will need to be modified so that its easier to see what part of the left nav is nest specific and what parts are global

Agree.

@RoccoSmit
Copy link
Contributor

@boojack , @johnnyjoygh , thoughts on:

  • The name Nests for this feature vs something like Spaces, Collections or Categories
  • The UX with the left navigation and indicating Nest level vs global navigation items
  • Nests management
    ?

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