caremyway-client/src/components/User/Client/ClientShifts.jsx

40 lines
910 B
React
Raw Normal View History

2018-04-18 19:05:56 +00:00
import React, { Component } from "react";
import { connect } from "react-redux";
import { Redirect, Link } from "react-router-dom";
import { Button, Container, Header, Segment } from "semantic-ui-react";
class ClientShifts extends Component {
render() {
const { selfUser } = this.props;
if (selfUser.client) {
return <ClientShiftsView user={selfUser} />;
} else {
return <Redirect to="/" />;
}
}
}
function mapStateToProps(state) {
return { selfUser: state.user.selfUser };
}
const ClientShiftsView = ({ user }) => (
<Container>
<Header>Shifts</Header>
<Segment>
<Button
basic
color="green"
size="small"
as={Link}
to="/user/profile/client/add-shift"
>
Schedule a Shift
</Button>
</Segment>
<p>Todo: List Shifts</p>
</Container>
);
export default connect(mapStateToProps)(ClientShifts);