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

Fix autocrypt ui #262

Merged
merged 5 commits into from
Nov 2, 2018
Merged

Fix autocrypt ui #262

merged 5 commits into from
Nov 2, 2018

Conversation

Jikstra
Copy link
Contributor

@Jikstra Jikstra commented Nov 1, 2018

screenshot_20181102_004710
screenshot_20181102_004750

@Jikstra
Copy link
Contributor Author

Jikstra commented Nov 1, 2018

Fixes #195


return e + (addDash ? ' - ' : '') + (addLineBreak ? '\n' : '')
}).join('')
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we make this a normal function? No reason to be a class method since it doesn't use any class state (i.e. not using this).

Copy link
Contributor Author

@Jikstra Jikstra Nov 2, 2018

Choose a reason for hiding this comment

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

I don't care but i like to have it in a class just to have it grouped with where it belongs to. Also i think i already saw similiar stuff in the codebase. I don't really like to have a function in the same file floating around and you don't really know where it belongs to. If it's in a class and not a static function, you know you can only call it from inside (okay, prefix it with a _...). But its at least visually next to the stuff which uses it.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, do what you feel is best.

Copy link
Member

Choose a reason for hiding this comment

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

yeah

)

if (i !== 8) {
inputs.push(<div class='seperator' />)
Copy link
Member

Choose a reason for hiding this comment

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

separator

}

render () {
const tx = window.translate
console.log(this.state)
Copy link
Member

Choose a reason for hiding this comment

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

console.log

static/main.css Outdated
padding-bottom: 10px;
}

.InputTransferKey .seperator {
Copy link
Member

Choose a reason for hiding this comment

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

.separator

static/main.css Outdated
text-align: center;
}

.InputTransferKey .seperator::after {
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

}

handleChange (event) {
handleChangeKey (event) {
Copy link
Member

Choose a reason for hiding this comment

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

can remove this TODO now :)

static/main.css Outdated
}

.InputTransferKey .seperator {
text-align: center;
Copy link
Member

Choose a reason for hiding this comment

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

is this text-align: center needed? I wonder if we could create then a class .centered or use styled-components or something..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's only needed to have to "-" exactly in the middle of the 10px grid.

static/main.css Outdated
}

.InputTransferKey .seperator::after {
content: '-';
Copy link
Member

Choose a reason for hiding this comment

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

instead can we use - in the div? I find this content property is only really useful in cases where you don't have access to generating the dom directly, but in this case we do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup sounds good to me.

// TODO: insert - automatically in between every 4 characters
// TODO: lint the value for correct setup message format
this.setState({ key: event.target.value, message: false })
if (event.target.value < 0 || event.target.value > 9999) {
Copy link
Member

Choose a reason for hiding this comment

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

What happens when the user inputs a string like asdf?
If the value isn't a number, we should return false also. So here:

var value = Number(event.target.value)
if (isNaN(value) || value < 0 || value > 9999)  return false
let updatedkey = this.state.key
updatedkey[Number(event.target.id)] = value
this.setState({ key: updatedkey })

onChange={this.handleChange}
value={this.state.key}
/>
<div class='InputTransferKey'>
Copy link
Member

Choose a reason for hiding this comment

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

what if we use styled-components here instead?

Copy link
Member

Choose a reason for hiding this comment

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

Can we make a separate issue for styled-components and gather up points in the code where it's useful?

Copy link
Member

Choose a reason for hiding this comment

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

Sure. all of the wrappers that can be packaged as components

@ralphtheninja
Copy link
Member

@Jikstra rebase + meeeeerrrrrge! :)

@Jikstra
Copy link
Contributor Author

Jikstra commented Nov 2, 2018

Hmm github doesn't really notice that the conflicts are already solved... can't merge it :(

@Jikstra Jikstra merged commit fdf37f6 into deltachat:master Nov 2, 2018
okdistribute pushed a commit that referenced this pull request Nov 16, 2018
Rework autocrypt transfer key uis
* Add line breaks and spaces between dashes on autocrypt key
* Implement "splitted input with dash seperated" form for typing in
transfer key
@Jikstra Jikstra deleted the fix_autocrypt_ui branch November 23, 2018 13:52
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.

None yet

3 participants