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 Modals #660

Merged
merged 24 commits into from
Sep 16, 2019
Merged

Fix Modals #660

merged 24 commits into from
Sep 16, 2019

Conversation

pieer
Copy link
Collaborator

@pieer pieer commented Sep 9, 2019

No description provided.

Copy link
Contributor

@sandrina-p sandrina-p left a comment

Choose a reason for hiding this comment

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

Check my comments

@@ -5,74 +5,95 @@
</template>
<script>
import sbp from '~/shared/sbp.js'
import { OPEN_MODAL, LOAD_MODAL, UNLOAD_MODAL, REPLACE_MODAL, CLOSE_MODAL } from '@utils/events.js'
import { OPEN_MODAL, REPLACE_MODAL, UNLOAD_MODAL, CLOSE_MODAL } from '@utils/events.js'
let keyboardEvent = Event
Copy link
Contributor

Choose a reason for hiding this comment

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

couldn't we place this inside the component as a method? Then we would just need to do this:

  created () {
    window.addEventListener('keyup', this.handleKeyUp)
  },
  beforeDestroy() {
    window.removeEventListener('keyup', this.handleKeyUp)
  },
  methods: {
    handleKeyUp (e) {
      // Only if there an active modal
      if (this.content && e.key === 'Escape') {
        this.unloadModal()
      }
    }
  }

if (this.content) {
this.$router.push({ query: { modal: this.content, subcontent: this.activeSubcontent() } })
} else {
this.$router.push({})
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we shouldn't use push({}), because this removes all the queries from an URL. For example:

http://localhost:8000/app/?id=special&modal=SignUp

when the modal is closed, the other queries are also removed

http://localhost:8000/app/

And maybe we might want to keep the other queries... I can't point any existing example at the moment but in other projects it's a common constraint I had to handle, so I just wanted to remind you of that.

frontend/views/components/Modal/ModalMixins.js Outdated Show resolved Hide resolved
frontend/views/components/Modal/ModalTemplate.vue Outdated Show resolved Hide resolved
frontend/views/pages/DesignSystem.vue Show resolved Hide resolved
Copy link
Collaborator

@mmbotelho mmbotelho left a comment

Choose a reason for hiding this comment

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

Hello @pieer ! This is almost perfect!

Captura de ecrã 2019-09-13, às 21 07 44

Captura de ecrã 2019-09-13, às 21 18 31

The mockup for this ☝️specific view is https://www.figma.com/file/mxGadAHfkWH6qApebQvcdN/Group-Income-2.0?node-id=543%3A4225

Captura de ecrã 2019-09-13, às 21 26 36

https://www.figma.com/file/mxGadAHfkWH6qApebQvcdN/Group-Income-2.0?node-id=48%3A86

Captura de ecrã 2019-09-13, às 21 31 03

Others:

  • Closing / canceling the change password closes the user settings modal as well - it should only close the first one.

Let me know if you have any questions!

content: null,
subcontent: []
content: null, // This is the main modal
subcontent: [] // This is for collection of modal on top of modals
Copy link
Member

Choose a reason for hiding this comment

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

It seems like there might be opportunity here for simplification too?

Is it possible to only have an array of content? I.e. make it be content: [] instead of content: null, and remove the subcontent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure how it would simplify, do you want to change the url structure?

@mmbotelho
Copy link
Collaborator

@pieer everything is looking perfect! Great work 😎

@pieer pieer merged commit 01431de into okTurtles:master Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants