Skip to content

Commit 6a09246

Browse files
author
Francesca Cella
committed
Refactoring WIP
1 parent db194e3 commit 6a09246

12 files changed

+38
-57
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"bootstrap": "^4.3.1",
77
"react": "^16.12.0",
88
"react-dom": "^16.12.0",
9-
"react-scripts": "3.2.0"
9+
"react-scripts": "^3.4.3"
1010
},
1111
"scripts": {
1212
"start": "react-scripts start",

public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
work correctly both with client-side routing and a non-root public URL.
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
27-
<title>React App</title>
27+
<title>Calendario Turni</title>
2828

2929
</head>
3030
<body>

src/App.css

-22
This file was deleted.

src/App.js

+20-16
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,55 @@
11
import React from 'react';
2-
import './App.css';
32

4-
import CleanTurns from './Components/CleanTurns';
5-
import StreetTurns from "./Components/StreetTurns";
6-
import TrashTurns from "./Components/TrashTurns";
7-
8-
const cleanInitialDate = '2019-11-11'; //data di inizio elenco pulizie, coincide col turno della persona alla posizione 0
9-
const trashInitialDate = '2019-11-01'; //data di inizio primo ciclo dei turni delle pulizie
10-
11-
const curDate = new Date().toISOString().substr(0, 10);
3+
import { CleanTurns, StreetTurns, TrashTurns } from './components';
124

135
class App extends React.Component{
146
constructor(props) {
157
super(props);
168

17-
//inizializzazione dello stato con la data corrente
9+
const cleanInitialDate = '2019-11-11';
10+
const trashInitialDate = '2019-11-01';
11+
12+
const curDate = new Date().toISOString().substr(0, 10);
13+
1814
this.state = {
19-
date: curDate
15+
date: curDate,
16+
curDate,
17+
cleanInitialDate,
18+
trashInitialDate
2019
};
2120
}
2221

2322
dateChanged(event) {
24-
this.setState({date: event.target.value});
23+
this.setState({ date: event.target.value });
2524
}
2625

2726
render() {
2827
return (
2928
<div className="App container">
3029
<div className="row justify-content-center align-items-center">
31-
<div className="jumbotron col-12 wrapper">
30+
<div className="jumbotron col-12 wrapper" align="center">
3231
<h1 className="display-4">Calendario Turni</h1>
3332
<hr className="my-4"/>
3433
<div className="row justify-content-center align-items-center">
3534
<div className="col-md-4">
3635
<p className="lead">Data: </p>
3736
</div>
3837
<div className="col-md-4">
39-
<input type="date" onChange={this.dateChanged.bind(this)} defaultValue={this.state.date} min={curDate}/>
38+
<input
39+
type="date"
40+
onChange={this.dateChanged.bind(this)}
41+
defaultValue={this.state.date}
42+
min={this.state.curDate}
43+
/>
4044
</div>
4145
</div>
4246
</div>
4347
</div>
4448
<div className="row justify-content-center align-items-center">
45-
<TrashTurns date={this.state.date} initialDate={trashInitialDate}/>
49+
<TrashTurns date={this.state.date} initialDate={this.state.trashInitialDate}/>
4650
</div>
4751
<div className="row justify-content-center align-items-center">
48-
<CleanTurns date={this.state.date} initialDate={cleanInitialDate}/>
52+
<CleanTurns date={this.state.date} initialDate={this.state.cleanInitialDate}/>
4953
</div>
5054
<div className="row justify-content-center align-items-center">
5155
<StreetTurns date={this.state.date}/>

src/App.test.js

-9
This file was deleted.

src/Components/CleanTurns.js src/components/CleanTurns.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import data from '../data.json';
2+
import data from '../data/data.json';
33

44
const monday = 1; //primo giorno della settimana, costante per evitare magic numbers
55
const totalPeople = 5; //totale inquilini
@@ -48,4 +48,4 @@ class CleanTurns extends React.Component {
4848
}
4949
}
5050

51-
export default CleanTurns;
51+
export default CleanTurns;

src/Components/StreetTurns.js src/components/StreetTurns.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import data from '../data.json';
2+
import data from '../data/data.json';
33

44
const totalDays = 7;
55

@@ -52,4 +52,4 @@ class StreetTurns extends React.Component {
5252
}
5353
}
5454

55-
export default StreetTurns;
55+
export default StreetTurns;

src/Components/TrashTurns.js src/components/TrashTurns.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import data from '../data.json';
2+
import data from '../data/data.json';
33

44
const timeDivider = 1000 * 60 * 60 * 24; //divisore, indica i giorni trascorsi da una certa data
55
const totalTrash = 5; //totale turni spazzatura
@@ -85,4 +85,4 @@ class TrashTurns extends React.Component {
8585
}
8686
}
8787

88-
export default TrashTurns;
88+
export default TrashTurns;

src/components/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import CleanTurns from './CleanTurns';
2+
import StreetTurns from './StreetTurns';
3+
import TrashTurns from './TrashTurns';
4+
5+
export {
6+
CleanTurns,
7+
StreetTurns,
8+
TrashTurns
9+
};

src/data.json src/data/data.json

File renamed without changes.

src/index.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
body {
22
margin: 0;
3-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
3+
font-family: "Trebuchet MS", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
44
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
55
sans-serif;
66
-webkit-font-smoothing: antialiased;

src/logo.svg

-1
This file was deleted.

0 commit comments

Comments
 (0)