Skip to content

Commit

Permalink
merged kim and ben branch
Browse files Browse the repository at this point in the history
  • Loading branch information
kimberlyzhu committed Jul 23, 2020
2 parents 8d72287 + 5e290aa commit d3d5ea7
Show file tree
Hide file tree
Showing 5 changed files with 425 additions and 24 deletions.
Binary file added .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
name="description"
content="Web site created using create-react-app"
/>
<meta
name="google-signin-client_id"
content="272589905349-scqfilok0ucok40j6h6eo9pcsp7bhadd.apps.googleusercontent.com"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
Expand Down Expand Up @@ -40,5 +44,6 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script async defer src="https://apis.google.com/js/api.js"></script>
</body>
</html>
74 changes: 66 additions & 8 deletions src/calendar/connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import MyCalendar from "../pages/Moment";
import styled from "@emotion/styled";
import "react-big-calendar/lib/css/react-big-calendar.css";
// const getter = require("express");
<<<<<<< HEAD

import logo from "../pages/img/meetingGroundLogo.png";
import { Link } from "react-router-dom";
=======
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee

//yarn add @types/gapi
//yarn add @types/gapi.auth2
Expand All @@ -17,6 +20,11 @@ const ConnectPage = () => {
const [isSigned, setIsSigned] = useState(false);
const [name, setName] = useState("");
const [picUrl, setPicUrl] = useState("");
<<<<<<< HEAD
=======
const [access_token, setAccessToken] = useState("");
const [refreshToken, setRefreshToken] = useState("");
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee
const [email, setEmail] = useState("");
const [fname, setFname] = useState("");
const [lname, setLname] = useState("");
Expand Down Expand Up @@ -78,6 +86,10 @@ const ConnectPage = () => {
.grantOfflineAccess()
.then(function (response: any) {
gapi.auth2.getAuthInstance().signIn();
<<<<<<< HEAD
=======
setRefreshToken(response.code);
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee
if (response["code"]) {
// Hide the sign-in button now that the user is authorized, for example:
setAuthorizeButton("none");
Expand Down Expand Up @@ -123,7 +135,15 @@ const ConnectPage = () => {
function updateSigninStatus(isSignedIn: boolean) {
if (isSignedIn) {
setAuthorizeButton("none");
<<<<<<< HEAD
setSignoutButton("");
=======
setSignoutButton("block");
setAccessToken(
gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse()
.access_token
);
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee
setIsSigned(true);
setName(
gapi.auth2
Expand Down Expand Up @@ -173,7 +193,11 @@ const ConnectPage = () => {
setFname("");
setLname("");
setEmail("");
<<<<<<< HEAD
setAuthorizeButton("");
=======
setAuthorizeButton("block");
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee
setSignoutButton("none");
}
}
Expand Down Expand Up @@ -216,15 +240,23 @@ const ConnectPage = () => {
.then(function (response: any) {
const events: any[] = response.result.items;
const appointments = response.result.items;
for (let j = 0; j < appointments.length; j++) {
appointments[j].start = moment
.utc(appointments[j].start.dateTime)
.toDate();
appointments[j].end = moment
.utc(appointments[j].end.dateTime)
.toDate();
if (appointments.length > 0) {
for (let j = 0; j < appointments.length; j++) {
appointments[j].start = moment
.utc(appointments[j].start.dateTime)
.toDate();
appointments[j].end = moment
.utc(appointments[j].end.dateTime)
.toDate();
// appointments[j].start = moment
// .utc(appointments[j].end.dateTime)
// .toDate();
// appointments[j].end = moment
// .utc(appointments[j].start.dateTime)
// .toDate();
}
setMyEvents(appointments);
}
setMyEvents(appointments);

//setMyEvents(events);
// debugger;
Expand Down Expand Up @@ -300,6 +332,7 @@ const ConnectPage = () => {
`;

return (
<<<<<<< HEAD
<body style={{ background: "rgba(131, 196, 197)" }}>
<div style={{ padding: "1rem" }}>
<TopFormat>
Expand All @@ -317,6 +350,31 @@ const ConnectPage = () => {
>
Main Page
</h1>
=======
<div style={{ padding: "1rem" }}>
<div>
<img id="logo" src="./logo.png" alt="Meeting Ground Logo" />
<h1>Welcome to Meeting Ground</h1>
<h2>Where Meetings hit the Ground</h2>
<small>Main Page</small>
</div>
<div>
<button
id="authorize_button"
onClick={handleAuthClick}
style={{ display: authorizeButton }}
>
Sign in
</button>
<button
id="signout_button"
onClick={handleSignoutClick}
style={{ display: signoutButton }}
>
Sign Out
</button>
</div>
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee

<button
className="btn btn-primary"
Expand Down
84 changes: 84 additions & 0 deletions src/pages/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ import setSeconds from "date-fns/setSeconds";
import setMinutes from "date-fns/setMinutes";
import setHours from "date-fns/setHours";

<<<<<<< HEAD
import logo from "./img/meetingGroundLogo.png";

=======
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee
import Redirect, { withRouter } from "react-router-dom";
interface SignUpPagePropsInterface extends RouteComponentProps<{ id: string }> {
// Other props that belong to component it self not Router
Expand Down Expand Up @@ -125,7 +128,11 @@ const SignUpPage: React.FC<SignUpPagePropsInterface> = (
const [startTime, setStartTime] = useState<Date>(
setHours(setMinutes(new Date(), 30), 16)
);
<<<<<<< HEAD
//const [interval, setInterval] = useState(45);
=======
const [userEmail, setUserEmail] = useState("");
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee

let handleColor = (time: any) => {
return time.getHours() > 12 ? "text-success" : "text-error";
Expand All @@ -146,6 +153,7 @@ const SignUpPage: React.FC<SignUpPagePropsInterface> = (

const [selectTime, setSelect] = useState(false);
function handleSubmit(e: any) {
<<<<<<< HEAD
e.preventDefault();

//result contains the selected time + date
Expand All @@ -163,6 +171,29 @@ const SignUpPage: React.FC<SignUpPagePropsInterface> = (

props.history.push("/submit-info/" + id + "/" + result.toString());
// return <Redirect to="/404" />;
=======
if (!selectTime) {
window.alert("Date is not selected");
} else {
e.preventDefault();

//result contains the selected time + date
let result = new Date();

result.setTime(startTime.getTime()); //note time includes the month/date/year
result.setDate(startDate.getDate());
result.setMonth(startDate.getMonth());
result.setFullYear(startDate.getFullYear());

let main = startDate;
console.log(main);

console.log("result is: " + result);

props.history.push("/submit-info/" + id + "/" + result.toString());
// return <Redirect to="/404" />;
}
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee
}

function IntervalSetup() {
Expand All @@ -175,6 +206,7 @@ const SignUpPage: React.FC<SignUpPagePropsInterface> = (
) : error ? (
<div>An Error occurred: {error}</div>
) : (
<<<<<<< HEAD
<body style={{ background: "rgba(131, 196, 197)" }}>
<div style={{ padding: "1rem" }}>
<TopFormat>
Expand Down Expand Up @@ -250,16 +282,68 @@ const SignUpPage: React.FC<SignUpPagePropsInterface> = (
</MainBodyFormat>
</div>
</body>
=======
<div className="form-group">
<form onSubmit={handleSubmit}>
<DatePicker
// showTimeSelect
selected={startDate}
onChange={(date: Date) => {
setStartDate(date);
let key =
date.getFullYear().toString() +
"-" +
date.getMonth().toString() +
"-" +
date.getDate().toString();
console.log("mykey: " + key);
setExcludeTimeList(excludeTimeDictionary[key]);
//excludeTimeList = excludeTimeDictionary[key];
console.log(excludeTimeList);
setSelect(true);
}}
timeFormat="HH:mm"
timeIntervals={data.link.duration}
inline
/>
{selectTime && (
<DatePicker
showTimeSelect
showTimeSelectOnly
selected={startTime}
onChange={(date: Date) => setStartTime(date)}
timeFormat="HH:mm"
timeIntervals={data.link.duration}
excludeTimes={excludeTimeList}
inline
/>
)}
<div className="form-group">
<button type="submit" className="btn btn-primary">
Select Date
</button>
</div>
</form>
</div>
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee
);
}

//interval = IntervalSetup() > 0 ? IntervalSetup() : 45;

return (
<ApolloProvider client={client}>
<<<<<<< HEAD
{/* <SignUpServer /> */}

<IntervalSetup />
=======
<SignUpServer />

<CalendarCard>
<IntervalSetup />
</CalendarCard>
>>>>>>> 5e290aad4694490d73463338b54ad183b1d639ee
{/* <CalendarCard>
<MyCalendar myList={temp} />
</CalendarCard> */}
Expand Down
Loading

0 comments on commit d3d5ea7

Please sign in to comment.