Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Masaki/feature/schedule7 #41

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions langdemy-app/src/components/pages/LessonReady/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class LessonReady extends React.Component {
this.state.count === 0 ? styles.mainBox : styles.mainBoxUnder600
}
>

<div
className={
this.state.user === true
Expand All @@ -98,7 +97,11 @@ class LessonReady extends React.Component {
<Grid container spacing={0}>
<Grid item xs={12} container justify="center">
<Grid item container justify={justify1} xs={12} sm={6}>
<ZoomBox count={this.state.count} isStartTime={this.props.isStartTime} joinUrl = {this.props.joinUrl}/>
<ZoomBox
count={this.state.count}
isStartTime={this.props.isStartTime}
joinUrl={this.props.joinUrl}
/>
</Grid>
<Grid item container justify={justify2} xs={12} sm={6}>
<ScheduleBox count={this.state.count} />
Expand Down
2 changes: 1 addition & 1 deletion langdemy-app/src/components/pages/Schedule/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Calender1 } from "../../parts/schedule/Calender1";
import Calender1 from "../../parts/schedule/Calender1";

class Schedule extends React.Component {
render() {
Expand Down
28 changes: 10 additions & 18 deletions langdemy-app/src/components/parts/schedule/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class Body extends React.Component {
super(props);
this.state = {
classTime: 40,
name: "",
title: "",
startTime: moment().format("YYYY-MM-DDTHH:mm"),
endTime: null,
};

this.classTimeHandleChange = this.classTimeHandleChange.bind(this);
this.datepickerHandleChange = this.datepickerHandleChange.bind(this);
this.nameHandleChange = this.nameHandleChange.bind(this);
this.titleHandleChange = this.titleHandleChange.bind(this);
this.clickDoAction = this.clickDoAction.bind(this);
}

Expand All @@ -33,12 +33,13 @@ class Body extends React.Component {
console.log(e.target.value);
}

nameHandleChange(e) {
titleHandleChange(e) {
this.setState(() => ({
name: e.target.value,
title: e.target.value,
endTime: moment(this.state.startTime)
.add(this.state.classTime, "m")
.format("YYYY-MM-DD-HH:mm"),
}));
console.log(this.state.name);
this.props.appointmentAction();
}

datepickerHandleChange(e) {
Expand All @@ -50,17 +51,8 @@ class Body extends React.Component {
clickDoAction() {
const { appointmentAction } = this.props;
const appointment = this.state;
this.setState(() => ({
endTime: moment(this.state.startTime)
.add(this.state.classTime, "m")
.format("YYYY-MM-DD-HH:mm"),
}));
console.log(this.state);
appointmentAction(appointment);
console.log(this.props.state);
}

componentWillMount() {
this.props.appointmentAction();
}

render() {
Expand Down Expand Up @@ -95,7 +87,7 @@ class Body extends React.Component {
<TextField
label="名前"
style={{ marginLeft: "10px" }}
onChange={this.nameHandleChange}
onChange={this.titleHandleChange}
/>
<Button
variant="outlined"
Expand All @@ -112,7 +104,7 @@ class Body extends React.Component {

const mapStateToProps = (state) => {
return {
state: state.schedule.classTime,
state: state.schedule.endTime,
};
};

Expand Down
35 changes: 18 additions & 17 deletions langdemy-app/src/components/parts/schedule/Calender1.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,7 @@ class Calender1 extends React.Component {
this.test = this.test.bind(this);
this.state = {
isOpen: false,
events: [
{
start: moment().toDate(),
end: moment().add(1, "days").toDate(),
title: "Some title",
},
{
start: moment().toDate(),
end: moment().add(1, "days").toDate(),
title: "Some title",
},
],
events: this.props.state,
};
}

Expand All @@ -52,10 +41,23 @@ class Calender1 extends React.Component {
test() {
const { appointmentAction } = this.props;
appointmentAction();
console.log(this.props);
console.log(moment("2021-02-20T07:07").utc().format());
console.log(moment("2021-02-22T07:07").utc().format());
console.log(this.props.state);
}

render() {
console.log("bbbbbbbbbbbbbbbbbb");
console.log(this.props.state);
const eventlist = this.props.state
.filter((event) => event)
.map((event) => ({
...event,
start: new Date(event.startTime),
end: moment(event.endTime).utc().format(),
}));
console.log(eventlist);
// console.log(eventlist[0].end);
return (
<div>
<div className={styles.wrapperBox}>
Expand All @@ -76,6 +78,7 @@ class Calender1 extends React.Component {
<Button variant="outlined" className={styles.button}>
キャンセル
</Button>
<p></p>
<Modal
open={this.state.isOpen}
onClose={this.handleClose}
Expand All @@ -89,7 +92,7 @@ class Calender1 extends React.Component {
localizer={localizer}
defaultDate={new Date()}
defaultView="month"
events={this.state.events}
events={eventlist}
style={{ height: "90vh" }}
/>
</div>
Expand All @@ -99,7 +102,7 @@ class Calender1 extends React.Component {

const mapStateToProps = (state) => {
return {
state: state,
state: state.schedule.reserveList,
};
};

Expand All @@ -111,5 +114,3 @@ const mapDispatchToProps = (dispatch) => {
};

export default connect(mapStateToProps, mapDispatchToProps)(Calender1);

export { Calender1 };
7 changes: 7 additions & 0 deletions langdemy-app/src/components/parts/schedule/test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";

const test = () => {
return <div></div>;
};

export default test;
4 changes: 2 additions & 2 deletions langdemy-app/src/reducks/schedule/schedule.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const reducer = (state = initialState.schedule, action) => {
case SCHEDULE_APPOINTMENT:
console.log(state);
return {
...state,
...action.payload,
state,
reserveList: state.reserveList.concat([action.payload]),
};
default:
return state;
Expand Down
13 changes: 5 additions & 8 deletions langdemy-app/src/reducks/store/initialState.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ const initialState = {
email: "",
password: "",
},
lessonReady: {
isStartTime: false,
joinUrl: "",
},
schedule: {
classTime: null,
name: "",
startTime: null,
endTime: null,
lessonReady: {
isStartTime: false,
joinUrl: "",
},
reserveList: [],
},
};

Expand Down
Loading