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

Settings Search #1312

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft

Settings Search #1312

wants to merge 19 commits into from

Conversation

luah5
Copy link
Member

@luah5 luah5 commented Jun 12, 2023

Description

This PR adds support for searching settings in CE's settings, it works very similar to the way System Settings searches.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code
  • Code is clean
  • Highlighted text of search
  • Fix grouping issue

Screenshots

shot.mov

@Angelk90
Copy link
Contributor

@luah5 :

Registrazione.schermo.2023-06-13.alle.12.55.26.mov
  1. It would be possible for everyone in the same place to group them.
  2. When clicked, on the text it should open the place where it is which happens, but you don't understand where that text is, it would be possible to make it flash or something similar to how android does when you search for something in the search bar settings.

@austincondiff
Copy link
Collaborator

austincondiff commented Jun 13, 2023

image

You'll notice that:

  1. The text is aligned with the parent item's label
  2. The child item itself is selectable
  3. There is only one parent item, in yours there is a parent for every child
  4. The search term is white while the rest of the text has an opacity (maybe .secondaryLabelColor)

@Angelk90
Copy link
Contributor

@luah5 : When selecting an element I don't think @austincondiff wants the whole group to be selected, at least macOS Ventura doesn't do that, it only selects the single element.

Registrazione.schermo.2023-06-13.alle.21.45.14.mov

For point 2) I think it is useful to understand where the property is, then you need to hear what others think ask @austincondiff.

@austincondiff
Copy link
Collaborator

@Angelk90 I'd agree with out that it should probably flash or jump out at you in some way. System settings doesn't do this though so we might save this for another PR. Regardless, my guess is It is selecting all the related items because they all point to the same location, so they are all selected. We need to think of a workaround to this so only the item that is clicked is selected.

@Angelk90
Copy link
Contributor

@luah5 : The thing that the whole group remains selected does not convince me.

Registrazione.schermo.2023-06-15.alle.11.19.52.mov

@luah5 luah5 requested a review from taylorbyks June 17, 2023 15:01
@luah5 luah5 marked this pull request as ready for review June 18, 2023 14:11
Copy link
Member

@Wouter01 Wouter01 left a comment

Choose a reason for hiding this comment

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

Nice work! I noticed some issues:

  • Tab selection state isn't kept
  • I should be able to go through the search results by pressing the up and down arrow keys
  • It is difficult to search for settings because the search keywords don't match the "real" labels of the settings

This is a good base, but I think it needs improvements. I strongly suggest using settings labels instead of variable names as keywords. This is what will need to happen anyway.
Not doing that now is a bit pointless, as the work from this PR would be removed later on. I would also like to avoid complaints from users about search not being accurate / predictable

Comment on lines +67 to +104
private func populatePages() -> [SettingsPage] {
var pages: [SettingsPage] = []
let settingsData: SettingsData = SettingsData()

pages = createPageAndSettings(
settingsData.general,
parent: SettingsPage(.general, baseColor: .gray, icon: .system("gear")),
prePages: pages
)
pages = createPageAndSettings(
settingsData.accounts,
parent: SettingsPage(.accounts, baseColor: .blue, icon: .system("at")),
prePages: pages
)
pages = createPageAndSettings(
settingsData.theme,
parent: SettingsPage(.theme, baseColor: .pink, icon: .system("paintbrush.fill")),
prePages: pages
)
pages = createPageAndSettings(
settingsData.textEditing,
parent: SettingsPage(.textEditing, baseColor: .blue, icon: .system("pencil.line")),
prePages: pages
)
pages = createPageAndSettings(
settingsData.terminal,
parent: SettingsPage(.terminal, baseColor: .blue, icon: .system("terminal.fill")),
prePages: pages
)
pages = createPageAndSettings(
settingsData.sourceControl,
parent: SettingsPage(.sourceControl, baseColor: .blue, icon: .symbol("vault")),
prePages: pages
)
pages.append(SettingsPage(.location, baseColor: .green, icon: .system("externaldrive.fill")))

return pages
}
Copy link
Member

Choose a reason for hiding this comment

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

This is a very confusing pattern to build your pages. Consider letting the createPageAndSettings function return an array and combine all arrays afterwards

Copy link
Member Author

Choose a reason for hiding this comment

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

How would that look like in code?

@austincondiff
Copy link
Collaborator

@luah5 When there is no search text input, the menu item color needs to be primary. It looks like it is defaulting to secondary. It should only be secondary when there is text input into the search field.

@Angelk90
Copy link
Contributor

@austincondiff , @luah5 : When the possibility of having CE in multiple languages will be enabled later and there will be all the translations, how will this system work at the moment?

@luah5
Copy link
Member Author

luah5 commented Jun 19, 2023

So, I'm putting this PR back into Draft because as highlighted by @Wouter01's review comments something has to happen with naming. I'll post more in the discord, regarding what progress I'm making.

@0xWDG 0xWDG marked this pull request as draft June 19, 2023 19:04
@luah5
Copy link
Member Author

luah5 commented Jun 24, 2023

Nice work! I noticed some issues:

  • Tab selection state isn't kept

Could you show a video, does the tab selection need to be kept across sessions with UserDefaults?

  • I should be able to go through the search results by pressing the up and down arrow keys

Re implementing that feature makes the search results group again

  • It is difficult to search for settings because the search keywords don't match the "real" labels of the settings

Fixed.

This is a good base, but I think it needs improvements. I strongly suggest using settings labels instead of variable names as keywords. This is what will need to happen anyway. Not doing that now is a bit pointless, as the work from this PR would be removed later on. I would also like to avoid complaints from users about search not being accurate / predictable

Fixed.

@luah5 luah5 requested a review from Wouter01 June 24, 2023 15:46
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.

🐞 Search system in settings still not working
5 participants