feat: redirect login to proper route, navigation with Seek component on year pages
This commit is contained in:
@@ -1,8 +1,34 @@
|
||||
import React, { Component } from "react";
|
||||
import styled from "@emotion/styled";
|
||||
import { withTheme } from "emotion-theming";
|
||||
import { addDays, subDays, format, isAfter, startOfYesterday } from "date-fns";
|
||||
|
||||
import { SIZES } from "../../../styles/constants";
|
||||
|
||||
import Seek from "../../Seek";
|
||||
|
||||
const JournalHeading = styled.h2`
|
||||
font-weight: 700;
|
||||
font-size: ${SIZES.tiny};
|
||||
color: ${props => props.theme.colors.secondary};
|
||||
margin-top: ${SIZES.medium};
|
||||
`;
|
||||
const JournalEntryArea = styled.textarea`
|
||||
flex-grow: 1;
|
||||
color: ${props => props.theme.colors.primary};
|
||||
background-color: transparent;
|
||||
line-height: 1.5;
|
||||
letter-spacing: 0.5px;
|
||||
width: 100%;
|
||||
border: none;
|
||||
resize: none;
|
||||
outline: none;
|
||||
font-size: ${SIZES.small};
|
||||
&::placeholder {
|
||||
color: ${props => props.theme.colors.tertiary};
|
||||
}
|
||||
`;
|
||||
|
||||
class Day extends Component {
|
||||
render() {
|
||||
const {
|
||||
@@ -15,16 +41,18 @@ class Day extends Component {
|
||||
if (!currentDay) return;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<>
|
||||
<Seek
|
||||
title={format(currentDay, "YYYY MMM DD")}
|
||||
prev={format(subDays(currentDay, 1), "/YYYY/MM/DD")}
|
||||
next={format(addDays(currentDay, 1), "/YYYY/MM/DD")}
|
||||
disableNext={isAfter(currentDay, startOfYesterday())}
|
||||
/>
|
||||
</div>
|
||||
<JournalHeading>WHAT'S HAPPENED TODAY?</JournalHeading>
|
||||
<JournalEntryArea placeholder="Start writing..." />
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Day;
|
||||
export default withTheme(Day);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { Component } from "react";
|
||||
import { withRouter, Link } from "react-router-dom";
|
||||
import { format } from "date-fns";
|
||||
|
||||
import { FirebaseContext } from "../../firebase";
|
||||
|
||||
@@ -30,7 +31,7 @@ class LoginFormBase extends Component {
|
||||
.doSignInWithEmailAndPassword(email, password)
|
||||
.then(() => {
|
||||
this.setState({ email: "", password: "", error: null });
|
||||
this.props.history.push("/home");
|
||||
this.props.history.push(format(new Date(), "/YYYY/MM/DD"));
|
||||
})
|
||||
.catch(error => {
|
||||
this.setState({ error });
|
||||
|
||||
Reference in New Issue
Block a user