Skip to content

Commit

Permalink
Merge pull request #143 from bluewave-labs/reorganized-components
Browse files Browse the repository at this point in the history
reorganized components
  • Loading branch information
erenfn authored Aug 14, 2024
2 parents 015af62 + ac3ba85 commit 5ca9ff3
Show file tree
Hide file tree
Showing 25 changed files with 95 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import Button from "../Button/Button";
import Button from "../Button";
import "./CreateActivityButtonStyles.css";
import CheckIcon from "../CheckIcon/CheckIcon";
import CheckIcon from "../../CheckIcon/CheckIcon";
import PropTypes from "prop-types";
import { activityData, ACTIVITY_TYPES } from "../../data/CreateActivityButtonData";
import { activityData, ACTIVITY_TYPES } from "../../../data/CreateActivityButtonData";


const CreateActivityButton = ({ type = ACTIVITY_TYPES.HINTS, onClick }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../styles/variables.css";
@import "../../../styles/variables.css";

.bannerStyle{
display: flex;
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/components/Charts/Charts.jsx

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
import Person2OutlinedIcon from '@mui/icons-material/Person2Outlined';
import LogoutOutlinedIcon from '@mui/icons-material/LogoutOutlined';
import { useNavigate } from 'react-router-dom';
import { logout } from '../../services/loginServices';
import { logout } from '../../../services/loginServices';

const DropdownMenu = () => {
const navigate = useNavigate();
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState } from 'react';
import './Header.css';
import KeyboardArrowDownOutlinedIcon from '@mui/icons-material/KeyboardArrowDownOutlined';
import DropdownMenu from '../DropdownMenu/DropdownMenu';
import DropdownMenu from './DropdownMenu/DropdownMenu';
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
import Avatar from '../Avatar/Avatar';
import Avatar from './Avatar/Avatar';

function Header({ user }) {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Box, Typography } from '@mui/material';
import Button from '../Button/Button';
import Button from '../../Button/Button';
import './TitleStyles.css';

const Title = ({ title, buttonText, onButtonClick, titleStyle, buttonStyle, children }) => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/bannerPage/BannerDefaultPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CreateActivityButton from "../../components/CreateActivityButton/CreateActivityButton"
import HomePageTemplate from "../../components/templates/HomePageTemplate"
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-dom';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/bannerPage/BannerPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import HomePageTemplate from '../../components/templates/HomePageTemplate';
import GuideTemplate from '../../components/templates/GuideTemplate/GuideTemplate';
import HomePageTemplate from '../../templates/HomePageTemplate/HomePageTemplate';
import GuideTemplate from '../../templates/GuideTemplate/GuideTemplate';
import BannerLeftContent from '../../components/BannerPageComponents/BannerLeftContent/BannerLeftContent';
import BannerLeftAppearance from '../../components/BannerPageComponents/BannerLeftAppearance/BannerLeftApperance';
import { React, useState } from 'react';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/hints/HintDefaultPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CreateActivityButton from "../../components/CreateActivityButton/CreateActivityButton"
import HomePageTemplate from "../../components/templates/HomePageTemplate"
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 Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/home/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import HomePageTemplate from "../../components/templates/HomePageTemplate";
import HomePageTemplate from "../../templates/HomePageTemplate/HomePageTemplate";
import Dashboard from "../dashboard/Dashboard";
import "./Home.css";
import React, { useEffect, useState } from 'react';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/links/LinksDefaultPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CreateActivityButton from "../../components/CreateActivityButton/CreateActivityButton"
import HomePageTemplate from "../../components/templates/HomePageTemplate"
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 Down
2 changes: 0 additions & 2 deletions frontend/src/scenes/login/CreateAccountPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ function CreateAccountPage() {
return;
}

const userData = { username: formData.username, email: formData.email, password: formData.password };

try {
const response = await signUp(formData);
console.log('Sign up successful:', response);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/popup/CreatePopupPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import HomePageTemplate from '../../components/templates/HomePageTemplate';
import GuideTemplate from '../../components/templates/GuideTemplate/GuideTemplate';
import HomePageTemplate from '../../templates/HomePageTemplate/HomePageTemplate';
import GuideTemplate from '../../templates/GuideTemplate/GuideTemplate';
import { React, useState } from 'react';
import RichTextEditor from '../../components/RichTextEditor/RichTextEditor';
import PopupAppearance from '../../components/PopupPageComponents/PopupAppearance/PopupAppearance';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/popup/PopupDefaultPage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import CreateActivityButton from "../../components/CreateActivityButton/CreateActivityButton"
import HomePageTemplate from "../../components/templates/HomePageTemplate"
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-dom';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/tours/ToursDefaultPage.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import CreateActivityButton from "../../components/CreateActivityButton/CreateActivityButton";
import HomePageTemplate from "../../components/templates/HomePageTemplate";
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 TourPage from './ProductTour';
Expand Down
58 changes: 58 additions & 0 deletions frontend/src/templates/GuideTemplate/GuideTemplate.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { React } from 'react';
import PropTypes from 'prop-types';
import CloseOutlinedIcon from '@mui/icons-material/CloseOutlined';
import styles from './GuideTemplate.module.scss';
import classNames from 'classnames';
import Button from '../../components/Button/Button';
import { useNavigate } from 'react-router-dom';

const GuideTemplate = ({ title = '', handleButtonClick = () => null, activeButton = 0, leftContent = () => null, rightContent = () => null, leftAppearance = () => null }) => {
const navigate = useNavigate();
const buttons = ['Content', 'Appearance'];
return (
<div className={styles.container}>
<div className={styles.popup}>
<div className={styles.header}>
<span style={{ marginLeft: '5px' }}>{title}</span>
<CloseOutlinedIcon style={{ color: '#98A2B3', fontSize: '20px' }} />
</div>
<div className={styles.content}>
{/* Content and Appereance buttons */}
<div className={styles.buttons}>
{buttons.map((buttonName, index) => (
<button
key={index}
className={classNames(styles.menuButton, {
[styles.active]: activeButton === index,
})}
onClick={() => handleButtonClick(index)}
>
{buttonName}
</button>
))}
</div>
<div className={styles.leftRightContent}>
{activeButton === 1 ? leftAppearance() : leftContent()}
{rightContent()}
</div>
<div className={styles.optionButtons}>
<Button text='Cancel' buttonType='secondary-grey' onClick={() => {navigate('/');}}/>
<Button text='Save'/>
</div>
</div>
</div>

</div>
);
};

GuideTemplate.propTypes = {
title: PropTypes.string,
handleButtonClick: PropTypes.func,
activeButton: PropTypes.number,
leftContent: PropTypes.func,
rightContent: PropTypes.func,
leftAppearance: PropTypes.func,
};

export default GuideTemplate;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../../../styles/globals.scss' as *;
@use '../../styles/globals.scss' as *;

.container {

Expand Down
12 changes: 12 additions & 0 deletions frontend/src/templates/GuideTemplate/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Guide Template

The Guide Template is designed for creating "Create Activity" pages, such as CreatePopupPage and CreateBannerPage.

## Overview

- **LeftContent**: Displayed when the "Content" button is clicked.
- **LeftAppearance**: Displayed when the "Appearance" button is clicked.
- **RightContent**: Always visible on the page.
- **onSave**: Specifies the action to be taken when the "Save" button is clicked.
- **title**: Allows editing of the page title.
- **handleButtonClick**: Manages which button is clicked (either "Appearance" or "Content").
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import LeftMenu from "../../components/LeftMenu/LeftMenu";
import Header from "../Header/Header";
import Header from "../../components/Header/Header";
import "./HomePageTemplate.css";
import { getCurrentUser } from '../../services/loginServices';

Expand Down

0 comments on commit 5ca9ff3

Please sign in to comment.