Skip to content

Commit

Permalink
Merge branch 'dev' into cw-2101-mobile-chat-messages-missing
Browse files Browse the repository at this point in the history
  • Loading branch information
roienatan committed Oct 17, 2023
2 parents f514693 + fd80c64 commit 77fa35d
Show file tree
Hide file tree
Showing 149 changed files with 1,994 additions and 584 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"react-split-pane": "^0.1.92",
"react-use": "^17.4.0",
"react-virtualized": "^9.22.3",
"react-zoom-pan-pinch": "^3.2.0",
"redux": "^4.0.4",
"redux-saga": "^1.1.3",
"reselect": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/constants.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ $c-pink-active-feed-cards-light: #fcf4ff;
$c-pink-active-feed-cards: #a75a93;
$c-pink-hover-feed-cards: #fff9fd;
$c-gray-5: #f4f5f5;
$c-gray-10: #eef0f4;
$c-gray-20: #dcdee7;
$c-gray-30: #b7bcd2;
$c-gray-40: #8d91a9;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { webviewLogin } from "@/pages/Auth/store/actions";
import { history } from "@/shared/appConfig";
import { WebviewActions } from "@/shared/constants";
import { FirebaseCredentials } from "@/shared/interfaces/FirebaseCredentials";
import { getInboxPagePath_v04 } from "@/shared/utils";
import { getInboxPagePath } from "@/shared/utils";
import { parseJson } from "@/shared/utils/json";

const WebViewLoginHandler: FC = () => {
Expand All @@ -25,7 +25,7 @@ const WebViewLoginHandler: FC = () => {
window.ReactNativeWebView.postMessage(
WebviewActions.loginSuccess,
);
history.push(getInboxPagePath_v04());
history.push(getInboxPagePath());
} else {
window.ReactNativeWebView.postMessage(WebviewActions.loginError);
}
Expand Down
6 changes: 6 additions & 0 deletions src/pages/App/router/configuration/commonSidenavLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CommonEditingPage_v04 } from "@/pages/commonEditing";
import { CommonFeedPage_v04 } from "@/pages/commonFeed";
import { InboxPage_v04 } from "@/pages/inbox";
import { ProfilePage_v04 } from "@/pages/profile";
import { SettingsPage_v04 } from "@/pages/settings";
import { ROUTE_PATHS } from "@/shared/constants";
import { CommonSidenavLayout } from "@/shared/layouts";
import { LayoutConfiguration, RouteType } from "../types";
Expand Down Expand Up @@ -66,5 +67,10 @@ export const COMMON_SIDENAV_LAYOUT_CONFIGURATION: LayoutConfiguration<CommonSide
exact: true,
component: BillingPage_v04,
},
{
path: ROUTE_PATHS.V04_SETTINGS,
exact: true,
component: SettingsPage_v04,
},
],
};
11 changes: 11 additions & 0 deletions src/pages/App/router/configuration/multipleSpacesLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CommonEditingPage } from "@/pages/commonEditing";
import { CommonFeedPage } from "@/pages/commonFeed";
import { InboxPage } from "@/pages/inbox";
import { ProfilePage } from "@/pages/profile";
import { SettingsPage } from "@/pages/settings";
import { ROUTE_PATHS } from "@/shared/constants";
import { MultipleSpacesLayout } from "@/shared/layouts";
import { LayoutConfiguration, RouteType } from "../types";
Expand Down Expand Up @@ -85,5 +86,15 @@ export const MULTIPLE_SPACES_LAYOUT_CONFIGURATION: LayoutConfiguration<MultipleS
withGoBack: true,
},
},
{
path: ROUTE_PATHS.SETTINGS,
exact: true,
component: SettingsPage,
routeOptions: {
withSidenav: false,
withBreadcrumbs: false,
withGoBack: true,
},
},
],
};
6 changes: 5 additions & 1 deletion src/pages/Auth/store/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export const updateUserDetails = createAsyncAction(
AuthActionTypes.UPDATE_USER_DATA,
AuthActionTypes.UPDATE_USER_DATA_SUCCESS,
AuthActionTypes.UPDATE_USER_DATA_FAILURE,
)<{ user: User; callback: (error: Error | null) => void }, User, Error>();
)<
{ user: User; callback: (error: Error | null, user?: User) => void },
User,
Error
>();

export const setLoginModalState = createStandardAction(
AuthActionTypes.SET_LOGIN_MODAL_STATE,
Expand Down
65 changes: 30 additions & 35 deletions src/pages/Auth/store/saga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import {
seenNotification,
subscribeToNotification,
} from "@/pages/OldCommon/store/api";
import { UserService } from "@/services";
import { store } from "@/shared/appConfig";
import { Awaited } from "@/shared/interfaces";
import { FirebaseCredentials } from "@/shared/interfaces/FirebaseCredentials";
import { EventTypeState, NotificationItem } from "@/shared/models/Notification";
import { isFundsAllocationProposal } from "@/shared/models/governance/proposals";
import { showNotification } from "@/shared/store/actions";
import { getProvider } from "@/shared/utils/authProvider";
import { getFundingRequestNotification } from "@/shared/utils/notifications";
import {
cacheActions,
commonLayoutActions,
multipleSpacesLayoutActions,
} from "@/store/states";
Expand Down Expand Up @@ -264,7 +267,7 @@ const confirmVerificationCode = async (
return verifyLoggedInUser(user, true, authCode);
};

const updateUserData = async (user: User) => {
const updateUserData = async (user: User): Promise<User> => {
const currentUser = await firebase.auth().currentUser;
const profileData: {
displayName?: string | null;
Expand All @@ -283,40 +286,19 @@ const updateUserData = async (user: User) => {
}

await currentUser?.updateProfile(profileData);

const updatedCurrentUser = await firebase.auth().currentUser;

if (updatedCurrentUser) {
await firebase
.firestore()
.collection(Collection.Users)
.doc(updatedCurrentUser?.uid)
.update({
firstName: user.firstName,
lastName: user.lastName,
email: user.email,
photoURL: updatedCurrentUser.photoURL || user.photo || "",
intro: user.intro,
displayName: `${user.firstName} ${user.lastName}`,
country: user.country,
phoneNumber: user.phoneNumber || "",
})
.then(async () => {
const updatedCurrentUser = await firebase.auth().currentUser;

if (updatedCurrentUser) {
const databaseUser = await getUserData(updatedCurrentUser?.uid ?? "");
if (databaseUser) {
store.dispatch(actions.socialLogin.success(databaseUser));
}
}

return updatedCurrentUser;
})
.catch((err) => console.error(err));
}

return getUserData(updatedCurrentUser?.uid ?? "");
return await UserService.updateUser({
...user,
firstName: user.firstName,
lastName: user.lastName,
email: user.email,
photoURL: updatedCurrentUser?.photoURL || user.photo || "",
intro: user.intro,
displayName: `${user.firstName} ${user.lastName}`,
country: user.country,
phoneNumber: user.phoneNumber || "",
});
};

function* socialLoginSaga({
Expand Down Expand Up @@ -494,11 +476,24 @@ function* updateUserDetails({
}: ReturnType<typeof actions.updateUserDetails.request>) {
try {
yield put(actions.startAuthLoading());
const user: User = yield call(updateUserData, payload.user);
const user = (yield call(updateUserData, payload.user)) as Awaited<
ReturnType<typeof updateUserData>
>;

yield put(actions.updateUserDetails.success(user));
yield put(actions.socialLogin.success(user));
yield put(
cacheActions.updateUserStateById({
userId: user.uid,
state: {
loading: false,
fetched: true,
data: user,
},
}),
);
tokenHandler.setUser(user);
yield payload.callback(null);
yield payload.callback(null, user);
} catch (error) {
if (isError(error)) {
yield put(actions.updateUserDetails.failure(error));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ANONYMOUS_USER_FIRST_NAME,
ANONYMOUS_USER_LAST_NAME,
} from "@/shared/constants";
import { useImageSizeCheck } from "@/shared/hooks";
import { countryList } from "../../../../../shared/assets/countries";
import {
Button,
Expand Down Expand Up @@ -112,6 +113,7 @@ const UserDetails: ForwardRefRenderFunction<
onSubmitting,
} = props;
const formRef = useRef<FormikProps<FormValues>>(null);
const { checkImageSize } = useImageSizeCheck();
const [loading, setLoading] = useState(false);
const [uploadedPhoto, setUploadedPhoto] = useState("");
const inputFile: any = useRef(null);
Expand Down Expand Up @@ -143,6 +145,10 @@ const UserDetails: ForwardRefRenderFunction<
return;
}

if (!checkImageSize(file.name, file.size)) {
return;
}

setLoading(true);

if (onLoading) {
Expand Down
50 changes: 50 additions & 0 deletions src/pages/MyAccount/components/Profile/Profile.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@import "../../../../constants";
@import "../../../../styles/sizes";

.container {
position: relative;
width: 100%;
}

.header {
margin-bottom: 2.25rem;

@include tablet {
margin-bottom: 0;
}
}

.editButton {
position: absolute;
top: 1.5rem;
right: 0;

@include tablet {
position: static;
top: unset;
right: unset;
}
}

.formWrapper {
max-width: 43.625rem;
margin: 0 auto;
box-sizing: border-box;

@include tablet {
margin-top: 1.375rem;
padding: 0 1rem;
}
}

.menuButtonsWrapper {
border-top: 0.0625rem solid $c-gray-20;
}

.menuButton {
border-bottom: 0.0625rem solid $c-gray-20;
}

.logoutMenuButton {
color: $c-pink-mention;
}
Loading

0 comments on commit 77fa35d

Please sign in to comment.