Merge pull request #6 from Reckless-Satoshi/initialize-frontend-and-create-first-pages

Initialize frontend, create React app, routing, urls and preliminary make order page.
This commit is contained in:
Reckless_Satoshi 2022-01-02 00:46:52 +00:00 committed by GitHub
commit 9335e6abbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 4278 additions and 4 deletions

1
.gitignore vendored
View File

@ -637,3 +637,4 @@ FodyWeavers.xsd
# Django
*migrations*
frontend/static/frontend*

View File

@ -1,4 +1,4 @@
from rest_framework import generics, status
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
@ -10,7 +10,7 @@ from .models import Order
class MakeOrder(APIView):
serializer_class = MakeOrderSerializer
def post(self,request, format=None):
def post(self,request):
serializer = self.serializer_class(data=request.data)
print(serializer)

0
frontend/__init__.py Normal file
View File

3
frontend/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
frontend/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class FrontendConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'frontend'

View File

@ -0,0 +1,14 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "10"
}
}
],
"@babel/preset-react"
],
"plugins": ["@babel/plugin-proposal-class-properties"]
}

3
frontend/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

2988
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

29
frontend/package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "frontend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack --mode development --watch",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"@babel/preset-react": "^7.16.7",
"babel-loader": "^8.2.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"react-router-dom": "^5.2.0"
}
}

View File

@ -0,0 +1,21 @@
import React, { Component } from "react";
import { render } from "react-dom";
import HomePage from "./HomePage";
export default class App extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<HomePage />
</div>
);
}
}
const appDiv = document.getElementById("app");
render(<App />, appDiv);

View File

@ -0,0 +1,11 @@
import React, { Component } from "react";
export default class BookPage extends Component {
constructor(props) {
super(props);
}
render() {
return <p>This is the order book page</p>;
}
}

View File

@ -0,0 +1,31 @@
import React, { Component } from "react";
import { BrowserRouter as Router, Switch, Route, Link, Redirect } from "react-router-dom";
import NickGenPage from "./NickGenPage";
import LoginPage from "./LoginPage.js";
import MakerPage from "./MakerPage";
import BookPage from "./BookPage";
import OrderPage from "./OrderPage";
import WaitingRoomPage from "./WaitingRoomPage";
export default class HomePage extends Component {
constructor(props) {
super(props);
}
render() {
return (
<Router >
<Switch>
<Route exact path='/' component={NickGenPage}/>
<Route path='/home'><p>You are at the start page</p></Route>
<Route path='/login'component={LoginPage}/>
<Route path='/make' component={MakerPage}/>
<Route path='/book' component={BookPage}/>
<Route path='/order' component={OrderPage}/>
<Route path='/wait' component={WaitingRoomPage}/>
</Switch>
</Router>
);
}
}

View File

@ -0,0 +1,11 @@
import React, { Component } from "react";
export default class LoginPage extends Component {
constructor(props) {
super(props);
}
render() {
return <p>This is the login page</p>;
}
}

View File

@ -0,0 +1,263 @@
import React, { Component } from 'react';
import { Button , Grid, Typography, TextField, Select, FormHelperText, MenuItem, FormControl, Radio, FormControlLabel, RadioGroup, Menu} from "@material-ui/core"
import { Link } from 'react-router-dom'
function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
const csrftoken = getCookie('csrftoken');
export default class MakerPage extends Component {
defaultCurrency = 1;
defaultCurrencyCode = 'USD';
defaultAmount = 0 ;
defaultPremium = 0;
constructor(props) {
super(props);
this.state={
isExplicit: false,
type: 0,
currency: this.defaultCurrency,
currencyCode: this.defaultCurrencyCode,
amount: this.defaultAmount,
premium: 0,
satoshis: null,
}
}
handleTypeChange=(e)=>{
this.setState({
type: e.target.value,
});
}
handleCurrencyChange=(e)=>{
var code = (e.target.value == 1 ) ? "USD": ((e.target.value == 2 ) ? "EUR":"ETH")
this.setState({
currency: e.target.value,
currencyCode: code,
});
}
handleAmountChange=(e)=>{
this.setState({
amount: e.target.value,
});
}
handlePremiumChange=(e)=>{
this.setState({
premium: e.target.value,
});
}
handleSatoshisChange=(e)=>{
this.setState({
satoshis: e.target.value,
});
}
handleClickRelative=(e)=>{
this.setState({
isExplicit: false,
satoshis: null,
premium: 0,
});
}
handleClickExplicit=(e)=>{
this.setState({
isExplicit: true,
satoshis: 10000,
premium: null,
});
}
handleCreateOfferButtonPressed=()=>{
console.log(this.state)
const requestOptions = {
method: 'POST',
headers: {'Content-Type':'application/json', 'X-CSRFToken': csrftoken},
body: JSON.stringify({
type: this.state.type,
currency: this.state.currency,
amount: this.state.amount,
premium: this.state.premium,
satoshis: this.state.satoshis,
}),
};
fetch("/api/make/",requestOptions)
.then((response) => response.json())
.then((data) => console.log(data));
}
render() {
return (
<Grid container spacing={1}>
<Grid item xs={12} align="center">
<Typography component="h4" variant="h4">
Make an Order
</Typography>
</Grid>
<Grid item xs={12} align="center">
<FormControl component="fieldset">
<FormHelperText>
<div align='center'>
Choose Buy or Sell Bitcoin
</div>
</FormHelperText>
<RadioGroup row defaultValue="0" onChange={this.handleTypeChange}>
<FormControlLabel
value="0"
control={<Radio color="primary"/>}
label="Buy"
labelPlacement="Top"
/>
<FormControlLabel
value="1"
control={<Radio color="secondary"/>}
label="Sell"
labelPlacement="Top"
/>
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={12} align="center">
<FormControl >
<FormHelperText>
<div align='center'>
Select Payment Currency
</div>
</FormHelperText>
<Select
require={true}
defaultValue={this.defaultCurrency}
inputProps={{
style: {textAlign:"center"}
}}
onChange={this.handleCurrencyChange}
>
<MenuItem value={1}>USD</MenuItem>
<MenuItem value={2}>EUR</MenuItem>
<MenuItem value={3}>ETH</MenuItem>
</Select>
</FormControl>
</Grid>
<Grid item xs={12} align="center">
<FormControl >
<FormHelperText>
<div align='center'>
Amount of Fiat to Trade
</div>
</FormHelperText>
<TextField
type="number"
require={true}
defaultValue={this.defaultAmount}
inputProps={{
min:0 ,
style: {textAlign:"center"}
}}
onChange={this.handleAmountChange}
/>
</FormControl>
</Grid>
<Grid item xs={12} align="center">
<FormHelperText >
<div align='center'>
Choose a pricing method
</div>
</FormHelperText>
<FormControl component="fieldset">
<RadioGroup row defaultValue="relative">
<FormControlLabel
value="relative"
control={<Radio color="primary"/>}
label="Relative"
labelPlacement="Top"
onClick={this.handleClickRelative}
/>
<FormControlLabel
value="explicit"
control={<Radio color="secondary"/>}
label="Explicit"
labelPlacement="Top"
onClick={this.handleClickExplicit}
onShow="false"
/>
</RadioGroup>
</FormControl>
</Grid>
{/* conditional shows either Premium % field or Satoshis field based on pricing method */}
{ this.state.isExplicit
? <Grid item xs={12} align="center">
<FormControl >
<FormHelperText>
<div align='center'>
Explicit Amount in Satoshis
</div>
</FormHelperText>
<TextField
type="number"
require={true}
inputProps={{
min:10000 ,
style: {textAlign:"center"}
}}
onChange={this.handleSatoshisChange}
defaultValue={this.defaultSatoshis}
/>
</FormControl>
</Grid>
: <Grid item xs={12} align="center">
<FormControl >
<FormHelperText>
<div align='center'>
Premium Relative to Market Price (%)
</div>
</FormHelperText>
<TextField
type="number"
require={true}
defaultValue={this.defaultPremium}
inputProps={{
style: {textAlign:"center"}
}}
onChange={this.handlePremiumChange}
/>
</FormControl>
</Grid>
}
<Grid item xs={12} align="center">
<Typography component="subtitle2" variant="subtitle2">
<div align='center'>
Create a BTC {this.state.type==0 ? "buy":"sell"} order for {this.state.amount} {this.state.currencyCode}
{this.state.isExplicit ? " of " + this.state.satoshis + " Satoshis" :
(this.state.premium == 0 ? " at market price" :
(this.state.premium > 0 ? " at a " + this.state.premium + "% premium":" at a " + -this.state.premium + "% discount")
)
}
</div>
</Typography>
<Button color="primary" variant="contained" onClick={this.handleCreateOfferButtonPressed}>
Create Order
</Button>
</Grid>
<Grid item xs={12} align="center">
<Button color="secondary" variant="contained" to="/" component={Link}>
Back
</Button>
</Grid>
</Grid>
);
}
}

View File

@ -0,0 +1,11 @@
import React, { Component } from "react";
export default class NickGenPage extends Component {
constructor(props) {
super(props);
}
render() {
return <p>This is the landing and user generator page</p>;
}
}

View File

@ -0,0 +1,11 @@
import React, { Component } from "react";
export default class OrderPage extends Component {
constructor(props) {
super(props);
}
render() {
return <p>This is the single order detail view page</p>;
}
}

View File

@ -0,0 +1,11 @@
import React, { Component } from "react";
export default class WaitingRoomPage extends Component {
constructor(props) {
super(props);
}
render() {
return <p>This is the waiting room</p>;
}
}

1
frontend/src/index.js Normal file
View File

@ -0,0 +1 @@
import App from "./components/App";

View File

@ -0,0 +1,20 @@
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
#main {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
#app {
width: 100%;
height: 100%;
display: flex;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,727 @@
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*!*******************************!*\
!*** ./src/components/App.js ***!
\*******************************/
/*!************************************!*\
!*** ./src/components/BookPage.js ***!
\************************************/
/*!************************************!*\
!*** ./src/components/HomePage.js ***!
\************************************/
/*!*************************************!*\
!*** ./node_modules/react/index.js ***!
\*************************************/
/*!*************************************!*\
!*** ./src/components/LoginPage.js ***!
\*************************************/
/*!*************************************!*\
!*** ./src/components/MakerPage.js ***!
\*************************************/
/*!*************************************!*\
!*** ./src/components/OrderPage.js ***!
\*************************************/
/*!***************************************!*\
!*** ./node_modules/isarray/index.js ***!
\***************************************/
/*!***************************************!*\
!*** ./src/components/NickGenPage.js ***!
\***************************************/
/*!****************************************!*\
!*** ./node_modules/react-is/index.js ***!
\****************************************/
/*!*****************************************!*\
!*** ./node_modules/react-dom/index.js ***!
\*****************************************/
/*!*****************************************!*\
!*** ./node_modules/scheduler/index.js ***!
\*****************************************/
/*!******************************************!*\
!*** ./node_modules/clsx/dist/clsx.m.js ***!
\******************************************/
/*!******************************************!*\
!*** ./node_modules/jss/dist/jss.esm.js ***!
\******************************************/
/*!******************************************!*\
!*** ./node_modules/prop-types/index.js ***!
\******************************************/
/*!*******************************************!*\
!*** ./src/components/WaitingRoomPage.js ***!
\*******************************************/
/*!*********************************************!*\
!*** ./node_modules/history/esm/history.js ***!
\*********************************************/
/*!*********************************************!*\
!*** ./node_modules/object-assign/index.js ***!
\*********************************************/
/*!**********************************************!*\
!*** ./node_modules/path-to-regexp/index.js ***!
\**********************************************/
/*!***************************************************!*\
!*** ./node_modules/is-in-browser/dist/module.js ***!
\***************************************************/
/*!****************************************************!*\
!*** ./node_modules/hyphenate-style-name/index.js ***!
\****************************************************/
/*!*****************************************************!*\
!*** ./node_modules/value-equal/esm/value-equal.js ***!
\*****************************************************/
/*!*******************************************************!*\
!*** ./node_modules/@material-ui/system/esm/merge.js ***!
\*******************************************************/
/*!*******************************************************!*\
!*** ./node_modules/react-router/esm/react-router.js ***!
\*******************************************************/
/*!********************************************************!*\
!*** ./node_modules/css-vendor/dist/css-vendor.esm.js ***!
\********************************************************/
/*!********************************************************!*\
!*** ./node_modules/react/cjs/react.production.min.js ***!
\********************************************************/
/*!*********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Grid/Grid.js ***!
\*********************************************************/
/*!*********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Grow/Grow.js ***!
\*********************************************************/
/*!*********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/List/List.js ***!
\*********************************************************/
/*!*********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Menu/Menu.js ***!
\*********************************************************/
/*!*********************************************************!*\
!*** ./node_modules/@material-ui/system/esm/memoize.js ***!
\*********************************************************/
/*!*********************************************************!*\
!*** ./node_modules/@material-ui/system/esm/spacing.js ***!
\*********************************************************/
/*!**********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/colors/red.js ***!
\**********************************************************/
/*!**********************************************************!*\
!*** ./node_modules/@material-ui/utils/esm/deepmerge.js ***!
\**********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Input/Input.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Modal/Modal.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Paper/Paper.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Radio/Radio.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/colors/blue.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/colors/grey.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/@material-ui/core/esm/colors/pink.js ***!
\***********************************************************/
/*!***********************************************************!*\
!*** ./node_modules/react-transition-group/esm/config.js ***!
\***********************************************************/
/*!************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***!
\************************************************************/
/*!************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/colors/green.js ***!
\************************************************************/
/*!************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/shape.js ***!
\************************************************************/
/*!************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/setRef.js ***!
\************************************************************/
/*!************************************************************!*\
!*** ./node_modules/tiny-warning/dist/tiny-warning.esm.js ***!
\************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Button/Button.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Portal/Portal.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Select/Select.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/colors/common.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/colors/indigo.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/colors/orange.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/zIndex.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/@material-ui/system/esm/breakpoints.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/prop-types/factoryWithThrowingShims.js ***!
\*************************************************************/
/*!*************************************************************!*\
!*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
\*************************************************************/
/*!**************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/shadows.js ***!
\**************************************************************/
/*!**************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/debounce.js ***!
\**************************************************************/
/*!**************************************************************!*\
!*** ./node_modules/react-is/cjs/react-is.production.min.js ***!
\**************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/InputBase/utils.js ***!
\***************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Popover/Popover.js ***!
\***************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/SvgIcon/SvgIcon.js ***!
\***************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/useTheme.js ***!
\***************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/react-router-dom/esm/react-router-dom.js ***!
\***************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/react-transition-group/esm/Transition.js ***!
\***************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/resolve-pathname/esm/resolve-pathname.js ***!
\***************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/List/ListContext.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/capitalize.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/useForkRef.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/react-dom/cjs/react-dom.production.min.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/scheduler/cjs/scheduler.production.min.js ***!
\****************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/tiny-invariant/dist/tiny-invariant.esm.js ***!
\****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/ButtonBase/Ripple.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/ListItem/ListItem.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/MenuItem/MenuItem.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/MenuList/MenuList.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/withStyles.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/transitions/utils.js ***!
\*****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/ownerWindow.js ***!
\*****************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Modal/ModalManager.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Select/SelectInput.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/createTheme.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/transitions.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/isMuiElement.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/mini-create-react-context/dist/esm/index.js ***!
\******************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/react-router/node_modules/react-is/index.js ***!
\******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FormGroup/FormGroup.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FormLabel/FormLabel.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/InputBase/InputBase.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/TextField/TextField.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/internal/SwitchBase.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/createMixins.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/defaultTheme.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/createSvgIcon.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/ownerDocument.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/useControlled.js ***!
\*******************************************************************/
/*!*******************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/useTheme/useTheme.js ***!
\*******************************************************************/
/*!********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Modal/SimpleBackdrop.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/createPalette.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/createSpacing.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/unstable_useId.js ***!
\********************************************************************/
/*!********************************************************************!*\
!*** ./node_modules/react-transition-group/esm/TransitionGroup.js ***!
\********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/ButtonBase/ButtonBase.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/IconButton/IconButton.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/InputLabel/InputLabel.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Radio/RadioButtonIcon.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/RadioGroup/RadioGroup.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Typography/Typography.js ***!
\*********************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/jssPreset/jssPreset.js ***!
\*********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/ButtonBase/TouchRipple.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/getScrollbarSize.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/useEventCallback.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/ThemeProvider/nested.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/@material-ui/utils/esm/formatMuiErrorMessage.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/jss-plugin-global/dist/jss-plugin-global.esm.js ***!
\**********************************************************************/
/*!**********************************************************************!*\
!*** ./node_modules/jss-plugin-nested/dist/jss-plugin-nested.esm.js ***!
\**********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FilledInput/FilledInput.js ***!
\***********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FormControl/FormControl.js ***!
\***********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/colorManipulator.js ***!
\***********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/createTypography.js ***!
\***********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/useIsFocusVisible.js ***!
\***********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/makeStyles/makeStyles.js ***!
\***********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/useTheme/ThemeContext.js ***!
\***********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/withStyles/withStyles.js ***!
\***********************************************************************/
/*!***********************************************************************!*\
!*** ./node_modules/react-transition-group/esm/utils/ChildMapping.js ***!
\***********************************************************************/
/*!************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/RadioGroup/useRadioGroup.js ***!
\************************************************************************/
/*!************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/styles/createBreakpoints.js ***!
\************************************************************************/
/*!*************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js ***!
\*************************************************************************/
/*!*************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/NativeSelect/NativeSelect.js ***!
\*************************************************************************/
/*!*************************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/makeStyles/indexCounter.js ***!
\*************************************************************************/
/*!**************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js ***!
\**************************************************************************/
/*!**************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FormControl/useFormControl.js ***!
\**************************************************************************/
/*!**************************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/makeStyles/multiKeyStore.js ***!
\**************************************************************************/
/*!***************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/OutlinedInput/OutlinedInput.js ***!
\***************************************************************************/
/*!***************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/utils/createChainedFunction.js ***!
\***************************************************************************/
/*!***************************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/mergeClasses/mergeClasses.js ***!
\***************************************************************************/
/*!***************************************************************************!*\
!*** ./node_modules/react-transition-group/esm/TransitionGroupContext.js ***!
\***************************************************************************/
/*!****************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js ***!
\****************************************************************************/
/*!****************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FormControl/formControlState.js ***!
\****************************************************************************/
/*!****************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/OutlinedInput/NotchedOutline.js ***!
\****************************************************************************/
/*!****************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/RadioGroup/RadioGroupContext.js ***!
\****************************************************************************/
/*!****************************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/getStylesCreator/noopTheme.js ***!
\****************************************************************************/
/*!*****************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FormHelperText/FormHelperText.js ***!
\*****************************************************************************/
/*!*****************************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/getThemeProps/getThemeProps.js ***!
\*****************************************************************************/
/*!*****************************************************************************!*\
!*** ./node_modules/hoist-non-react-statics/node_modules/react-is/index.js ***!
\*****************************************************************************/
/*!******************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FormControl/FormControlContext.js ***!
\******************************************************************************/
/*!******************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/NativeSelect/NativeSelectInput.js ***!
\******************************************************************************/
/*!******************************************************************************!*\
!*** ./node_modules/jss-plugin-camel-case/dist/jss-plugin-camel-case.esm.js ***!
\******************************************************************************/
/*!******************************************************************************!*\
!*** ./node_modules/jss-plugin-props-sort/dist/jss-plugin-props-sort.esm.js ***!
\******************************************************************************/
/*!*******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***!
\*******************************************************************************/
/*!*******************************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/StylesProvider/StylesProvider.js ***!
\*******************************************************************************/
/*!********************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/internal/svg-icons/ArrowDropDown.js ***!
\********************************************************************************/
/*!*********************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***!
\*********************************************************************************/
/*!*********************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/FormControlLabel/FormControlLabel.js ***!
\*********************************************************************************/
/*!*********************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/TextareaAutosize/TextareaAutosize.js ***!
\*********************************************************************************/
/*!**********************************************************************************!*\
!*** ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js ***!
\**********************************************************************************/
/*!**********************************************************************************!*\
!*** ./node_modules/jss-plugin-default-unit/dist/jss-plugin-default-unit.esm.js ***!
\**********************************************************************************/
/*!***********************************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/getStylesCreator/getStylesCreator.js ***!
\***********************************************************************************/
/*!*************************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/Unstable_TrapFocus/Unstable_TrapFocus.js ***!
\*************************************************************************************/
/*!*************************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/internal/svg-icons/RadioButtonChecked.js ***!
\*************************************************************************************/
/*!***************************************************************************************!*\
!*** ./node_modules/@material-ui/core/esm/internal/svg-icons/RadioButtonUnchecked.js ***!
\***************************************************************************************/
/*!****************************************************************************************!*\
!*** ./node_modules/jss-plugin-vendor-prefixer/dist/jss-plugin-vendor-prefixer.esm.js ***!
\****************************************************************************************/
/*!****************************************************************************************!*\
!*** ./node_modules/react-router/node_modules/react-is/cjs/react-is.production.min.js ***!
\****************************************************************************************/
/*!************************************************************************************************!*\
!*** ./node_modules/jss-plugin-rule-value-function/dist/jss-plugin-rule-value-function.esm.js ***!
\************************************************************************************************/
/*!*************************************************************************************************!*\
!*** ./node_modules/@material-ui/styles/esm/createGenerateClassName/createGenerateClassName.js ***!
\*************************************************************************************************/
/*!***************************************************************************************************!*\
!*** ./node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js ***!
\***************************************************************************************************/

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Robosats</title>
{% load static %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<link rel="stylesheet" type="text/css" href="{% static "css/index.css" %}"
/>
</head>
<body>
<div id="main">
<div id="app"></div>
</div>
<script src="{% static "frontend/main.js" %}"></script>
</body>
</html>

3
frontend/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

12
frontend/urls.py Normal file
View File

@ -0,0 +1,12 @@
from django.urls import path
from .views import index
urlpatterns = [
path('', index),
path('home/', index),
path('login/', index),
path('make/', index),
path('book/', index),
path('order/', index),
path('wait/', index),
]

6
frontend/views.py Normal file
View File

@ -0,0 +1,6 @@
from django.shortcuts import render
# Create your views here.
def index(request, *args, **kwargs):
return render(request, 'frontend/index.html')

View File

@ -0,0 +1,32 @@
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "./static/frontend"),
filename: "[name].js",
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
],
},
optimization: {
minimize: true,
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
// This has effect on the react lib size
NODE_ENV: JSON.stringify("production"),
},
}),
],
};

View File

@ -39,6 +39,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'rest_framework',
'api',
'frontend.apps.FrontendConfig',
]
MIDDLEWARE = [

View File

@ -19,4 +19,5 @@ from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('api.urls')),
path('', include('frontend.urls'))
]

View File

@ -7,11 +7,14 @@
`pip install virtualenvwrapper`
### Add to .bashrc
`export WORKON_HOME=$HOME/.virtualenvs
```
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=' -p /usr/bin/python3 '
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh`
source /usr/local/bin/virtualenvwrapper.sh
```
### Reload startup file
`source ~/.bashrc`
@ -26,3 +29,32 @@ source /usr/local/bin/virtualenvwrapper.sh`
`pip3 install django djangorestframework`
*Django 4.0 at the time of writting*
### Launch the local development node
```
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py runserver
```
## React development environment
### Install npm
`sudo apt install npm`
No need to repeat, this is the list of npm packages we use
```
cd frontend
npm init -y
npm i webpack webpack-cli --save-dev
npm i @babel/core babel-loader @babel/preset-env @babel/preset-react --save-dev
npm i react react-dom --save-dev
npm install @material-ui/core
npm install @babel/plugin-proposal-class-properties
npm install react-router-dom@5.2.0
npm install @material-ui/icons
```
### Launch the React render
from frontend/ directory
`npm run dev`