diff --git a/client/src/Dashboard.js b/client/src/Dashboard.js
index cd73f64..0227892 100644
--- a/client/src/Dashboard.js
+++ b/client/src/Dashboard.js
@@ -47,7 +47,7 @@ function Dashboard() {
}, [user, setGroups, csrfToken, setError ]);
const upcomingEvents = groups
- .filter(group => group.nextEvent.date > Date.now());
+ .filter(group => group.nextEvent && group.nextEvent.date > Date.now());
return (
{event.description}
- Next event is occurring on .
+ Next event is occurring on .
{ event.votingBegins === 'day-of' &&
Voting for location begins the day of the event.
diff --git a/client/src/Group.js b/client/src/Group.js
index 54ff70e..871f834 100644
--- a/client/src/Group.js
+++ b/client/src/Group.js
@@ -16,8 +16,9 @@ function Group() {
const { csrfToken, user, setError } = useContext(GlobalContext);
const groupId = useParams().group;
const [ group, setGroup ] = useState(undefined);
+ // eslint-disable-next-line no-unused-vars
const [ events, setEvents ] = useState(null);
- const [ locations, setLocations ] = useState([]);
+ const [ voteItems, setVoteItems ] = useState([]);
useEffect(() => {
if (!user) {
@@ -43,7 +44,7 @@ function Group() {
if (!data) {
return;
}
- setLocations(data);
+ setVoteItems(data);
};
effect();
}, [user, setGroup, groupId, csrfToken, setError]);
@@ -120,9 +121,15 @@ function Group() {
} />
- Locations
- { locations.map(location =>
- ) }
+ Voting
+ { voteItems.map(item =>
+ group.votingType === 'locations'
+ ?
+ :
+ {item.name}
+ { item.note ? {item.note}
: <>> }
+ { item.url ? : <>> }
+ ) }
> }/>
diff --git a/client/src/Location.js b/client/src/Location.js
index b4edc03..a7128fe 100644
--- a/client/src/Location.js
+++ b/client/src/Location.js
@@ -1,6 +1,7 @@
import React, { useState, useEffect, useContext } from "react";
import Paper from '@mui/material/Paper';
-
+import Button from '@mui/material/Button';
+import TextField from '@mui/material/TextField';
import './Location.css';
import { GlobalContext } from "./GlobalContext.js";
@@ -17,8 +18,30 @@ Creating a location:
*/
const CreateLocation = () => {
- return
+ const [ latitude, setLatitude ] = useState('Not set');
+ const [ longitude, setLongitude ] = useState('Not set');
+ return
+ Go to
maps.google.com and
+ find the location you want, selecting the desintation on the map. This
+ updates the URL to include the longitude and latitude.
+ Copy the full URL (CTRL-L, CTRL-A, CTRL-C). Paste the URL here (CTRL-V):
+
+
+ Longitude: {longitude}, Latitude: {latitude}
+ ok
;
}
@@ -123,6 +146,7 @@ function Location(props) {
marginTop: '0.25rem',
marginBottom: '0.25rem'
}}>
+ { }
{ showLocation(location) }
);
diff --git a/client/src/SignIn.js b/client/src/SignIn.js
index 4f68d5d..d4b5bfb 100644
--- a/client/src/SignIn.js
+++ b/client/src/SignIn.js
@@ -85,15 +85,15 @@ export default function SignIn() {
}}
>
- While those familiar with the original Beer App may recall
- an account was not needed to particpate, now that
- the audience is larger, events and contact information for
- those participating are now restricted to only those that
- have verified an email address and created an account
- on Goodtimes.
+ While those familiar with the original Beer App may recall
+ an account was not needed to particpate, now that
+ the audience is larger, events and contact information for
+ those participating are now restricted to only those that
+ have verified an email address and created an account
+ on Goodtimes.
- Contact information is only shared with those that are in
- groups that you join.
+ Contact information is only shared with those that are in
+ groups that you join.
diff --git a/server/event-data.js b/server/event-data.js
index e9df615..8776d15 100644
--- a/server/event-data.js
+++ b/server/event-data.js
@@ -1,3 +1,24 @@
+const moment = require('moment-timezone');
+
+moment.tz.setDefault(process.env.TZ);
+
+const getDayWeeksOut = (day, weeks, time) => {
+ const today = moment().day();
+ if (day >= today) {
+ weeks--;
+ }
+ let date;
+
+ date = moment().day(day);
+ if (weeks) {
+ date = date.add(weeks, 'weeks');
+ }
+ date.set('hours', Math.floor(time));
+ date.set('minutes', Math.round(time * 60 - Math.floor(time) * 60));
+ date.set('seconds', 0);
+ return date.valueOf();
+};
+
const originalEvents = [ {
groupId: 1,
name: 'Thursday Happy Hour',
@@ -5,7 +26,18 @@ const originalEvents = [ {
votingBegins: 'day-of',
votingCloses: '3:00 PM',
description: 'Get together every Thursday with friends for happy hour!',
- date: Date.now() + 86400 * 14 * 1000 /* 2 weeks from now */
+ date: getDayWeeksOut(4, 2, 17.5),
+ votingType: 'locations'
+}, {
+ groupId: 2,
+ name: 'Wednesday Virtual Gaming',
+ event: 'wednesday-virtual-gaming',
+ votingBegins: 'day-of',
+ votingCloses: undefined,
+ description: 'Let\'s play some online games!',
+ date: getDayWeeksOut(3, 1, 19),
+ votingType: 'text'
} ];
+
originalEvents.forEach((item, index) => item.id = index + 1);
module.exports = originalEvents;
\ No newline at end of file
diff --git a/server/group-data.js b/server/group-data.js
index 9e52db5..33cfe62 100644
--- a/server/group-data.js
+++ b/server/group-data.js
@@ -3,10 +3,15 @@ const originalGroups = [ {
ownerId: 1,
name: 'Beer Thirstday',
group: 'beer-thirstday',
+ public: true
+}, {
+ ownerId: 1,
+ name: 'Game Night',
+ group: 'game-night',
+ public: false
} ];
originalGroups[0].nextEvent = originalEvents[0];
-originalEvents.forEach(item => item.groupId = 1);
originalGroups.forEach((item, index) => item.id = index + 1);
module.exports = originalGroups;
\ No newline at end of file
diff --git a/server/package-lock.json b/server/package-lock.json
index 1e31931..34039dd 100644
--- a/server/package-lock.json
+++ b/server/package-lock.json
@@ -24,6 +24,7 @@
"handlebars": "^4.7.7",
"method-override": "^3.0.0",
"moment": "^2.24.0",
+ "moment-timezone": "^0.5.34",
"morgan": "^1.9.1",
"node-fetch": "^2.6.0",
"node-gzip": "^1.1.2",
diff --git a/server/package.json b/server/package.json
index 397efc3..8f4954b 100644
--- a/server/package.json
+++ b/server/package.json
@@ -24,6 +24,7 @@
"handlebars": "^4.7.7",
"method-override": "^3.0.0",
"moment": "^2.24.0",
+ "moment-timezone": "^0.5.34",
"morgan": "^1.9.1",
"node-fetch": "^2.6.0",
"node-gzip": "^1.1.2",