Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Conversation

@science-girl
Copy link
Contributor

@science-girl science-girl commented May 16, 2018

Added pop up modal box when user first starts clutter.
Added profile page where users can edit their first name.
1 first time user pop-up 2x

@science-girl
Copy link
Contributor Author

Did Travis fail because it's using old flags ie. no-nat-pnp?

@Connoropolous
Copy link
Collaborator

@science-girl quite possibly. I will get reviewing this now

Copy link
Collaborator

@Connoropolous Connoropolous left a comment

Choose a reason for hiding this comment

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

Overall sweetness. The pattern used with this.props.children on the modal is especially good because it sets up something that's easily extendable.

A couple of overall suggestions:

  • Best practice would be to make sure that the UI handles more errors as well, and displays error messages.
  • When submitting pull requests, its useful to separate stylistic pull requests, (all the linting you did, which is great!) from functionality pull requests, so that code reviewers can focus on function, and the real changed files.
  • In the case of the 'profile photo' addition, it's also good to submit code in pull requests as more complete features. Introducing partial code for features gets unwieldy fast. Easy to lose track of what's actually working from what's not yet working.

if (name == "App_DNA_Hash") {return App.DNA.Hash;}
return "Error: No App Property with name: " + name;
} catch (exception) {
debug(exception);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Best practice would be to return an error if an error occurs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

} catch (exception) {
debug(exception);
}
return data;
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the function comments, it says it will return the hash, but it returns the raw input instead. Best to reconcile them, one way or another.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

* @param none
* @return firstName associated with this user
**/
function getFirstName(then) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused param in the input here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

e.preventDefault();

if (!newNameText) return;
setFirstName(newNameText);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Once the action/request completes, the user expects some feedback.
This could be done with some kind of transient user feedback message like 'Name was saved' that comes into the page, then out. Could also be done with a redirect away from the profile page.

I will review how to go about treating an action as a Promise so that you can perform some code once the action completes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done - goes back to meow container. also added first name set to handle as a default.

}
componentDidMount() {
const { firstName } = this.props;
this.setState({ newNameText: firstName });
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice pattern to use

<div className="panel panel-default">
<div className="panel-body">
<div style={{ paddingLeft: 30, paddingBottom: 10 }}>
<p
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another way to toggle visibility of elements based on boolean, as an option

{this.state.newHandleText.length === 0 && this.props.handleTaken === false && <p>...</p>}

Copy link
Contributor Author

@science-girl science-girl May 17, 2018

Choose a reason for hiding this comment

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

Leaving it as is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

export const GET_AGENT = "getAgent";
export const NEW_HANDLE = "newHandle";
export const UNFOLLOW = "unfollow";
export const TOGGLE_MODAL = "toggleModal";
Copy link
Collaborator

Choose a reason for hiding this comment

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

TOGGLE_MODAL could be separated out from the "Holochain actions", since it's a UI only action, and has no backend implications. Just by putting it above the "Holochain actions" comment above, and giving it a "UI actions" comment 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.

done

render() {
// Render nothing if the "show" prop is false
if (!this.props.show) {
console.log(this.props);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good to remove debugging console.log statements

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

appProperties: {},
// posts with 'stamp' as their key
posts: {},
isOpen: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

using a slightly more descriptive var name is a bit better. What isOpen? modalIsOpen

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Connoropolous
Copy link
Collaborator

Got the command line flags passing...
Now we need to fix the tests that run in the ui-automation folder

@Connoropolous
Copy link
Collaborator

@science-girl have you used docker? If so, I can clarify how to use docker to run the ui-automation tests. Or even if you haven't used it, but are interested I can show you. It is pretty neat (and useful) to see the Cypress tests that Philip wrote running (because you can actually visually see it testing the app).

@science-girl
Copy link
Contributor Author

I have not used docker and am interested!

dna/dna.json Outdated
},
"BasedOn": {
"H": null
},
Copy link
Collaborator

@lucksus lucksus May 18, 2018

Choose a reason for hiding this comment

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

With the latest head in https://github.com/holochain/holochain-proto develop branch, this
"BasedOn": { "H": null }
makes it fail.

Copy link
Contributor Author

@science-girl science-girl May 18, 2018

Choose a reason for hiding this comment

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

Would you be able to provide more background on this? I don't know what purpose "BasedOn" serves, which I think would help with fixing it.

Copy link
Collaborator

@lucksus lucksus 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 in general! :)

I've tried setting the name in your new EditProfile component. The name gets stored in the front-ends state but does not seem to be written to holochain - at least it is gone when I reload the page.

componentWillUnmount () {
if (this.interval) clearInterval(this.interval)
componentWillUnmount() {
if (this.interval) clearInterval(this.interval);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if you set a styleguide that requires semicolons, but JS does not (any more).
(And I personally would prefer not having them but ok :D)

Copy link
Contributor Author

@science-girl science-girl May 18, 2018

Choose a reason for hiding this comment

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

I prefer semi-colons, but I can omit them for consistency. Is there a style guide I should follow?

Copy link
Contributor Author

@science-girl science-girl May 18, 2018

Choose a reason for hiding this comment

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

I think you're right about the refresh - it's set, but I need to call getFirstName to ensure I retrieve the firstName from the chain rather than just from the redux store. I'll look into that.

@zippy
Copy link
Member

zippy commented May 18, 2018 via email

@science-girl
Copy link
Contributor Author

Awesome! Thanks.

@Connoropolous
Copy link
Collaborator

@science-girl maybe leave the 'profile photo' field in the code, but comment it out so its not in the UI yet while its an incomplete feature?

@Connoropolous
Copy link
Collaborator

@philipbeadle is much stronger with docker than me

but to run the cypress tests in a docker way

  # build the ui-src files into the ui folder, docker instances run off this built UI folder.
  cd ui-src
  npm install
  npm run build
  cd ..
  # spin up the three separate docker instances
  TARGETDIR=$(pwd) docker-compose up
  # run the delightful UI tests with cypress that rely on the docker instances
  cd ui-automation
  npm install
  npm run cypress:docker

@Connoropolous
Copy link
Collaborator

Connoropolous commented May 18, 2018

@science-girl first name thing wasn't working because you were using the setState pattern in componentDidMount but getFirstName was an asynchronous action. I switched to

componentDidUpdate(prevProps) {
    const { firstName } = this.props
    if (!prevProps.firstName && firstName) {
      this.setState({ newNameText: firstName })
    }
  }

It's necessary to use the conditional like this, otherwise you end up in infinitely recurring loops caused by updating the component, and then updating the component when the component updates. Gotta be real careful with these ones.

@Connoropolous
Copy link
Collaborator

@science-girl and the pre-requisite that I forgot to mention for using docker is of course installing it :p that's pretty straightforward
https://www.docker.com/community-edition#/download

@science-girl
Copy link
Contributor Author

science-girl commented May 18, 2018

Thanks @Connoropolous! I rarely use componentDidUpdate - is this preferred to async/awaiting?

@Connoropolous
Copy link
Collaborator

Not better or worse, just different. I think I may still have a small issue with my async (then) pattern with hc-redux-middleware so that's why I went this way.

@science-girl
Copy link
Contributor Author

@Connoropolous I ran the docker tests. 2 tests fail - there's a test for changing the handle, which no longer applies. I'll connect with @philipbeadle about fixing this.

@lucksus
Copy link
Collaborator

lucksus commented May 22, 2018

Ok, now the name gets persisted across reloads :)

But, I saw something else: on first use (first time loading the UI) I saw form widgets for adding a user image. After reload those elements were gone.

Copy link
Collaborator

@lucksus lucksus left a comment

Choose a reason for hiding this comment

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

Merge at will :)

@science-girl science-girl merged commit fcc5d54 into develop May 22, 2018
@science-girl science-girl deleted the bug-setHandleModalBox branch May 24, 2018 00:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants