Skip to content

Commit

Permalink
testing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
poloblue1357 committed Mar 21, 2024
2 parents fe7b8d3 + c4b1628 commit 6ff58e2
Show file tree
Hide file tree
Showing 52 changed files with 2,409 additions and 1,065 deletions.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,39 @@ Visit the [Nx Documentation](https://nx.dev) to learn more.
1. Testing your code. Two folders are provided for you to create tests for your code, `server-e2e` and `frontend-e2e`.
2. Building tests are a great way to make sure any edits in your code do not accidentally break something elsewhere. To use run `npx nx e2e SPECIFIC-FOLDER --skip-cache`.
3. Coding some tests on the frontend require a backend, like the tests provided in `frontend-e2e` folder (tests that require CRUD functionality). This means that you must have your localhost backend running when calling this folder to test the application. NOTE: in the `tests.yml` file there is an example of how to have your backend server running while you use the testing command.
4. To get CRUD functionality working in Github actions we need to first set up some Github secrets. In your repo go to 'Settings' -> 'Secrets and variables' -> 'Actions' and create a new secret called `FIREBASE_ADMINSDK_KEY` and then set it to the value in your `.env` file. Next we have to allow your Google Project to allow Github access. To do this create another secret and call it `GCP_PRIVATE_KEY` and set it to your Google Cloud Key. NOTE: if you do not have the key saved somewhere, then you can just create a new one, go to the google cloud console and select your project, navigate to 'IAM & Admin' -> 'Service Accounts' -> 'Keys' and create a JSON key.
4. To get CRUD functionality working in Github actions we need to first set up some Github secrets. In your repo go to 'Settings' -> 'Secrets and variables' -> 'Actions' and create a new secret called `FIREBASE_ADMINSDK_KEY` and then set it to the value in your `.env` file. Next we have to allow your Google Project to allow Github access. To do this create another secret and call it `GCP_PRIVATE_KEY` and set it to your Google Cloud Key. NOTE: if you do not have the key saved somewhere, then you can just create a new one, go to the google cloud console and select your project, navigate to 'IAM & Admin' -> 'Service Accounts' -> 'Keys' and create a JSON key.


# Getting Started for New Developers:

To begin contributing to the project, follow these steps:

1. Clone the main branch and switch to the "AT" branch:
- `git clone https://github.com/tirzah-dev/WOL-Planner.git`
- `git checkout AT`

2. Create a new branch from the "AT" branch for your changes. For example:
- `git checkout -b setup`

3. Install project dependencies:
- `npm i`

4. Create a `.env` file at the root of the directory:
- `touch .env`

5. Reach out to the Project Manager for the necessary content to populate the `.env` file.

Once set up, you can start the frontend and backend servers for testing:

- Start the backend server:
- `npx nx serve server`

- Open another terminal and start the frontend server:
- `npx nx serve frontend`

For more information on installing Nx into an existing repository, refer to the [Installing Nx](https://nx.dev/getting-started/installation) guide:

- Initialize Nx in your project:
- `npx nx@latest init`

Please note that instead of `npx nx serve server`, you can use `nx serve server` and `nx serve frontend`.
17 changes: 12 additions & 5 deletions apps/frontend/src/app/app.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
/* Your styles goes here. */
body {
min-height: 100vh;
display: flex;
flex-direction: column;
}
// body {
// min-height: 100vh;
// display: flex;
// flex-direction: column;
// }

// .page {
// height: 100vh;
// display: grid;
// grid-template-rows: 40px 137px 98px 66px 116px 66px 96px 106px;
// }

93 changes: 68 additions & 25 deletions apps/frontend/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,94 @@
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { BrowserRouter } from 'react-router-dom';
import Footer from './components/footer/footer';
// import Header from './components/header/header';
import Header from './components/header/header';
import Router from './views/router/router';
import { AssetProvider } from './views/assets/AssetContext';
import './app.module.scss';
// import { UpdateAssets } from './views/assets/UpdateAssets';
import { AssetsInput } from './views/assets/AssetsInput';

// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any
export const UserContext = React.createContext({user: {firstName: null, lastName: null, id: null, joinDate: null, email: null, userType: 'Reader', picture: null, name: null, roles: ['None']}, setUser: (user: any) => {}});
export const UserContext = React.createContext({
user: {
firstName: null,
lastName: null,
id: null,
joinDate: null,
email: null,
userType: 'Reader',
picture: null,
name: null,
roles: ['None'],
},
setUser: (user: any) => {},
});


export function App() {

const [user, setUser] = React.useState<any>({firstName: null, lastName: null, id: null, joinDate: null, email: null, userType: 'Reader', picture: null, name: null, roles: ['None']});

export function App() {
const [user, setUser] = React.useState<any>({
firstName: null,
lastName: null,
id: null,
joinDate: null,
email: null,
userType: 'Reader',
picture: null,
name: null,
roles: ['None'],
});

useEffect(() => {
const user = localStorage.getItem('user');
if(user){
if (user) {
setUser(JSON.parse(user));
}
}, [])
}, []);

useEffect(() => {
console.log(user)
}, [user])
console.log(user);
}, [user]);

// this is for cypress testing, to have a test user logged in
useEffect(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if(window.Cypress){
const user = {firstName: 'Test', lastName: 'User', id: 'test', joinDate: '05/05/2023', email: 'testUser@test.com', userType: 'Reader', picture: 'www.google.com', name: 'Test User', roles: ['None']}
setUser(user)
if (window.Cypress) {
const user = {
firstName: 'Test',
lastName: 'User',
id: 'test',
joinDate: '05/05/2023',
email: 'testUser@test.com',
userType: 'Reader',
picture: 'www.google.com',
name: 'Test User',
roles: ['None'],
};
setUser(user);
}
}, [])
}, []);

return (
<UserContext.Provider value={{user, setUser}}>
<BrowserRouter>
<div className="flex flex-col h-screen">
<div style={{ flex: '1 1 0' }}>
{/* <Header></Header> */}
<Router></Router>
</div>
<Footer></Footer>
</div>
</BrowserRouter>
</UserContext.Provider>
// <UserContext.Provider value={{ user, setUser }}>
// {/* <AssetProvider value={{assets, setAssets, saveAssets, removeAsset, getAllAssets, addNewAsset }} > */}
// {/* <UpdateAssets /> */}

<BrowserRouter>
<div className="flex flex-col h-screen">
<div style={{ flex: '1 1 0' }}>
<Header></Header>
<Router></Router>

</div>

</div>
</BrowserRouter>
// {/* </AssetProvider> */}
// </UserContext.Provider>
);
}

export default App;
export default App;
24 changes: 11 additions & 13 deletions apps/frontend/src/app/components/authlayout/AuthLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ import backgroundImage from './background-auth.jpg'

export function AuthLayout({ children }: any) {
return (
<div>
<div className="relative flex min-h-full justify-center md:px-12 lg:px-0">
<div className="relative z-10 flex flex-1 flex-col bg-white px-4 py-3 shadow-xl sm:justify-center md:flex-none md:px-28">
<div className="mx-auto max-w-md sm:px-4 md:w-96 md:max-w-sm md:px-0">
{children}
</div>
</div>
<div className="hidden sm:contents lg:relative lg:block lg:flex-1">
<img
className="absolute inset-0 h-full w-full object-cover"
src={backgroundImage}
alt="blue background"
/>
<div className="relative flex min-h-full justify-center md:px-0">
<div className="relative z-10 flex flex-1 flex-col bg-white px-4 py-3 shadow-xl sm:justify-center md:flex-none md:px-0 md:w-full">
<div className="mx-auto w-full max-w-md sm:px-4 md:w-96 md:max-w-sm md:px-0">
{children}
</div>
</div>
<div className="hidden sm:contents lg:relative lg:block lg:flex-1">
<img
className="absolute inset-0 h-full w-full object-cover"
src={backgroundImage}
alt="blue background"
/>
</div>
</div>
)
}
63 changes: 63 additions & 0 deletions apps/frontend/src/app/components/hamburger-nav/HamburgerNav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React, { useContext } from 'react';
import crystalBall from '../../images/dash/crystal-ball.svg';
import lineList from '../../images/dash/line-md_list-3-filled.svg';
import { Link } from 'react-router-dom';

import './hamburger.css';

interface HamburgerNavProps {
show: boolean;
}

const HamburgerNav: React.FC<HamburgerNavProps> = ({ show }) => {
return (
<div className={`sidebar ${show ? 'show' : ''}`}>
<aside id="FlyoutMenuRoot" className="fly-out-menu-root">
<div className="ham-trademark-container">
<div id="W" className="ham-trademark-letter">
W
</div>
<img
src={lineList}
alt="lineList"
id="lineList"
className="ham-trademark-symbol"
/>
<div id="L" className="ham-trademark-letter">
L
</div>
<div className="ham-vertical-line">
"
<img
src={crystalBall}
alt="CrystalBall"
id="CrystalBall"
className="ham-crystalball mb-0 mt-1"
/>
</div>
</div>
<div className="link-container">
<div className="hamburger-link">
<Link to="/dashboard">Dashboard</Link>
</div>
<div className="hamburger-link">
<Link to="/">Cash Flow</Link>
</div>
<div className="hamburger-link">
<Link to="/assets">Assets</Link>
</div>
<div className="hamburger-link">
<Link to="/">Liabilities</Link>
</div>
<div className="hamburger-link">
<Link to="/">Logout</Link>
</div>
<div className="hamburger-link">
<Link to="/">Settings</Link>
</div>
</div>
</aside>
</div>
);
};
export default HamburgerNav;
Loading

0 comments on commit 6ff58e2

Please sign in to comment.