Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]164 project search functionality fixed #214

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ddf3c08
Extract Container from index.js to pages' components
mattwr18 Feb 11, 2019
6a3392f
Refactor Subscriptions.js to mapDispatchToProps
mattwr18 Feb 25, 2019
3790a2b
Add events info page
aonomike Feb 23, 2019
6d41529
git commit to resolve merge issues
nataliyah123 Apr 25, 2019
bfd45aa
Add EventInfo and EventSummary Components
aonomike Feb 24, 2019
947ace4
Add sign up link to navbar
mattwr18 Feb 25, 2019
b93d806
Add cypress integration test for projects info page (#95)
mattwr18 Mar 5, 2019
2ba2dca
resolve subscriptions
nataliyah123 Apr 26, 2019
135182a
adding missing files in rebasing
nataliyah123 Apr 26, 2019
04e91e0
rebasing develop
nataliyah123 Apr 26, 2019
23f73e8
rebasing 2
nataliyah123 Apr 26, 2019
8532c6f
rebasing 5
nataliyah123 Apr 26, 2019
8922b9b
remove if something goes wrong 1
nataliyah123 Apr 26, 2019
33465f7
Configure webpack for .env
mattwr18 Feb 25, 2019
66042ad
Add routing and links to the page
aonomike Mar 2, 2019
1fbfd28
missing createProjectPage.js
nataliyah123 Apr 26, 2019
0f6ea3f
redoing everything v1
nataliyah123 Apr 25, 2019
5a2ef73
commit 2
nataliyah123 Apr 26, 2019
feaaace
ding dong
nataliyah123 Apr 26, 2019
7ec50d5
re saving index.js
nataliyah123 Apr 26, 2019
8457094
action reducer again
nataliyah123 Apr 25, 2019
76f66b6
again
nataliyah123 Apr 25, 2019
3ea9971
check if something goes wrong
nataliyah123 Apr 25, 2019
13a6190
random files
nataliyah123 Apr 26, 2019
5d70e2b
made the requested changes
nataliyah123 Apr 28, 2019
c9e98d3
Merge branch 'develop' into 164-project-search-functionality-fixed
nataliyah123 Apr 28, 2019
afe4821
Update getEventInfoAction.js~
nataliyah123 Apr 30, 2019
9468320
Update package.json~
nataliyah123 Apr 30, 2019
c34fcec
Update App.js~
nataliyah123 Apr 30, 2019
a86a79d
Update EventInfo.js~
nataliyah123 Apr 30, 2019
3b8c1af
Update EventSummary.js~
nataliyah123 Apr 30, 2019
e95d313
Update UsersList.js~
nataliyah123 Apr 30, 2019
d6623b1
Update eventInfo.js~
nataliyah123 Apr 30, 2019
90be464
Update EventSummary.test.js~
nataliyah123 Apr 30, 2019
4096153
Update index.js~
nataliyah123 Apr 30, 2019
40d03e3
Update yarn.lock
nataliyah123 Apr 30, 2019
c851b9e
Rename src/components/navbar/Navbar.css to src/assets/Navbar.css
nataliyah123 Apr 30, 2019
e8d6b4d
Rename src/components/navbar/Navbar.js to src/components/Navbar.js
nataliyah123 Apr 30, 2019
4b6106a
Update App.js
nataliyah123 Apr 30, 2019
e273f11
Merge branch 'develop' into 164-project-search-functionality-fixed
nataliyah123 Apr 30, 2019
348660e
Delete App.js~
nataliyah123 Apr 30, 2019
1a5d957
Update Navbar.js
nataliyah123 Apr 30, 2019
ed3d4eb
Update Navbar.js
nataliyah123 Apr 30, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cypress/integration/journey.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ Feature: Journey test
Then I should see a calendar with events
When I click on an event in the calendar
Then I should see the event's info

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"dependencies": {
"axios": "^0.18.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"connected-react-router": "^6.4.0",
"dotenv-webpack": "^1.7.0",
"global": "^4.3.2",
"izitoast": "^1.4.0",
Expand Down
103 changes: 103 additions & 0 deletions package.json~
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"name": "WebsiteOne-FE",
"version": "1.0.0",
"description": "Front end for WebsiteOne",
"main": "index.js",
"repository": "[email protected]:AgileVentures/WebsiteOne-FE.git",
"author": "AgileVentures",
"license": "MIT",
"scripts": {
"start": "webpack-dev-server --mode development --open",
"start-test-server": "webpack-dev-server --mode development --port 8082",
"build": "webpack --mode production",
"fix": "standard --fix",
"test": "export NODE_ENV=testing && standard && jest",
"windows-test": "set NODE_ENV=testing&& standard && jest",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"cypress:ci": "cypress run",
"cypress:local": "cypress open --config baseUrl=http://localhost:8082",
"cypress:install": "cypress install",
"e2e:local": "start-server-and-test start-test-server http://localhost:8082 cypress:local",
"e2e:ci": "npm-run-all --parallel --race start:ci 'cypress:ci --config baseUrl=http://localhost:8082'",
"start:ci": "webpack-dev-server --config ./webpack.config.js --port 8082 --mode production",
"now-build": "yarn build"
},
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true
},
"dependencies": {
"axios": "^0.18.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"dotenv-webpack": "^1.7.0",
"global": "^4.3.2",
"izitoast": "^1.4.0",
"moment-timezone": "^0.5.23",
"moment-with-locales-es6": "^1.0.1",
"query-string": "^6.2.0",
"react": "16.8.0",
"react-big-calendar": "^0.20.3",
"react-cookie": "^3.0.8",
"react-datepicker": "^2.1.0",
"react-dom": "16.8.0",
"react-html-parser": "^2.0.2",
"react-loading-overlay": "^1.0.1",
"react-redux": "^6.0.0",
"react-router-dom": "^4.3.1",
"react-select": "^2.3.0",
"react-spinners": "^0.5.1",
"react-stripe-checkout": "^2.6.3",
"recompose": "^0.30.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"semantic-ui-react": "^0.84.0",
"url": "^0.11.0"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-loader": "7",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"coveralls": "^3.0.2",
"css-loader": "^2.0.1",
"cypress": "^3.1.5",
"cypress-cucumber-preprocessor": "^1.9.1",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"eslint-plugin-react-hooks": "^1.0.1",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^23.6.0",
"jest-transform-css": "^2.0.0",
"mini-css-extract-plugin": "^0.5.0",
"moxios": "^0.4.0",
"node-sass": "^4.11.0",
"npm-run-all": "^4.1.5",
"redux-mock-store": "^1.5.3",
"regenerator-runtime": "^0.13.1",
"sass-loader": "^7.1.0",
"standard": "^12.0.1",
"start-server-and-test": "^1.7.11",
"style-loader": "^0.23.1",
"url-loader": "^1.1.2",
"webpack": "^4.27.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
},
"standard": {
"parser": "babel-eslint",
"ignore": [
"src/assets/*"
],
"env": [
"jest"
],
"globals": [
"cy"
]
}
}
31 changes: 31 additions & 0 deletions src/actions/getEventInfoAction.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import axios from 'axios'
import { GET_PROJECT_INFO } from '../types'

export let fetchEventInfo = slug => dispatch => {
return axios
.get(`/api/v1/events/${slug}`)
.then(response => {
let {
event,
videos,
creator,
creatorGravatarUrl,
createdAt,
modifier,
modifierGravatarUrl,
updatedAt,
nextScheduledEvent
} = response.data
event.videos = videos
event.creator = creator
event.creatorGravatarUrl = creatorGravatarUrl
event.modifier = modifier
event.modifierGravatarUrl = modifierGravatarUrl
event.createdAt = createdAt
event.updatedAt = updatedAt
event.nextScheduledEvent = nextScheduledEvent

dispatch({ type: GET_EVENT_INFO, payload: event })
})
}

15 changes: 15 additions & 0 deletions src/actions/userSearchResultAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { SELECTED_LANGUAGE, FILTERED_PROJECTS_STATE } from '../types'

export let selectedLanguageAction = selectedLanguage => {
return {
type: SELECTED_LANGUAGE,
payload: selectedLanguage
}
}

export let filteredProjectsAction = props => {
return {
type: FILTERED_PROJECTS_STATE,
payload: props
}
}
74 changes: 74 additions & 0 deletions src/components/EventSummary.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React, { Fragment } from 'react'
import { Header, Segment, Grid, Image, Icon } from 'semantic-ui-react'
import CustomRingLoader from './CustomRingLoader'
import Videos from './Videos'
import ReactHtmlParser from 'react-html-parser'
import moment from 'moment-timezone'

const EventSummary = props => {
let { event } = props
if (event) {
let startTime = moment(event.start_datetime)
let endTime = startTime.clone().add(Number(event.duration), 'minutes')
let timeRange = `${startTime.format('HH:mm')} - ${endTime.format('HH:mm')} ${moment.tz.guess()}`
return (
<Fragment>
<Grid columns={2} stackable>
<Grid.Column width={12}>
<Segment vertical>
<Header as='h2'>{event.name}</Header>
</Segment>
<Segment padded='very' vertical>
<Header as='h5'>{ReactHtmlParser(event.description)}</Header>
</Segment>
<Segment padded='very' vertical>
<p>Event type: {event.category}</p>
<p>Event for: {event.for}</p>
</Segment>
<Segment padded='very' vertical>
<Grid columns={2} stackable>
<Grid.Column width={8}>
{event.nextScheduledEvent
? <Fragment>
<Header as='h5'>Next scheduled event:</Header>
<Icon name='calendar plus outline' size='large' />
{moment(event.nextScheduledEvent.time).format('MMMM Do YYYY')}
<br />
<br />
</Fragment>
: null}
<Icon name='clock outline' size='large' />
{timeRange}
</Grid.Column>
<Grid.Column width={8}>
<Grid columns={2} stackable>
<Grid.Column>
<Image src={event.creatorGravatarUrl} circular />
<p>created by:</p>
<p>{event.creator}</p>
</Grid.Column>
<Grid.Column>
{event.modifier
? (
<Fragment>
<Image src={event.modifierGravatarUrl} circular />
<p>updated by:</p>
<p>{event.modifier}</p>
</Fragment>
) : null}
</Grid.Column>
</Grid>
</Grid.Column>
</Grid>
</Segment>
</Grid.Column>
<Videos name={event} id='event-info-videos' />
</Grid>
</Fragment>
)
} else {
return <CustomRingLoader />
}
}

export default EventSummary
30 changes: 13 additions & 17 deletions src/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,26 @@ import { Link } from 'react-router-dom'
import { withRouter } from 'react-router'
import logo from '../images/av-logo.svg'
import queryString from 'query-string'

import '../assets/Navbar.css'

export class Navbar extends Component {
state = { showHamburgerMenu: false, isLoggedIn: false }

componentDidMount () {
const parsed = queryString.parse(this.props.location.search)
if (parsed.token) {
this.props.cookies.set(process.env.SESSION || 'WebsiteOne_session', parsed.token, {
path: '/'
})
this.setState({ isLoggedIn: true })
state = { showHamburgerMenu: false, isLoggedIn: false }
componentDidMount () {
const parsed = queryString.parse(this.props.location.search)
if (parsed.token) {
this.props.cookies.set(process.env.SESSION || 'WebsiteOne_session', parsed.token, {
path: '/'
})
this.setState({ isLoggedIn: true })
}
}
}

currentPath () {
currentPath () {
// this.props.location.split("/") returns ["", ""] when on homepage
// and ["", "users", "123"] when on /users/123
// This function is used to highlight the nav link
const pathArray = this.props.location.pathname.split('/')
return pathArray[1]
}
const pathArray = this.props.location.pathname.split('/')
return pathArray[1]
}

handleRemoveCookies = () => {
this.setState({ isLoggedIn: false })
Expand Down Expand Up @@ -74,7 +71,6 @@ export class Navbar extends Component {
<Menu.Item name='events' active={activeItem === 'events'}>
<Link to='/events'>Events</Link>
</Menu.Item>

<Menu.Item
name='getting-started'
active={activeItem === 'getting-started'}
Expand Down
44 changes: 44 additions & 0 deletions src/containers/EventInfo.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { fetchEventInfo } from '../actions/getEventInfoAction'
import { setLastLocation } from '../actions/setLastLocationAction'
import { Container } from 'semantic-ui-react'
import EventSummary from '../components/EventSummary'

export class EventInfo extends Component {
state = { event: null };

componentDidMount () {
const eventSlug = this.props.match.params.slug
this.props.setLastLocation(this.props.location.pathname)
if (this.props.event.slug === this.props.match.params.slug) {
this.setState({ event: this.props.event })
} else {
this.props.fetchEventInfo(eventSlug)
}
}

componentWillReceiveProps (nextProps) {
if (this.props.event !== nextProps.event) {
this.setState({ event: nextProps.event })
}
}

render () {
let { event } = this.state
return (
<Container className='event-info-container'>
<EventSummary event={event} />
</Container>
)
}
}

const mapStateToProps = (state, ownProps) => ({
events: state.event,
event: state.eventInfo
})
export default connect(
mapStateToProps,
{ fetchEventInfo, setLastLocation }
)(EventInfo)
Loading