Introduce state variable for state of popup