Simplified profile page BOD-323

This commit is contained in:
Patrick Fic
2020-08-27 11:27:56 -07:00
parent 5c643515c0
commit 3150fdaade
13 changed files with 121 additions and 94 deletions

View File

@@ -8,22 +8,24 @@ import ManagePage from "./manage.page.component";
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
import { useTranslation } from "react-i18next";
const mapDispatchToProps = dispatch => ({
setBodyshop: bs => dispatch(setBodyshop(bs))
const mapDispatchToProps = (dispatch) => ({
setBodyshop: (bs) => dispatch(setBodyshop(bs)),
});
function ManagePageContainer({ match, setBodyshop }) {
const { loading, error, data } = useQuery(QUERY_BODYSHOP, {
fetchPolicy: "network-only"
fetchPolicy: "network-only",
});
const { t } = useTranslation();
useEffect(() => {
if (data) setBodyshop(data.bodyshops[0]);
}, [data, setBodyshop]);
if (loading)
return <LoadingSpinner message={t("general.labels.loadingshop")} />;
if (error) return <AlertComponent message={error.message} type='error' />;
if (error) return <AlertComponent message={error.message} type="error" />;
return <ManagePage match={match} />;
}

View File

@@ -1,11 +1,22 @@
import React, { useEffect } from "react";
import ProfilePage from "./profile.page";
import { useTranslation } from "react-i18next";
export default function ProfileContainerPage() {
import { connect } from "react-redux";
import { setBreadcrumbs } from "../../redux/application/application.actions";
import ProfilePage from "./profile.page";
const mapDispatchToProps = (dispatch) => ({
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
});
export function ProfileContainerPage({ setBreadcrumbs }) {
const { t } = useTranslation();
useEffect(() => {
setBreadcrumbs([
{ link: "/manage/profile", label: t("titles.bc.profile") },
]);
document.title = t("titles.profile");
}, [t]);
}, [t, setBreadcrumbs]);
return <ProfilePage />;
}
export default connect(null, mapDispatchToProps)(ProfileContainerPage);

View File

@@ -1,20 +1,12 @@
import { Layout } from "antd";
import React, { useState } from "react";
import ProfileContent from "../../components/profile-content/profile-content.component";
import ProfileSideBar from "../../components/profile-sidebar/profile-sidebar.component";
import React from "react";
import ProfileMyComponent from "../../components/profile-my/profile-my.component";
import ProfileShopsContainer from "../../components/profile-shops/profile-shops.container";
export default function ProfilePage() {
const [sidebarSelection, setSidebarSelection] = useState({ key: "profile" });
return (
<Layout>
<ProfileSideBar
sidebarSelection={sidebarSelection}
setSidebarSelection={setSidebarSelection}
/>
<Layout.Content>
<ProfileContent sidebarSelection={sidebarSelection} />
</Layout.Content>
</Layout>
<div>
<ProfileMyComponent />
<ProfileShopsContainer />;
</div>
);
}