From 81a6210c58b5a7f881fd58cdccc567c281b0918c Mon Sep 17 00:00:00 2001 From: William Ray Noble Jr Date: Wed, 1 Jul 2020 12:07:04 -0400 Subject: [PATCH 1/7] made homepage arrow redirect to group page url --- api/accounts/models.py | 1 + api/trip/models.py | 2 +- api/trip/urls.py | 2 +- client/src/components/GroupCard/GroupCard.js | 2 +- client/src/components/GroupPage/GroupPage.css | 7 ++++++ client/src/components/GroupPage/GroupPage.js | 24 +++++++++++++++++++ .../components/GroupPage/GroupPage.stories.js | 2 ++ .../components/GroupPage/GroupPage.test.js | 0 .../UpcomingTripsCard/UpcomingTripsCard.js | 1 + client/src/pages/HomePage/HomePage.js | 2 +- .../MemberProfilePage/MemberProfilePage.js | 2 -- 11 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 client/src/components/GroupPage/GroupPage.css create mode 100644 client/src/components/GroupPage/GroupPage.js create mode 100644 client/src/components/GroupPage/GroupPage.stories.js create mode 100644 client/src/components/GroupPage/GroupPage.test.js diff --git a/api/accounts/models.py b/api/accounts/models.py index 5edec4954..e77c4045b 100644 --- a/api/accounts/models.py +++ b/api/accounts/models.py @@ -40,6 +40,7 @@ class Profile(models.Model): 'community.Event', related_name='people', null=True, blank=True) connections = models.ManyToManyField( 'self', related_name='friends', null=True, blank=True) + # Posts, comments, and replies to be defined as foreign key on those respective models within forum app # CoTrip media defined as foreign key in community app diff --git a/api/trip/models.py b/api/trip/models.py index 6a9df1c98..0fff13478 100644 --- a/api/trip/models.py +++ b/api/trip/models.py @@ -33,7 +33,7 @@ class Trip(models.Model): start_date = models.DateField() end_date = models.DateField() imageURLs = models.CharField(max_length=500, null=True,blank=True) - + def __str__(self): return self.name diff --git a/api/trip/urls.py b/api/trip/urls.py index 11317c7de..5546d070a 100644 --- a/api/trip/urls.py +++ b/api/trip/urls.py @@ -18,5 +18,5 @@ path('activity', ActivityList.as_view(), name='activity_list'), path('location/bystate', LocationListByState.as_view(), name='location_list_by_state'), path('location/states', StateList.as_view(), name='state_list'), - path('activity/', ActivityDetail.as_view(), name='activity_detail') + path('activity/', ActivityDetail.as_view(), name='activity_detail'), ] diff --git a/client/src/components/GroupCard/GroupCard.js b/client/src/components/GroupCard/GroupCard.js index 155faa6cc..8580d1135 100644 --- a/client/src/components/GroupCard/GroupCard.js +++ b/client/src/components/GroupCard/GroupCard.js @@ -7,7 +7,7 @@ const GroupCard = props => { let { picture, name, members, location } = props; return ( - +

{name}

diff --git a/client/src/components/GroupPage/GroupPage.css b/client/src/components/GroupPage/GroupPage.css new file mode 100644 index 000000000..7d8bdfbeb --- /dev/null +++ b/client/src/components/GroupPage/GroupPage.css @@ -0,0 +1,7 @@ +.wrapper { + text-align: center; +} + +h1{ + display: inline-block; +} \ No newline at end of file diff --git a/client/src/components/GroupPage/GroupPage.js b/client/src/components/GroupPage/GroupPage.js new file mode 100644 index 000000000..6a7586a84 --- /dev/null +++ b/client/src/components/GroupPage/GroupPage.js @@ -0,0 +1,24 @@ +import React from 'react'; +import './GroupPage.css'; +import { link } from 'react-router-dom'; +import GroupCard from "../GroupCard/GroupCard"; +import Navbar from '../Navbar/Navbar'; +import Banner from '../Banner/Banner'; +import Footer from '../Footer/Footer'; + +const GroupPage = props => { + return( +
+ + +
+

Groups You Can Join!

+
+ + ({ ...location, pathname: "/courses" })} /> //needs to be figured out +
+
+ ) +} + +export default GroupPage \ No newline at end of file diff --git a/client/src/components/GroupPage/GroupPage.stories.js b/client/src/components/GroupPage/GroupPage.stories.js new file mode 100644 index 000000000..100ad4ca0 --- /dev/null +++ b/client/src/components/GroupPage/GroupPage.stories.js @@ -0,0 +1,2 @@ +import React from "react"; +import { storiesOf } from "@storybook/react"; \ No newline at end of file diff --git a/client/src/components/GroupPage/GroupPage.test.js b/client/src/components/GroupPage/GroupPage.test.js new file mode 100644 index 000000000..e69de29bb diff --git a/client/src/components/UpcomingTripsCard/UpcomingTripsCard.js b/client/src/components/UpcomingTripsCard/UpcomingTripsCard.js index 041885455..c24a90ae3 100644 --- a/client/src/components/UpcomingTripsCard/UpcomingTripsCard.js +++ b/client/src/components/UpcomingTripsCard/UpcomingTripsCard.js @@ -5,6 +5,7 @@ import Card from "../Card/Card"; import TripCard from "../TripCard/TripCard"; const UpcomingTripsCard = props => { + return (
Upcoming Trips
diff --git a/client/src/pages/HomePage/HomePage.js b/client/src/pages/HomePage/HomePage.js index 286593764..d4c8b7942 100644 --- a/client/src/pages/HomePage/HomePage.js +++ b/client/src/pages/HomePage/HomePage.js @@ -108,7 +108,7 @@ const HomePage = props => { - +

Suggested People

diff --git a/client/src/pages/MemberProfilePage/MemberProfilePage.js b/client/src/pages/MemberProfilePage/MemberProfilePage.js index 160f36039..2719a53fb 100644 --- a/client/src/pages/MemberProfilePage/MemberProfilePage.js +++ b/client/src/pages/MemberProfilePage/MemberProfilePage.js @@ -69,8 +69,6 @@ class MemberProfilePage extends Component { } - - // Runs after a component has been updated componentDidUpdate() {} From 3f2fc5246d77d5166395ff784f762b3b21ab3f73 Mon Sep 17 00:00:00 2001 From: William Ray Noble Jr Date: Thu, 2 Jul 2020 16:15:23 -0400 Subject: [PATCH 2/7] created a group page which lists all groups --- Pipfile | 11 +++++ client/src/App.js | 8 ++++ client/src/components/GroupCard/GroupCard.js | 2 +- client/src/components/GroupPage/GroupPage.css | 3 +- client/src/components/GroupPage/GroupPage.js | 43 ++++++++++++++----- client/src/pages/HomePage/HomePage.js | 2 +- 6 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 Pipfile diff --git a/Pipfile b/Pipfile new file mode 100644 index 000000000..b5846df18 --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] + +[requires] +python_version = "3.8" diff --git a/client/src/App.js b/client/src/App.js index 5b4f55f5c..b35942317 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -39,6 +39,7 @@ import { fas } from "@fortawesome/free-solid-svg-icons"; import { far } from "@fortawesome/free-regular-svg-icons"; import { BASE_URL } from "./services/constants"; import { handleSignup, handleLogin, handleLogout } from "./services/User"; +import GroupPage from "./components/GroupPage/GroupPage" library.add( fab, @@ -253,6 +254,13 @@ class App extends Component { )} > + ( + + )} + >
); diff --git a/client/src/components/GroupCard/GroupCard.js b/client/src/components/GroupCard/GroupCard.js index 8580d1135..155faa6cc 100644 --- a/client/src/components/GroupCard/GroupCard.js +++ b/client/src/components/GroupCard/GroupCard.js @@ -7,7 +7,7 @@ const GroupCard = props => { let { picture, name, members, location } = props; return ( - +

{name}

Suggested People

From fc49f1157c3959f6102a8099d0bf5138a00cc1a2 Mon Sep 17 00:00:00 2001 From: William Ray Noble Jr Date: Mon, 6 Jul 2020 12:53:30 -0400 Subject: [PATCH 3/7] working on directory group page --- .../pages/DirectoryPage/DirectoryGroups.js | 364 ++++++++---------- .../MemberProfilePage/MemberProfilePage.js | 2 +- 2 files changed, 167 insertions(+), 199 deletions(-) diff --git a/client/src/pages/DirectoryPage/DirectoryGroups.js b/client/src/pages/DirectoryPage/DirectoryGroups.js index 182ddb84b..20078325e 100644 --- a/client/src/pages/DirectoryPage/DirectoryGroups.js +++ b/client/src/pages/DirectoryPage/DirectoryGroups.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { Component } from "react"; import "./DirectoryGroups.css"; import NavBar from "../../components/Navbar/Navbar"; import people from "assets/images/profile_default.svg"; @@ -14,223 +14,191 @@ import picture1 from "../../assets/images/card_small1.png"; import picture2 from "../../assets/images/card_small2.png"; import picture3 from "../../assets/images/card_small3.png"; import Card from "../../components/Card/Card"; +import { BASE_URL } from '../../services/constants'; +import axios from "axios"; function pillClick(val) { console.log(val); } // Page or -const DirectoryGroups = props => { - return ( -
- - -

Directory: My Groups

- -
-
+class DirectoryGroups extends Component { + constructor(props) { + super(props) + this.state = { + groups: [] + } + } -
-
Sort By: Location
-
-
-
-
Group Location:
-
-
- - - - - {" "} - {" "} - - - - { + console.log(response) + this.setState({ + groups: response.data + }) + }) + .catch(error => { + console.log('Error while fetching and parsing API request', error); + }) + } + + render() { + console.log(this.state.groups) + const groups = this.state.groups ? this.state.groups : []; + return ( +
+ + +

Directory: My Groups

+ -
{" "} - See More -
-
Groups in WASHINGTON, DC:
+ + -
-
- + +
+
Sort By: Location
+
+
+
+
Group Location:
-
- + + -
{" "} -
- -
-
- -
{" "} -
- -
-
- {" "} + {" "} + -
{" "} -
- -
-
- -
-
-
{" "} -
- {" "} - - Discover New Groups - {" "} + See More +
+
Groups in WASHINGTON, DC:
+
+
+ {groups.map(group =>{ + return( +
+ +
+ ) + }) } + +
{" "} +
+ {" "} + + Discover New Groups + {" "} +
+ See All
- See All -
-
-
- ); +
+ + ); + } }; -export default DirectoryGroups; +export default DirectoryGroups; \ No newline at end of file diff --git a/client/src/pages/MemberProfilePage/MemberProfilePage.js b/client/src/pages/MemberProfilePage/MemberProfilePage.js index 2719a53fb..17c17ba57 100644 --- a/client/src/pages/MemberProfilePage/MemberProfilePage.js +++ b/client/src/pages/MemberProfilePage/MemberProfilePage.js @@ -217,7 +217,7 @@ class MemberProfilePage extends Component {
- +
From 5eb90997811bdbfb83f908a90cc723359b7fcd49 Mon Sep 17 00:00:00 2001 From: William Ray Noble Jr Date: Tue, 7 Jul 2020 14:24:46 -0400 Subject: [PATCH 4/7] updating --- client/src/pages/DirectoryPage/DirectoryGroups.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/src/pages/DirectoryPage/DirectoryGroups.js b/client/src/pages/DirectoryPage/DirectoryGroups.js index 20078325e..f5e666182 100644 --- a/client/src/pages/DirectoryPage/DirectoryGroups.js +++ b/client/src/pages/DirectoryPage/DirectoryGroups.js @@ -33,7 +33,6 @@ class DirectoryGroups extends Component { componentDidMount() { axios.get(`${BASE_URL}/groups`) .then(response => { - console.log(response) this.setState({ groups: response.data }) @@ -44,7 +43,6 @@ class DirectoryGroups extends Component { } render() { - console.log(this.state.groups) const groups = this.state.groups ? this.state.groups : []; return (
@@ -173,12 +171,16 @@ class DirectoryGroups extends Component {
{groups.map(group =>{ + let memberLength = 1; + if (memberLength > 1){ + + } return(
From 592264f81f46af3047dfcf99065c7bd39c2c03d5 Mon Sep 17 00:00:00 2001 From: William Ray Noble Jr Date: Tue, 7 Jul 2020 14:26:23 -0400 Subject: [PATCH 5/7] issue two --- client/src/pages/DirectoryPage/DirectoryGroups.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/pages/DirectoryPage/DirectoryGroups.js b/client/src/pages/DirectoryPage/DirectoryGroups.js index f5e666182..5aa5a0840 100644 --- a/client/src/pages/DirectoryPage/DirectoryGroups.js +++ b/client/src/pages/DirectoryPage/DirectoryGroups.js @@ -172,8 +172,8 @@ class DirectoryGroups extends Component {
{groups.map(group =>{ let memberLength = 1; - if (memberLength > 1){ - + if (memberLength){ + const memberLength = group.members.length; } return(
From 6e5dbe5f4bcf9cb125d76147a334f4ba731bac52 Mon Sep 17 00:00:00 2001 From: William Ray Noble Jr Date: Tue, 7 Jul 2020 15:33:36 -0400 Subject: [PATCH 6/7] need to pull from develop --- client/src/pages/DirectoryPage/DirectoryGroups.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/src/pages/DirectoryPage/DirectoryGroups.js b/client/src/pages/DirectoryPage/DirectoryGroups.js index 5aa5a0840..8537b56e3 100644 --- a/client/src/pages/DirectoryPage/DirectoryGroups.js +++ b/client/src/pages/DirectoryPage/DirectoryGroups.js @@ -43,6 +43,7 @@ class DirectoryGroups extends Component { } render() { + console.log(this.state) const groups = this.state.groups ? this.state.groups : []; return (
@@ -182,23 +183,25 @@ class DirectoryGroups extends Component { members={memberLength} location={group.location} picture={picture1} + id={group.id} /> -
+
) - }) } -
{" "} + }) + } +
{" "} Discover New Groups - {" "} +
See All
- +
); } }; From 77fb404af131e9265d21f9db3a5a4acbf05cdc9e Mon Sep 17 00:00:00 2001 From: William Ray Noble Jr Date: Tue, 7 Jul 2020 15:51:00 -0400 Subject: [PATCH 7/7] fixed backend problem with serializer --- api/community/serializers.py | 2 +- client/src/pages/DirectoryPage/DirectoryGroups.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/community/serializers.py b/api/community/serializers.py index 96e0398ea..3446e8083 100644 --- a/api/community/serializers.py +++ b/api/community/serializers.py @@ -4,7 +4,7 @@ class GroupSerializer(serializers.ModelSerializer): class Meta: model = Group - fields = '__all__' + fields = ['title', 'description', 'location', 'posts', 'members'] class EventSerializer(serializers.ModelSerializer): group = serializers.CharField() diff --git a/client/src/pages/DirectoryPage/DirectoryGroups.js b/client/src/pages/DirectoryPage/DirectoryGroups.js index 8537b56e3..c7a3f6366 100644 --- a/client/src/pages/DirectoryPage/DirectoryGroups.js +++ b/client/src/pages/DirectoryPage/DirectoryGroups.js @@ -172,6 +172,7 @@ class DirectoryGroups extends Component {
{groups.map(group =>{ + console.log(group) let memberLength = 1; if (memberLength){ const memberLength = group.members.length; @@ -187,7 +188,6 @@ class DirectoryGroups extends Component { />
) - }) }