itchy-ionic icon indicating copy to clipboard operation
itchy-ionic copied to clipboard

Navigation flow with modals

Open micahlt opened this issue 4 years ago • 18 comments

Since we're using <ion-modal> components to implement projects, profiles, and studios, there are a few issues with navigation. When clicking a project link from another project, the back button goes back to the explore tab. We need to fix that by making it move back to the previous project.

micahlt avatar Jan 24 '21 16:01 micahlt

couldn't we create a new ion-modal for each clicked link?

moeenio avatar Jan 24 '21 16:01 moeenio

@locness3 I've considered that - however, modals are quite literally overlaid on top of the current view. As someone follows more and more links, the DOM will become massive and cause lag in the application.

micahlt avatar Jan 24 '21 18:01 micahlt

Except if you remove the DOM of non-visible modals - or just use something else than modals for what's the main content of the app.

moeenio avatar Jan 25 '21 17:01 moeenio

@locness3 That's possible, but it would be very difficult due to the structured nature of Ionic Vue - maybe you'd like to take a stab at it?

micahlt avatar Jan 25 '21 18:01 micahlt

When I get some time

moeenio avatar Jan 26 '21 10:01 moeenio

At the time, I wasn't aware about all routing stuff. I think, we should create a seperate page/endpoint/route/whatever you name it ProjectPage.vue, and just navigate to it with a query parameter for the project ID. AFAIK, ionic ensures we get a smooth navigation without a full refresh.

moeenio avatar Feb 11 '21 06:02 moeenio

I can work on that. Of course, this isn't top priority right now. The only reason I didn't consider doing this in the first place was that I'm not sure that Ionic will handle transitions if the project page is not a tab (since we're using a tab-based layout).

micahlt avatar Feb 11 '21 15:02 micahlt

Needs some testing, but I'd think it makes a smooth navigation no matter what.

moeenio avatar Feb 11 '21 16:02 moeenio

... it doesn't, even when using an ion-router-link

moeenio avatar Feb 11 '21 16:02 moeenio

Or maybe it would with ion-nav-link? I don't understand how to set that up.

moeenio avatar Feb 11 '21 16:02 moeenio

Okay, it looks like we have to use <router-link> from vue-router. To import it (hopefully saves you from guessing or googling) :

import { RouterLink } from "vue-router";
export default {
  ...
  components: {
    RouterLink
  }
}

moeenio avatar Mar 03 '21 17:03 moeenio

@locness3 So we essentially need to use a <router-link> whenever opening a project?

micahlt avatar Apr 02 '21 15:04 micahlt

Yes, with the project page being its own route.

moeenio avatar Apr 03 '21 06:04 moeenio

@locness3 Ah, so just get rid of the modals. All righty, sounds good. I'll test it out.

micahlt avatar Apr 03 '21 16:04 micahlt

I fixed the problems with modal navigation in 17711bbe84345f3e721b537bdc048a55668bdf76. Closing now.

micahlt avatar Feb 01 '22 02:02 micahlt

Should be using the router, but whatever

moeenio avatar Feb 01 '22 19:02 moeenio

In the future if it becomes a problem I'll change it. For now it works fine.

micahlt avatar Feb 01 '22 20:02 micahlt

Re-opening because using proper routes instead of modals would improve the structure of the code.

moeenio avatar Aug 20 '22 20:08 moeenio