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

Add indicator for selected conversation in conversation list #86

Merged
merged 3 commits into from
Apr 29, 2024

Conversation

wzulfikar
Copy link
Contributor

@wzulfikar wzulfikar commented Apr 27, 2024

What
Add selectedConversation to ConversationHistoryListView to determine when to show the indicator.

Before (no indicator for selected conversation):

Screen.Recording.2024-04-28.at.1.01.08.AM.mov

After (selected conversation has blue indicator):

enchanted-convo-indicator.mov.mp4

Why
When selecting other conversation from the list, I noticed I had difficulty figuring out what's the currently selected conversation. This PR adds a little indicator to the selected conversation.

@@ -62,6 +63,12 @@ struct ConversationHistoryList: View {
ForEach(conversationGroup.conversations, id:\.self) { dailyConversation in
HStack {
Button(action: {onTap(dailyConversation)}) {
let isSelected = selectedConversation?.name == dailyConversation.name && selectedConversation?.createdAt == dailyConversation.createdAt
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Conversation doesn't have a unique ID so I'm using combination of name and createdAt. Not sure if having this conditional logic in view is acceptable here, but since it's quite simple (IMO) I think it's fine to put here.

@wzulfikar
Copy link
Contributor Author

wzulfikar commented Apr 27, 2024

Wanted to open an issue to ask about this but looks like it might be straightforward changes. So I went ahead and created this PR to illustrate my question. Happy to address any feedbacks (or close if you have other plan).

@AugustDev
Copy link
Owner

Hi @wzulfikar great idea!

I have adjusted style a bit to match the vision of the app.

ConversationSD type has id and since it conforms to Identifiable protocol comparison can be made as simple as selectedConversation == dailyConversation.

LGTM!

@AugustDev AugustDev merged commit ebed97c into AugustDev:main Apr 29, 2024
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