Best way to implement logged-in/logged-out state flows?

  • Question
  • Updated 3 years ago
I'm looking for a smart way to implement logged-in/logged-out state flows.

What I mean is this: Suppose I have a 'Comment' button in my prototype, which lets users comment on a certain item. Now, if the user is logged in he gets shown the textarea. When the user is not logged in, a login popup dialog shows up.

The comment button itself doesn't have to change its L&F, only the way it handles its click. I've been thinking about ways to work around this: create all the comment buttons for the logged in state, which will trigger to show the comment box. Then copy this group of buttons again, and make it hidden. For these copied hidden buttons, implement the onclick to show a login dialog. Then when the users changes from logged in logged out show/hide the correct button group.

Quite a bit of work and can get messy. Is there a smarter way to do this?
Photo of MauriceM

Maurice

  • 1 Post
  • 0 Likes

Posted 3 years ago

  • 1
Photo of Tim Klauck

Tim Klauck, CEO and Founder

  • 633 Posts
  • 52 Likes
There is currently no better way to achieve this.

You could create a widget with two states and two buttons in it. The first state shows the logged-in cell, the second the logged-out button.

Unfortunately, the actions cannot be store in the widget yet, but using copy and paste will keep them.

Hope this helps!