Skip to content

Commit 9e2328b

Browse files
devvaannshabose
authored andcommitted
feat: switch between sign in and profile popup when sign-in or log-out buttons are clicked
1 parent 51cad6b commit 9e2328b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/extensionsIntegrated/Phoenix/profile-menu.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ define(function (require, exports, module) {
1313
let isPopupVisible = false;
1414

1515
// if user is logged in we show the profile menu, otherwise we show the login menu
16-
const isLoggedIn = false;
16+
let isLoggedIn = false;
1717

1818
const defaultLoginData = {
1919
welcomeTitle: "Welcome to Phoenix Code",
@@ -37,10 +37,16 @@ define(function (require, exports, module) {
3737

3838
function _handleSignInBtnClick() {
3939
console.log("User clicked sign in button");
40+
closePopup(); // need to close the current popup to show the new one
41+
isLoggedIn = true;
42+
showProfilePopup();
4043
}
4144

4245
function _handleSignOutBtnClick() {
4346
console.log("User clicked sign out");
47+
closePopup();
48+
isLoggedIn = false;
49+
showLoginPopup();
4450
}
4551

4652
function _handleContactSupportBtnClick() {
@@ -129,7 +135,6 @@ define(function (require, exports, module) {
129135
// event handlers for buttons
130136
$popup.find("#phoenix-signin-btn").on("click", function () {
131137
_handleSignInBtnClick();
132-
closePopup();
133138
});
134139

135140
$popup.find("#phoenix-support-btn").on("click", function () {
@@ -187,7 +192,6 @@ define(function (require, exports, module) {
187192

188193
$popup.find("#phoenix-signout-btn").on("click", function () {
189194
_handleSignOutBtnClick();
190-
closePopup();
191195
});
192196

193197
// handle window resize to reposition popup

0 commit comments

Comments
 (0)