-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from DaleMcGrew/Dale_WC_Nov21-2024
Added first draft Person & Team Actions/Stores. Moved AppObservableStore out of the common folder. Added TeamMembers page stub. Added `WECONNECT_NAME_FOR_BROWSER_TAB_TITLE` to config-template.
- Loading branch information
Showing
19 changed files
with
324 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Dispatcher from '../common/dispatcher/Dispatcher'; | ||
|
||
export default { | ||
personRetrieve (personId = '') { | ||
// console.log('PersonActions, personRetrieve personId:', personId); | ||
if (personId) { | ||
Dispatcher.loadEndpoint('person-retrieve', { | ||
personId, | ||
}); | ||
} else { | ||
Dispatcher.loadEndpoint('person-retrieve'); | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Dispatcher from '../common/dispatcher/Dispatcher'; | ||
|
||
export default { | ||
teamRetrieve (teamId = '') { | ||
// console.log('TeamActions, teamRetrieve teamId:', teamId); | ||
if (teamId) { | ||
Dispatcher.loadEndpoint('team-retrieve', { | ||
teamId, | ||
}); | ||
} else { | ||
Dispatcher.loadEndpoint('team-retrieve'); | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import React from 'react'; | ||
import { Helmet } from 'react-helmet-async'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@mui/styles'; | ||
import AppObservableStore, { messageService } from '../stores/AppObservableStore'; | ||
import TeamActions from '../actions/TeamActions'; | ||
import TeamStore from '../stores/TeamStore'; | ||
import { PageContentContainer } from '../components/Style/pageLayoutStyles'; | ||
import webAppConfig from '../config'; | ||
|
||
|
||
const TeamMembers = ({ match }) => { // classes, teamId | ||
const [teamId, setTeamId] = React.useState(-1); | ||
const [teamMemberList, setTeamMemberList] = React.useState([]); | ||
const [teamMemberCount, setTeamMemberCount] = React.useState(0); | ||
|
||
const onAppObservableStoreChange = () => { | ||
}; | ||
|
||
const onTeamStoreChange = () => { | ||
const teamMemberListTemp = TeamStore.getTeamMemberList(teamId); | ||
setTeamMemberList(teamMemberListTemp); | ||
setTeamMemberCount(teamMemberListTemp.length); | ||
}; | ||
|
||
React.useEffect(() => { | ||
const { params: { | ||
teamId: teamIdIncoming, | ||
} } = match; | ||
setTeamId(teamIdIncoming); | ||
|
||
console.log('Fetching team members for:', teamIdIncoming); | ||
const appStateSubscription = messageService.getMessage().subscribe(() => onAppObservableStoreChange()); | ||
onAppObservableStoreChange(); | ||
const teamStoreListener = TeamStore.addListener(onTeamStoreChange); | ||
onTeamStoreChange(); | ||
|
||
TeamActions.teamRetrieve(teamIdIncoming); | ||
|
||
return () => { | ||
appStateSubscription.unsubscribe(); | ||
teamStoreListener.remove(); | ||
}; | ||
}, []); | ||
|
||
const pigsCanFly = false; | ||
return ( | ||
<div> | ||
<Helmet> | ||
<title> | ||
Team Members - | ||
{' '} | ||
{webAppConfig.WECONNECT_NAME_FOR_BROWSER_TAB_TITLE} | ||
</title> | ||
<link rel="canonical" href={`${webAppConfig.WECONNECT_URL_FOR_SEO}/team-members`} /> | ||
</Helmet> | ||
<PageContentContainer> | ||
Team Members ( | ||
{teamMemberCount} | ||
) | ||
{pigsCanFly && ( | ||
<SearchBarWrapper>Team Members will fly here</SearchBarWrapper> | ||
)} | ||
</PageContentContainer> | ||
</div> | ||
); | ||
}; | ||
TeamMembers.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
// teamId: PropTypes.number.isRequired, | ||
match: PropTypes.object.isRequired, | ||
}; | ||
|
||
const styles = () => ({ | ||
buttonDesktop: { | ||
padding: '2px 16px', | ||
borderRadius: 5, | ||
}, | ||
searchButton: { | ||
borderRadius: 50, | ||
}, | ||
}); | ||
|
||
const SearchBarWrapper = styled('div')` | ||
// margin-top: 14px; | ||
// margin-bottom: 8px; | ||
width: 100%; | ||
`; | ||
|
||
export default withStyles(styles)(TeamMembers); |
12 changes: 6 additions & 6 deletions
12
src/js/common/stores/AppObservableStore.js → src/js/stores/AppObservableStore.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.