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

[GH-190] Add global option to disable randomized card icons #310

Merged
merged 1 commit into from
Apr 26, 2021

Conversation

Johennes
Copy link
Contributor

@Johennes Johennes commented Apr 21, 2021

Summary

This does the minimum work for #190 by adding a global settings option to disable random icons on newly created cards.

Screenshot 2021-04-21 at 16 41 00

Ticket Link

Partially fixes #190

@mattermod
Copy link
Contributor

Hello @Johennes,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

const toggleRandomIcons = () => {
UserSettings.prefillRandomIcons = !UserSettings.prefillRandomIcons
setRandomIcons(!randomIcons)
}
Copy link
Contributor Author

@Johennes Johennes Apr 21, 2021

Choose a reason for hiding this comment

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

This is admittedly a little odd because the setting state is maintained in two separate spots (UserSettings and randomIcons) but I couldn't find a better way to make the component re-render when changing the setting. Would be happy to hear recommendations on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, probably we can move this into its own hook and make the concept of "userSettings" something that is properly encapsulated. But for now I think is ok as is now.

@Johennes Johennes force-pushed the feature/no-more-icons branch from 5a23226 to 5493e8a Compare April 21, 2021 14:44
@Johennes
Copy link
Contributor Author

 /home/runner/work/focalboard/focalboard/webapp/src/userSettings.ts
  4:6  error  'LocalStorageKeys' is already declared in the upper scope on line 4 column 6  no-shadow

Hm, I'm unsure what the error here is. 🤔

@Johennes Johennes force-pushed the feature/no-more-icons branch from 5493e8a to 7c07ef8 Compare April 22, 2021 17:43
@Johennes
Copy link
Contributor Author

Eliminated the enum in favor of string literals. I think the linting error was a false positive but I couldn't find out how to silence it and keep the enum.

@jespino
Copy link
Contributor

jespino commented Apr 22, 2021

I like this idea, but I don't know if this should be per user, or per board, and probably we should store that information on the server. What do you think @chenilim?

@chenilim
Copy link
Contributor

I think this is fine as a per-user setting for now. For Personal Desktop it makes no difference, and we haven't implemented any other configurable per-server (actually per-workspace) settings yet.

In the long run, I can imagine multiple layers, i.e.:

  • Server admins set the global defaults
  • Workspace admins set workspace defaults (maybe for a subset)
  • Users can override a subset for themselves

@signalwerk
Copy link
Contributor

@Johennes Thank you for your PR this is wonderful! I completely understand your wish and I have the same. But I think all our wishes are different. I'm not certain if this is the right way to cover all the wishes.

Wouldn't it be more helpful to redefine/edit the default-template for a new card per board?

Pro

  • Each board can have it's individual default-template
  • The default-template can not only control the Icon-Settings

Con

  • No implementation yet (your hard work would be lost)
  • If you want to change the behavior for all new boards you have to edit/modify a board-template

@Johennes Johennes marked this pull request as draft April 24, 2021 11:32
@Johennes
Copy link
Contributor Author

@signalwerk being able to change the default card template for a board would be great, agreed. For my personal use case that would be slightly less convenient than a single global "no random icons" setting. But I could live with that since I only have a small number of boards.

@chenilim / @jespino what do you think? Should we rather make the default template per board editable?

For the time being, I converted this PR to a draft because storing the global setting currently doesn't work in the native apps due to #314.

No implementation yet (your hard work would be lost)

Ah, no worries about that. What I did here so far was pretty basic so I wouldn't have hard feelings if it was discarded for something better. 🙂

@chenilim
Copy link
Contributor

Thanks for adding to the discussion. In the long run, I see several buckets of settings / preferences, e.g.:

  • Server global
  • Board
  • User

In general, for non-security related things, the precedence should be bottom up. i.e. a user can override board or server defaults. Auto-emoji is an example of this, because the user can always set a random emoji anyway. The setting just saves them time.

Also, at this point in the project, we should err on the side of speed. It's ok to add desired functionality that can be refined later.

So, I'm happy to merge this change, and keep issue #190 open to add the other levels of settings later.

@signalwerk
Copy link
Contributor

@Johennes @chenilim thank you two for your reactions and thoughts. 😌 let's merge it then and think later about next steps.

@Johennes Johennes marked this pull request as ready for review April 25, 2021 18:47
Copy link
Contributor

@jespino jespino left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks @Johennes! 🎉

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.

Feature Idea: Add option to turn off auto-random icon
5 participants