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 exploding icon for chat input. #12009

Merged
merged 15 commits into from
May 30, 2018

Conversation

adamjspooner
Copy link
Contributor

@keybase/react-hackers, this is ready for review.

this.state.explodingPopupOpen && (
<SetExplodingMessagePopup
attachTo={this.props.attachmentRef}
isNew={true}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@buoyad, how should this be determined?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not yet implemented, I haven't gotten to it yet in the integration

@adamjspooner
Copy link
Contributor Author

Actually, I need to get mobile into this PR. So, please hold off on reviewing. 🙏

@codecov
Copy link

codecov bot commented May 23, 2018

Codecov Report

Merging #12009 into master will decrease coverage by 0.05%.
The diff coverage is 94.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12009      +/-   ##
==========================================
- Coverage   87.32%   87.27%   -0.06%     
==========================================
  Files        1262     1198      -64     
  Lines       66274    66001     -273     
==========================================
- Hits        57872    57600     -272     
+ Misses       8402     8401       -1
Impacted Files Coverage Δ
...hared/chat/conversation/input-area/normal/types.js 100% <ø> (ø) ⬆️
...ared/chat/conversation/input-area/normal/shared.js 100% <100%> (ø)
...sation/input-area/normal/platform-input.desktop.js 98.92% <100%> (+0.11%) ⬆️
...sation/messages/set-explode-popup/index.stories.js 81.25% <100%> (+1.25%) ⬆️
...rsation/messages/set-explode-popup/index.native.js 100% <100%> (ø) ⬆️
...d/chat/conversation/input-area/normal/container.js 76.71% <75%> (+0.52%) ⬆️
shared/common-adapters/meta.js 95.34% <90%> (+1.06%) ⬆️
...at/conversation/input-area/normal/index.stories.js 83.49% <94.28%> (+5.11%) ⬆️
...rsation/input-area/normal/platform-input.native.js 96.15% <97.91%> (+0.42%) ⬆️
shared/actions/platform-specific.desktop.js 85.1% <0%> (ø) ⬆️
... and 87 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e74e60...a373583. Read the comment docs.

@adamjspooner
Copy link
Contributor Author

@keybase/react-hackers, this is ready for review.

@adamjspooner
Copy link
Contributor Author

Just noticed I've left something out of mobile: https://zpl.io/beg7PBY

Copy link
Contributor

@buoyad buoyad 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, a couple changes

super(props)
this.state = {
emojiPickerOpen: false,
explodingPopupOpen: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

This comes in through the FloatingMenuParentHOC too, as props.showingMenu and props.toggleShowingMenu()

@@ -279,6 +292,36 @@ class PlatformInput extends Component<PlatformInputProps, State> {
type="iconfont-boom"
/>
)}
{flags.explodingMessagesEnabled &&
this.state.explodingPopupOpen && (
<SetExplodingMessagePopup
Copy link
Contributor

Choose a reason for hiding this comment

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

This is close to needing to be factored into a connected component. But it can probably wait until the isNew flag integration

@@ -29,6 +35,14 @@ class PlatformInput extends Component<PlatformInputProps, State> {
this.props.inputSetRef(ref)
}

_explodingPickerToggle = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, this and state.explodingPickerOpen can go away to use the props from the HOC

<ExplodingIcon
explodingModeSeconds={explodingModeSeconds}
isExploding={isExploding}
openExplodingPicker={openExplodingPicker}
Copy link
Contributor

Choose a reason for hiding this comment

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

On native on device this isn't dismissing the keyboard, so there's no way to make a selection without backing out of the convo, going back in, and choosing before focusing the input.

Copy link
Contributor

Choose a reason for hiding this comment

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

Found a solution with a little fiddling, changing _explodingPickerToggle to focus or blur the input depending on whether the popup is open works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dismissing the keyboard feels pretty weird. Is there a way to attach the picker so that it stays adjacent to the keyboard instead of under it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've done this within the adapter. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, that seems ok.

let title = 'New'

if (explodingModeSeconds !== 0) {
const description = messageExplodeDescriptions.find(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this should look for a match in messageExplodeDescriptions. If it's set to something different than one of the choices, it doesn't show anything. Instead, this could do a couple checks on whether explodingModeSeconds is > a day, an hour, etc. and create a ballpark meta based on that. There are some similar functions in #12024 for displaying the countdown. Actually, formatTimeDifference could be a drop-in replacement for this, it just takes in milliseconds instead of seconds.

Copy link
Contributor Author

@adamjspooner adamjspooner May 24, 2018

Choose a reason for hiding this comment

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

That's a good idea. I commented on formatTimeDifference in your PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll wait for #12024 to merged so I can use that helper.

color?: string,
backgroundColor: string,
lowercase?: boolean,
Copy link
Contributor

Choose a reason for hiding this comment

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

might be better as noUppercase so callers can set mixed case stuff freely

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea!

@@ -238,6 +238,19 @@ const metaData: {[key: TextType]: MetaType} = {
fontSize: 11,
styleOverride: globalStyles.fontRegular,
},
// Body tiny
BodyTiny: {
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We needed a smaller text style to match the design. Is this not the way to do it?

Copy link
Contributor

Choose a reason for hiding this comment

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

In those cases I usually use the closest TextType and apply the necessary styles adhoc. I think these are meant to correspond with what's in the font styleguide

@adamjspooner
Copy link
Contributor Author

@keybase/react-hackers, this is ready for another review. I ran into a known bug with overflow on Android: facebook/react-native#17074, and I'm still working through it (as seen in the last commit). This is behind a feature flag. So, we should be okay to merge it.

Copy link
Contributor

@buoyad buoyad left a comment

Choose a reason for hiding this comment

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

lgtm pending native flag

@@ -166,6 +208,11 @@ const Action = ({hasText, onSubmit, isEditing, openFilePicker, insertMentionMark
</Box>
) : (
<Box2 direction="horizontal" gap="small" style={styles.actionIconsContainer}>
<ExplodingIcon
Copy link
Contributor

Choose a reason for hiding this comment

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

feature flag needed here too

@adamjspooner adamjspooner merged commit f60d259 into master May 30, 2018
@adamjspooner adamjspooner deleted the spooner/DESKTOP-6731-exploding-icon branch June 5, 2018 13:05
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