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

cardback reset button #1985

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open

Conversation

Jaro32768
Copy link

Changes

Gives users option to reset their own cardback via button in settings. Reset confirmation modal is also included to prevent accidental cardback resets.

Screenshots

Settings view
Settings view while trying to upload cardback
Reset confirmation modal


Tested Locally

  • This PR makes a trivial change

Tests

  • This PR does not require tests

Changelog

  • Changelog Section below has been updated with Changelog entry

Changelog Entry (delete this section if this PR does not need a changelog entry)

  • New Feature
  • Minor Change

Changelog Headline: Adds cardback reset button to the settings

Changelog Details: There is a new cardback reset button in the settings. When clicked, modal gets shown and you can either choose to reset your cardback or to cancel.

}).then(result => {
if (result.value === true) {
const defaultCardback =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABfCAYAAABV97HXAAAAAXNSR0IArs4c6QAADB1JREFUeF7tnFlsnFcVx/93/bZZPZ6xx+M4ibPWaRInTZukIV0kBLRPKK2SFFBo1YJokXhCvPDAE4IHHnhmqUCAoBvdhUSqqiqktIhWSUsDDY7rLk5bLzMez3jWb0H3m0kdN3Fn7NiOx/aVopEzd77vu7/vnHPPPefcS1KplIe1dhkBsgbmylKxBmYWbVkDswZmboZ0TWLWJGZNYuZGYE1i5sZrzcasScyaxMyNwFJJDNXCAGUg6oaEgBAKEAZCOAAGQC3NXBBQEHD/L/W3B7v26Tr1T/V/tW89uww4VXieA6h/S9Cu0sYQECpAhOEDIJRDJvaAcAuUEFDKQLkEZToIC4AQHYADz6uCEg6KoA/KRRWulwe8ClynAM+14VQrcD3VF/CmRuCWs3DsHNxqvg7Iq33aJb//Qrd5gCEgTIAwzQfBjQ7w6GYwLsC1CPTYTaDMAqmDUX0Ik6BUwZM+Bng2CBgoMetgbHheyQfmuWV/oK5jw/VUXw9eaQJOZRy2PQa7nI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FbgqM8jnUJnRhJSHbd4JRE9KIQQ/3gyiZEEb9KINWjL9cGdGsYJRd8DdXSBMi1FuL5Jkd0EJbwWgQjOsrOsVyGZiLQLgRg4xs8eO+WnAjpNXrbx32p+EVFMqcTaVmgFFhTG7EIaPbIEM90EPbIc1uMAVD2Y4WicA1sh/NfO+D8aVEmtA69/kbtIxoP6SRBOcqftI6RxI0M+Bm+5B1vX2eqo2RsT5Y3Yehmz2QIrkso2rNDmoh+pFNN3/dU7vVrI5boFvdYCzcsr7HQgC5eA2y88jPPdO6Doa5acZ2v4W8SSteixz85klPM1TMdXVux5l1Vrr9wSGvldYwSyV95PYH32vuuNKleqJlcp//A00UAhSS3ax0AAAAAElFTkSuQmCC';
Copy link
Contributor

Choose a reason for hiding this comment

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

You should never hardcode a base64 string like this. You should make a new server-side socket event called resetCardback (with proper authorisation) that effectively does the same as the mod tools event.

If the default cardback is ever changed, this will break. This also doesn't reset the cardback, it sets it to a specific image.

Copy link
Author

Choose a reason for hiding this comment

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

I see, I will be busy for few more months, but during summer I should be able to find some time to change it.

.then(data => {
this.setState({
cardbackUploadStatus: data.message,
isUploaded: data.message === 'Cardback did reset successfully.' ? defaultCardback : '',
Copy link
Contributor

Choose a reason for hiding this comment

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

Cardback was reset successfully

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