Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Configurable sort order for notebook #1142

Merged
merged 6 commits into from
Apr 9, 2024
Merged

Conversation

bfollington
Copy link
Collaborator

@bfollington bfollington commented Apr 3, 2024

Sort / filter the notebook view. I added a few new options that occurred to me as easy and useful.

Screen.Recording.2024-04-04.at.10.59.24.AM.mov

ForEach(entries.indices, id: \.self) { idx in
let entry = entries[idx]

ForEach(entries, id: \.self) { entry in
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We didn't need the index anymore, apparently

Copy link
Collaborator

Choose a reason for hiding this comment

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

Entries should be Identifiable, so we shouldn't need the second argument at all. That would be preferable, since \.self will consider value equality, and we would prefer to compare ID equality.

@@ -134,6 +132,7 @@ struct EntryListView: View {
)
}
}
.id(entry.address)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This fixes the animations

Copy link
Collaborator

@gordonbrander gordonbrander left a comment

Choose a reason for hiding this comment

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

LGTM. One comment.

@@ -22,6 +22,7 @@ struct CountChip: View, Equatable {

var body: some View {
Text(Self.asText(count: count))
.contentTransition(.numericText())
Copy link
Collaborator

Choose a reason for hiding this comment

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

TIL

ForEach(entries.indices, id: \.self) { idx in
let entry = entries[idx]

ForEach(entries, id: \.self) { entry in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Entries should be Identifiable, so we shouldn't need the second argument at all. That would be preferable, since \.self will consider value equality, and we would prefer to compare ID equality.

@bfollington bfollington merged commit 441f63c into main Apr 9, 2024
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants