Skip to content

Commit

Permalink
Merge pull request #195 from bluewave-labs/192-template-outlet
Browse files Browse the repository at this point in the history
solved 192
  • Loading branch information
erenfn authored Sep 13, 2024
2 parents 4d23618 + 2b575c9 commit 3ec3a29
Show file tree
Hide file tree
Showing 16 changed files with 159 additions and 191 deletions.
30 changes: 17 additions & 13 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,38 @@ import HintPage from "./scenes/hints/HintPage";
import CreatePopupPage from "./scenes/popup/CreatePopupPage";
import { Error404 } from "./scenes/errors/404";
import { Error403 } from "./scenes/errors/403";
import HomePageTemplate from "./templates/HomePageTemplate/HomePageTemplate";

function App() {
const { isLoggedIn } = useAuth();
const { isLoggedIn } = useAuth();

return (
<>
<Routes>
<Route path="/"element={isLoggedIn ? <Private Component={Home} /> : <LoginPage />}/>
<Route path="/home" element={<Private Component={Home} />} />
<Route path="/" element={isLoggedIn ? <Private Component={HomePageTemplate} /> : <LoginPage />}>
<Route index element={<Home />} />
<Route path="link" element={<LinksDefaultPage />} />
<Route path="tour" element={<ToursDefaultPage />} />
<Route path="/banner/create" element={<BannerPage />} />
<Route path="/popup/create" element={<Private Component={CreatePopupPage} />} />
<Route path="/banner" element={<Private Component={BannerDefaultPage} />} />
<Route path="/popup" element={<Private Component={PopupDefaultPage} />} />
<Route path="/hint-default" element={<HintDefaultPage />} />
<Route path="/hint/create" element={<CreateHintPage />} />
<Route path="/hint" element={<HintPage />} />
</Route>

<Route path="/login" element={<LoginPage />} />
<Route path="/signup" element={<CreateAccountPage />} />
<Route path="/forgot-password" element={<ForgotPasswordPage />} />
<Route path="/reset-password" element={<PasswordResetPage />} />
<Route path="/check-email" element={<CheckYourEmailPage />} />
<Route path="/set-new-password" element={<SetNewPasswordPage />} />

<Route path="/progress-steps" element={<ProgressStepsMain />} />
<Route path="/banner/create" element={<BannerPage />} />
<Route path="/popup/create" element={<Private Component={CreatePopupPage} />} />
<Route path="/banner" element={<Private Component={BannerDefaultPage} />} />
<Route path="/popup" element={<Private Component={PopupDefaultPage }/>} />
<Route path="/link" element={<LinksDefaultPage />} />
<Route path="/tour" element={<ToursDefaultPage />} />
<Route path="/hint-default" element={<HintDefaultPage />} />
<Route path="/hint/create" element={<CreateHintPage />} />
<Route path="/hint" element={<HintPage />} />
<Route path="/403" element={<Error403 />} />
<Route path="*" element={<Error404 />} />
</Routes>
</Routes>
</>
);
}
Expand Down
67 changes: 32 additions & 35 deletions frontend/src/scenes/bannerPage/BannerPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const BannerPage = () => {
};
try {
const response = location.state?.isEdit
? await editBanner(location.state?.id, bannerData)
: await addBanner(bannerData);
? await editBanner(location.state?.id, bannerData)
: await addBanner(bannerData);
const toastMessage = location.state?.isEdit ? 'You edited this banner' : 'New banner saved'
toastEmitter.emit(TOAST_EMITTER_KEY, toastMessage);
navigate('/banner');
Expand All @@ -78,39 +78,36 @@ const BannerPage = () => {
}

return (
<div >
<HomePageTemplate>
<GuideTemplate title='New banner'
activeButton={activeButton}
handleButtonClick={handleButtonClick}
onSave={onSave}
rightContent={() =>
<BannerPreview
backgroundColor={backgroundColor}
color={fontColor}
isTopPosition={isTopPosition}
bannerText={bannerText}
setBannerText={setBannerText}
/>}
leftContent={() =>
<BannerLeftContent
setIsTopPosition={setIsTopPosition}
isTopPosition={isTopPosition}
url={url}
setUrl={setUrl}
setButtonAction={setButtonAction}
buttonAction={buttonAction}
/>}
leftAppearance={() => (
<BannerLeftAppearance
backgroundColor={backgroundColor}
setBackgroundColor={setBackgroundColor}
fontColor={fontColor}
setFontColor={setFontColor}
/>
)} />
</HomePageTemplate>
</div>

<GuideTemplate title='New banner'
activeButton={activeButton}
handleButtonClick={handleButtonClick}
onSave={onSave}
rightContent={() =>
<BannerPreview
backgroundColor={backgroundColor}
color={fontColor}
isTopPosition={isTopPosition}
bannerText={bannerText}
setBannerText={setBannerText}
/>}
leftContent={() =>
<BannerLeftContent
setIsTopPosition={setIsTopPosition}
isTopPosition={isTopPosition}
url={url}
setUrl={setUrl}
setButtonAction={setButtonAction}
buttonAction={buttonAction}
/>}
leftAppearance={() => (
<BannerLeftAppearance
backgroundColor={backgroundColor}
setBackgroundColor={setBackgroundColor}
fontColor={fontColor}
setFontColor={setFontColor}
/>
)} />
);
};

Expand Down
4 changes: 1 addition & 3 deletions frontend/src/scenes/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Dashboard = ({ fullName }) => {
},
];
return (
<>

<div className={styles.container}>
<div className={styles.top}>
<UserTitle fullName={fullName} />
Expand All @@ -40,9 +40,7 @@ const Dashboard = ({ fullName }) => {
</div>
<CreateActivityButtonList buttons={buttons} />
<StatisticCardList metrics={metrics} />

</div>
</>
);
};

Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/dashboard/Dashboard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
width: 100%;
padding: 3rem;
gap:1.5rem;

.top{
display: flex;
justify-content: space-between;
Expand Down
60 changes: 28 additions & 32 deletions frontend/src/scenes/hints/CreateHintPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState } from "react";
import HomePageTemplate from "../../templates/HomePageTemplate/HomePageTemplate";
import GuideTemplate from "../../templates/GuideTemplate/GuideTemplate";
import RichTextEditor from "../../components/RichTextEditor/RichTextEditor";
import HintLeftContent from "../../components/HintPageComponents/HintLeftContent/HintLeftContent";
Expand Down Expand Up @@ -48,38 +47,35 @@ const HintPage = () => {
];

return (
<div>
<HomePageTemplate>
<GuideTemplate
title="New Hint"
activeButton={activeButton}
handleButtonClick={handleButtonClick}
rightContent={() => (
<RichTextEditor
previewBtnText={leftContentFormData.actionButtonText}
headerBackgroundColor={headerBackgroundColor}
headerColor={headerColor}
textColor={textColor}
buttonBackgroundColor={buttonBackgroundColor}
buttonTextColor={buttonTextColor}
sx={{
width: "100%",
maxWidth: "700px",
marginLeft: "2.5rem",
marginTop: "1rem",
}}
/>
)}
leftContent={() => (
<HintLeftContent
formData={leftContentFormData}
setLeftContentFormData={setLeftContentFormData}
/>
)}
leftAppearance={() => <HintLeftAppearance data={stateList} />}

<GuideTemplate
title="New Hint"
activeButton={activeButton}
handleButtonClick={handleButtonClick}
rightContent={() => (
<RichTextEditor
previewBtnText={leftContentFormData.actionButtonText}
headerBackgroundColor={headerBackgroundColor}
headerColor={headerColor}
textColor={textColor}
buttonBackgroundColor={buttonBackgroundColor}
buttonTextColor={buttonTextColor}
sx={{
width: "100%",
maxWidth: "700px",
marginLeft: "2.5rem",
marginTop: "1rem",
}}
/>
)}
leftContent={() => (
<HintLeftContent
formData={leftContentFormData}
setLeftContentFormData={setLeftContentFormData}
/>
</HomePageTemplate>
</div>
)}
leftAppearance={() => <HintLeftAppearance data={stateList} />}
/>
);
};

Expand Down
3 changes: 0 additions & 3 deletions frontend/src/scenes/hints/HintDefaultPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import CreateActivityButton from "../../components/Button/CreateActivityButton/CreateActivityButton"
import HomePageTemplate from "../../templates/HomePageTemplate/HomePageTemplate"
import { ACTIVITY_TYPES } from "../../data/CreateActivityButtonData";
import ParagraphCSS from "../../components/ParagraphCSS/ParagraphCSS";
import { useNavigate } from "react-router";
Expand All @@ -14,15 +13,13 @@ const HintDefaultPage = () => {
"align-items": "center",
};
return (
<HomePageTemplate>
<div style={style}>
<ParagraphCSS />
<CreateActivityButton
type={ACTIVITY_TYPES.HINTS}
onClick={() => navigate("/hint/create")}
/>
</div>
</HomePageTemplate>
);
};

Expand Down
69 changes: 33 additions & 36 deletions frontend/src/scenes/hints/HintPage.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import Button from "../../components/Button/Button";
import List from "../../components/TourComponents/List/List";
import HomePageTemplate from "../../templates/HomePageTemplate/HomePageTemplate";
import HintDefaultPage from "./HintDefaultPage";
import "./HintPage.css";
import { useNavigate } from "react-router-dom";
Expand All @@ -25,43 +24,41 @@ const HintPage = () => {
return <HintDefaultPage />;
} else {
return (
<HomePageTemplate>
<div className="hint-page-container">
<div className="hint-page-left-section">
<h2 className="hint-page-title" style={{ marginBottom: "16px" }}>All Hints</h2>
<List items={hintsData} onSelectItem={() => { }} />
</div>
<div className="hint-right-content">
<Button
style={{ height: "34px", width: "172px" }}
text="Create a new hint"
variant="contained"
onClick={() => navigate("/hint-default")}
/>
<div className="hint-info">
<h2 className="hint-info-title">What is a hint?</h2>
<p>
Hints are like friendly reminders in an app, giving tips
without stopping what you are doing. They show up at small
bubbles near buttons or menus, guiding you on how to use
things.
</p>
<p>
One good thing about hints is they help you use the app
better by giving tips when you need them. For example, they
can show clear instructions when you're trying something
new, so you don't get stuck or confused.
</p>
<p>
Hints work for everyone, from beginners to experts. They
give basic tips for people just starting out and clever
tricks for those who know the app well. This makes the app
easier for everyone to use.
</p>
</div>
<div className="hint-page-container">
<div className="hint-page-left-section">
<h2 className="hint-page-title" style={{ marginBottom: "16px" }}>All Hints</h2>
<List items={hintsData} onSelectItem={() => { }} />
</div>
<div className="hint-right-content">
<Button
style={{ height: "34px", width: "172px" }}
text="Create a new hint"
variant="contained"
onClick={() => navigate("/hint-default")}
/>
<div className="hint-info">
<h2 className="hint-info-title">What is a hint?</h2>
<p>
Hints are like friendly reminders in an app, giving tips
without stopping what you are doing. They show up at small
bubbles near buttons or menus, guiding you on how to use
things.
</p>
<p>
One good thing about hints is they help you use the app
better by giving tips when you need them. For example, they
can show clear instructions when you're trying something
new, so you don't get stuck or confused.
</p>
<p>
Hints work for everyone, from beginners to experts. They
give basic tips for people just starting out and clever
tricks for those who know the app well. This makes the app
easier for everyone to use.
</p>
</div>
</div>
</HomePageTemplate>
</div>
);
}
};
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/scenes/home/Home.css

This file was deleted.

10 changes: 1 addition & 9 deletions frontend/src/scenes/home/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import HomePageTemplate from "../../templates/HomePageTemplate/HomePageTemplate";
import Dashboard from "../dashboard/Dashboard";
import "./Home.css";
import React, { useEffect, useState } from 'react';
import { getCurrentUser } from '../../services/loginServices';
import Cookies from 'js-cookie';
Expand All @@ -18,13 +16,7 @@ const Home = () => {
}, [fullName]);

return (
<div className="app">
<div className="content">
<HomePageTemplate>
<Dashboard fullName={fullName} />
</HomePageTemplate>
</div>
</div>
<Dashboard fullName={fullName} />
);
};

Expand Down
4 changes: 0 additions & 4 deletions frontend/src/scenes/links/LinksDefaultPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import CreateActivityButton from "../../components/Button/CreateActivityButton/CreateActivityButton"
import HomePageTemplate from "../../templates/HomePageTemplate/HomePageTemplate"
import { ACTIVITY_TYPES } from "../../data/CreateActivityButtonData";
import ParagraphCSS from "../../components/ParagraphCSS/ParagraphCSS";

Expand All @@ -12,13 +11,10 @@ const LinksDefaultPage = () => {
"align-items": "center",
}
return (
<HomePageTemplate>
<div style={style}>
<ParagraphCSS />
<CreateActivityButton type={ACTIVITY_TYPES.HELPERLINKS} />
</div>

</HomePageTemplate>
)
}

Expand Down
Loading

0 comments on commit 3ec3a29

Please sign in to comment.