Initial Commit

This commit is contained in:
Paulo Gustavo Veiga 2020-11-26 19:03:24 -08:00
parent e953937e44
commit 22c5cdbb6b
19 changed files with 39375 additions and 0 deletions

70
README.md Normal file
View File

@ -0,0 +1,70 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

38715
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

45
package.json Normal file
View File

@ -0,0 +1,45 @@
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.2.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-intl": "^5.10.5",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"extract": "formatjs extract",
"compile": "formatjs compile"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@formatjs/cli": "^2.13.14"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.0 KiB

43
public/index.html Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

BIN
public/logo192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
public/logo512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

25
public/manifest.json Normal file
View File

@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

3
public/robots.txt Normal file
View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

23
src/Footer.js Normal file
View File

@ -0,0 +1,23 @@
import React from 'react';
class Footer extends React.Component {
render() {
return (
<footer class="footer">
<img src="images/text-wisemapping.svg" />
<div>
<a href="termsofuse.html">Terms and Conditions</a>
<a href="mailto:feedback@wisemapping.com">Feedback</a>
<a href="mailto:team@wisemapping.com">Contact Us</a>
<a href="http://www.wisemapping.org/">Open Source</a>
<a href="faq.html">FAQ</a>
<a href="aboutus.html">About Us</a>
</div>
</footer>
)
};
}
export default Footer;

43
src/Header.js Normal file
View File

@ -0,0 +1,43 @@
import React from 'react';
class Header extends React.Component {
constructor(props) {
super(props);
this.state = {
type: props.type
};
}
render() {
let buttons;
const pageType = this.state.type;
if (pageType == 'login') {
buttons = <SignUpButton/>;
} else {
buttons = <span><SignUpButton/><SignInButton/></span>;
}
return (
<nav>
<div class="header">
<span class="header-logo"><a href="/"><img src="images/header-logo.png" alt="logo" /></a></span>
{buttons}
</div>
</nav>
)
};
}
class SignInButton extends React.Component {
render() {
return <span class="nav-signin"><a href="https://app.wisemapping.com/c/login">Sign In</a></span>;
}
}
class SignUpButton extends React.Component {
render() {
return <span class="nav-signup"><a href="https://app.wisemapping.com/c/user/registration">Sign Up</a></span>;
}
}
export default Header;

116
src/LoginPage.js Normal file
View File

@ -0,0 +1,116 @@
import React from 'react';
import Header from './Header.js';
import Footer from './Footer.js';
import { createIntl, createIntlCache, FormattedMessage, IntlProvider } from 'react-intl'
class ConfigStatusMessage extends React.Component {
constructor(props) {
super(props)
this.state = {
enabled: props.enabled
}
}
render() {
return (
<p>
<FormattedMessage id="NO_PRODUCTION_DATABASE_CONFIGURED" defaultMessage="Missing production database configured" description="Missing production database configured" />
<a href="https://wisemapping.atlassian.net/wiki/display/WS/Database+Configuration"></a>.
</p>
);
}
}
class LoginForm extends React.Component {
constructor(props) {
super(props);
this.state = {
email: '',
password: '',
staySignIn: false
};
this.handleInputChange = this.handleInputChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleInputChange(event) {
const target = event.target;
const name = target.name;
const value = target.type === 'checkbox' ? target.checked : target.value;
this.setState({
[name]: value
});
};
handleSubmit(event) {
alert('A name was submitted: ' + this.state.value);
event.preventDefault();
}
render() {
return (
<div class="wrapper">
<div class="content">
<h1><FormattedMessage id="WELCOME" defaultMessage="Welcome" /></h1>
<p><FormattedMessage id="LOG_INTO" defaultMessage="Log Into Your Account" /></p>
<form onSubmit={this.handleSubmit}>
<div><input type="email" placeholder={intl.formatMessage({ id: "EMAIL", defaultMessage: 'Email' })} value={this.state.value} onChange={this.handleInputChange} required /></div>
<div><input type="password" placeholder={intl.formatMessage({ id: "PASSWORD", defaultMessage: 'Password' })} value={this.state.value} onChange={this.handleInputChange} required /></div>
<div>
<input name="staySignIn" id="staySignIn" type="checkbox" checked={this.state.staySignIn} onChange={this.handleInputChange} />
<label for="staySignIn"><FormattedMessage id="REMEMBER_ME" defaultMessage="Remember me" /></label>
</div>
<input type="submit" value={intl.formatMessage({ id: "SING_IN", defaultMessage: 'Sign In' })} value={this.state.value} />
</form>
<a hef="forgot"><FormattedMessage id="FORGOT_PASSWORD" defaultMessage="Forgot Password ?" /></a>
</div>
</div>
);
}
}
const cache = createIntlCache()
// @Todo: Review ...
var intl = null;
class LoginPage extends React.Component {
constructor(props) {
super(props);
const messages = props.messages;
const locale = props.locale;
this.state = {
locale: locale,
message: messages
};
intl = createIntl(
{
locale: locale,
defaultLocale: 'en'
},
messages,
cache
)
}
render() {
return (
<IntlProvider locale={this.state.locale} defaultLocale="en" messages={this.state.messages}>
<div>
<Header type='login' />
<LoginForm />
<ConfigStatusMessage enabled='true' />
<Footer />
</div>
</IntlProvider>
);
}
}
export default LoginPage;

184
src/css/core.css Normal file
View File

@ -0,0 +1,184 @@
@import url('https://fonts.googleapis.com/css?family=Montserrat:100,300,400,700,900');
* {
box-sizing: border-box;
}
body {
font: 1.2em Montserrat, arial, sans-serif;
margin: 0px;
}
.wrapper {
max-width: 1024px;
margin: auto;
}
.wrapper>* {
border-radius: 5px;
padding: 10px;
}
h1,
h2 {
font-stretch: normal;
font-style: normal;
line-height: 1.2;
letter-spacing: normal;
}
h1 {
font-size: 36px;
font-weight: bold;
font-stretch: normal;
font-style: normal;
line-height: normal;
letter-spacing: normal;
color: #f9a826;
}
a {
text-decoration: none;
transition: background-color 0.3s ease;
}
p {
font-size: 22px;
font-weight: 300;
font-stretch: normal;
font-style: normal;
line-height: 1.36;
letter-spacing: normal;
text-align: center;
color: #000000;
}
/* Header Section */
nav {
height: 90px;
position: sticky;
top: -16px;
z-index: 1;
-webkit-backface-visibility: hidden;
}
nav::before,
nav::after {
content: '';
display: block;
height: 16px;
position: sticky;
}
nav::before {
top: 58px;
box-shadow: 0 4px 10px 0 rgba(202, 34, 34, 0.05), 0 5px 30px 0 rgba(0, 0, 0, 0.05);
}
nav::after {
background: linear-gradient(white, rgba(255, 255, 255, 0.3));
top: 0;
z-index: 2;
}
nav>div {
background: white;
height: 74px;
padding: 10px;
position: sticky;
top: 0px;
margin-top: -16px;
z-index: 3;
}
nav a {
text-decoration: none;
border-radius: 9px;
padding: 10px 15px 10px 15px;
background-color: white;
color: #000000;
}
.header {
display: grid;
white-space: nowrap;
grid-template-columns: 150px 1fr 130px 130px;
}
.header-logo {
grid-column-start: 1;
margin-left: 50px;
margin-top: 5px;
}
.header-logo img {
height: 50px;
}
.header-logo a {
padding: 0px;
}
.nav-link a:hover,
.nav-signin a:hover {
background-color: rgb(241, 217, 181);
color: #ffa800;
}
.nav-signin,
.nav-signup {
margin: 20px 0px;
font-size: 16px;
font-weight: 700;
}
.nav-signin {
grid-column-start: 4;
}
.nav-signup {
grid-column-start: 3;
}
.nav-signin a {
color: #ffa800;
background-color: white;
}
.nav-signup a {
margin-top: 8px;
font-size: 16px;
font-weight: 600;
font-stretch: normal;
font-style: normal;
letter-spacing: normal;
color: #ffffff;
border-radius: 9px;
border: 0px;
background-color: #ffa800;
}
.nav-signup a:hover {
background-color: #f8c255;
color: white;
}
.footer {
height: 60px;
margin-top: 100px;
padding: 10px 120px 10px 50px;
background-color: #f9a826;
text-align: center;
border-top: 3px solid #f8ae37;
}
.footer a {
font-size: 14px;
margin: 0px 10px;
color: white;
}
.footer img {
float: left;
}

52
src/css/login.css Normal file
View File

@ -0,0 +1,52 @@
@import "core.css";
.wrapper {
max-width: 1024px;
display: grid;
grid-template-areas: "content" "footer";
}
.content {
grid-area: content;
text-align: center;
}
.content input[type=email],
.content input[type=password] {
width: 258px;
height: 53px;
padding: 0px 20px;
margin: 10px 20px;
border-radius: 9px;
font-size: 16px;
border: solid 1px #f9a826;
}
.content input[type=submit] {
width: 258px;
height: 53px;
padding: 0px 20px;
margin: 10px 20px;
font-weight: 600;
border-radius: 9px;
border: 0px;
background-color: rgba(255, 168, 0, 0.6);
color: white;
font-size: 20px;
}
.content input::placeholder {
color: grey;
}
.content label {
font-size: 14px;
}
.content input[type=checkbox] {
border: solid 1px #f9a826;
}
.content a {
color: #f9a826;
font-size: 15px;
}

25
src/index.js Normal file
View File

@ -0,0 +1,25 @@
import './css/login.css';
import React from 'react';
import ReactDOM from 'react-dom';
import LoginPage from './LoginPage.js';
function loadLocaleData(locale) {
switch (locale) {
case 'en':
return import('./lang/es.json')
default:
return import('./lang/es.json')
}
}
async function bootstrapApplication(locale) {
const messages = loadLocaleData(locale)
ReactDOM.render(
<LoginPage locale={locale} messages={messages} />,
document.getElementById('root')
)
}
bootstrapApplication('en')

23
src/lang/en.json Normal file
View File

@ -0,0 +1,23 @@
{
"EMAIL": {
"defaultMessage": "Email"
},
"FORGOT_PASSWORD": {
"defaultMessage": "Forgot Password ?"
},
"LOG_INTO": {
"defaultMessage": "Log Into Your Account"
},
"PASSWORD": {
"defaultMessage": "Password"
},
"REMEMBER_ME": {
"defaultMessage": "Remember me"
},
"SING_IN": {
"defaultMessage": "Sign In"
},
"WELCOME": {
"defaultMessage": "Welcome"
}
}

5
src/lang/es.json Normal file
View File

@ -0,0 +1,5 @@
{
"FORGOT_PASSWORD": {
"defaultMessage": "Olvido Password"
}
}