Skip to content

Commit

Permalink
Merge pull request #2 from HackYourFuture-CPH/feature/homepage
Browse files Browse the repository at this point in the history
Feature/homepage
  • Loading branch information
Aaron Moses committed Mar 29, 2024
2 parents b87aa70 + d27e966 commit ed7cb59
Show file tree
Hide file tree
Showing 44 changed files with 22,940 additions and 6,678 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js 17.3.x
- name: Use Node.js 18.0.x
uses: actions/setup-node@v1
with:
node-version: 18.x
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: Use Node.js 17.3.x
- name: Use Node.js 18.0.x
uses: actions/setup-node@v1
with:
node-version: 18.x
Expand All @@ -51,4 +51,3 @@ jobs:
MYSQL_USER: 'root'
MYSQL_PASSWORD: 'password'
MYSQL_DATABASE: 'test'

2 changes: 1 addition & 1 deletion .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js 17.3.x
- name: Use Node.js 18.0.x
uses: actions/setup-node@v1
with:
node-version: 18.x
Expand Down
15 changes: 14 additions & 1 deletion packages/client/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
{
"extends": ["../../.eslintrc", "react-app", "react-app/jest", "airbnb/hooks"],
"parser": "@babel/eslint-parser",
"extends": [
"../../.eslintrc",
"eslint:recommended",
"plugin:react/recommended",
"react-app",
"react-app/jest",
"airbnb/hooks"
],
"env": {
"jest": true,
"browser": true
},
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"no-console": "error",
"react/destructuring-assignment": "off",
Expand Down
40 changes: 27 additions & 13 deletions packages/client/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
module.exports = {
stories: [
'../src/**/*.stories.mdx',
'../src/components/*.stories.@(js|jsx|ts|tsx)',
'../src/**/*.stories.@(js|jsx|ts|tsx)',
],
import { join, dirname } from 'path';

/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value) {
return dirname(require.resolve(join(value, 'package.json')));
}

/** @type { import('@storybook/react-webpack5').StorybookConfig } */
const config = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/preset-create-react-app',
getAbsolutePath('@storybook/preset-create-react-app'),
getAbsolutePath('@storybook/addon-onboarding'),
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@chromatic-com/storybook'),
getAbsolutePath('@storybook/addon-interactions'),
],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-webpack5',
framework: {
name: getAbsolutePath('@storybook/react-webpack5'),
options: {},
},
docs: {
autodocs: 'tag',
},
staticDirs: ['../public'],
};
export default config;
43 changes: 29 additions & 14 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,27 @@
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.1.1",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.6.8",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"lint-staged": "^12.4.0",
"prettier": "^2.6.2",
"prop-types": "^15.8.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-router-dom": "^6.22.3",
"react-scripts": "^5.0.1",
"stylelint": "^16.3.1",
"stylelint-config-prettier": "^9.0.3",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -s public",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"lint": "eslint --ext .js,.jsx,.ts,.tsx ."
},
"browserslist": {
Expand All @@ -35,16 +42,24 @@
]
},
"devDependencies": {
"@storybook/addon-actions": "^6.4.22",
"@storybook/addon-essentials": "^6.4.22",
"@storybook/addon-interactions": "^6.4.22",
"@storybook/addon-links": "^6.4.22",
"@storybook/builder-webpack5": "^6.4.22",
"@storybook/manager-webpack5": "^6.4.22",
"@storybook/node-logger": "^6.4.22",
"@storybook/preset-create-react-app": "^4.1.0",
"@storybook/react": "^6.4.22",
"@storybook/testing-library": "^0.0.11",
"@babel/eslint-parser": "^7.24.1",
"@chromatic-com/storybook": "^1.2.25",
"@storybook/addon-actions": "^8.0.4",
"@storybook/addon-essentials": "^8.0.4",
"@storybook/addon-interactions": "^8.0.4",
"@storybook/addon-links": "^8.0.4",
"@storybook/addon-onboarding": "^8.0.4",
"@storybook/blocks": "^8.0.4",
"@storybook/builder-webpack5": "^8.0.4",
"@storybook/manager-webpack5": "^6.5.16",
"@storybook/node-logger": "^8.0.4",
"@storybook/preset-create-react-app": "^8.0.4",
"@storybook/react": "^8.0.4",
"@storybook/react-webpack5": "^8.0.4",
"@storybook/test": "^8.0.4",
"@storybook/testing-library": "^0.2.2",
"babel-eslint": "^10.1.0",
"storybook": "^8.0.4",
"webpack": "^5.72.0"
}
}
2 changes: 1 addition & 1 deletion packages/client/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
8 changes: 6 additions & 2 deletions packages/client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import './App.css';
import { LandingPage } from './containers/LandingPage/LandingPage.Container';
import { Navbar } from './containers/NavbarPage/Navbar';
import IndexPage from './containers/IndexPage/IndexPage';
// import { LandingPage } from './containers/LandingPage/LandingPage.Container';
import { PageNotFound } from './containers/PageNotFound/PageNotFound.Container';

function App() {
return (
<div className="app">
<Router>
<Navbar />
<Routes>
<Route path="/" element={<LandingPage />} />
<Route path="/" element={<IndexPage />} />
{/* <Route path="/" element={<LandingPage />} /> */}
<Route path="*" element={<PageNotFound />} />
</Routes>
</Router>
Expand Down
20 changes: 20 additions & 0 deletions packages/client/src/containers/IndexPage/IndexPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.header-container {
display: inline-block;
margin-top: 50px;
}

.my-button {
background: linear-gradient(
to right,
transparent,
red,
orange,
yellow,
green,
violet
);
border-radius: 7px;
padding: 7px 20px;
font-size: 10px;
font-family: 'Roboto', sans-serif;
}
79 changes: 79 additions & 0 deletions packages/client/src/containers/IndexPage/IndexPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { apiURL } from '../../apiURL';
import './IndexPage.css';

function Index() {
const [inputValue, setInputValue] = useState('');
const [errorMessage, setErrorMessage] = useState('');
const navigate = useNavigate();

const handleInputChange = (e) => {
setInputValue(e.target.value);
// Clear error message when user starts typing again
setErrorMessage('');
};

const handleSubmit = async (e) => {
e.preventDefault();

if (inputValue === 'TeamCode') {
try {
const response = await fetch(`${apiURL}/CreateNewTeam/${inputValue}`);
if (response.ok) {
// Navigate to retroPage
navigate('/retroPage');
} else {
// Set error message for invalid code
setErrorMessage('Invalid code. Please try again.');
}
} catch (error) {
// Handle fetch error
// console.error('Error:', error);
// Set error message for fetch failure
setErrorMessage('Failed to validate code. Please try again.');
}
} else {
// Set error message for missing code
setErrorMessage('Please provide a team code.');
}
};

const handleCreateNewTeamClick = () => {
navigate('/CreateNewTeamPage');
};

return (
<div className="index-container">
<div className="header-container">
<h2>Join with</h2>
<form onSubmit={handleSubmit}>
<input
type="text"
placeholder="Team Code"
value={inputValue}
onChange={handleInputChange}
/>
<button type="submit" className="my-button">
Submit
</button>
</form>
{errorMessage && <p className="error-message">{errorMessage}</p>}
</div>
<h3> OR </h3>
<button
type="button"
onClick={handleCreateNewTeamClick}
className="my-button"
>
Create New Team
</button>
<footer>
<p>Created by RetroRealm</p>
<p>&copy; 2024 RetroRealm. All rights reserved.</p>
</footer>
</div>
);
}

export default Index;
22 changes: 22 additions & 0 deletions packages/client/src/containers/NavbarPage/Navbar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.nav-container {
background: linear-gradient(
to right,
transparent,
red,
orange,
yellow,
green,
blue,
indigo,
violet
);
height: 60px;
}

.nav-header {
display: flex;
justify-content: flex-end;
position: absolute;
top: 0;
left: 0;
}
11 changes: 11 additions & 0 deletions packages/client/src/containers/NavbarPage/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import './Navbar.css';

export const Navbar = () => {
return (
<nav className="nav-container">
<div className="logo">{/* Add your logo here */}</div>
<h1 className="nav-header">RetroRealm</h1>
</nav>
);
};
Loading

0 comments on commit ed7cb59

Please sign in to comment.