Skip to content

Commit

Permalink
Merge pull request #124 from JAVACAFE-STUDY/develop
Browse files Browse the repository at this point in the history
Develop to Master
  • Loading branch information
rygh4775 authored Oct 12, 2019
2 parents 8c82813 + 5a819c1 commit f957b7b
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 60 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chainity-web",
"version": "0.8.2",
"version": "0.8.3",
"description": "Chainity web",
"private": true,
"license": "UNLICENSED",
Expand Down
53 changes: 28 additions & 25 deletions src/main/webapp/app/pages/events/event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,37 +170,38 @@ const stateParamToParam = (param: IEventListParam) => {
const searchBar = (classes, { changeEvent, enterEvent, clickSearch, state: { isRequest } }) => {
return (
<Paper className={ classes.search.root } elevation={ 1 }>
<FormControl fullWidth>
<Input
className={ classes.search.input }
placeholder=" 이벤트 검색 키워드를 입력해주세요. "
onChange={ changeEvent }
onKeyUp={ enterEvent }
disabled={isRequest}
endAdornment={
<IconButton className={ classes.search.iconButton } aria-label="Search">
{
isRequest
? <CircularProgress size={23} />
: <SearchIcon onClick={ clickSearch }/>
}
</IconButton>
}
/>
</FormControl>
<FormControl fullWidth>
<Input
className={ classes.search.input }
placeholder=" 이벤트 검색 키워드를 입력해주세요. "
onChange={ changeEvent }
onKeyUp={ enterEvent }
disabled={ isRequest }
endAdornment={
<IconButton className={ classes.search.iconButton } aria-label="Search">
{
isRequest
? <CircularProgress size={ 23 }/>
: <SearchIcon onClick={ clickSearch }/>
}
</IconButton>
}
/>
</FormControl>

</Paper>
);
};

const listItem = (classes, { event, index }, calcDate) => {
return (
<Link to={ { pathname: `/event/detail/${ event._id }`, search: `id=${event._id}` } } key={ index } className={ classes.listItemLink }>
<Link to={ { pathname: `/event/detail/${ event._id }`, search: `id=${event._id}` } } key={ index }
className={ classes.listItemLink }>
<Card className={ classes.listItem }>
<Typography component="p" className={ classes.listItemTitle }>
{ event.title }
</Typography>
<Typography className={ classes.listItemContent } component="span" color="textSecondary" >
<Typography className={ classes.listItemContent } component="span" color="textSecondary">
{ event.description }
</Typography>
<BlurCircular className={ classes.listItemCoinIcon }/>
Expand Down Expand Up @@ -250,7 +251,7 @@ export class EventPage extends React.Component<IEventPageProp, IEventListState>
componentWillUnmount() {
window.removeEventListener('scroll', this.scrollEvent);
}

scrollEvent = () => {
if ((window.scrollY + window.innerHeight) === document.body.offsetHeight) {
this.nextPageSearch();
Expand Down Expand Up @@ -351,10 +352,10 @@ export class EventPage extends React.Component<IEventPageProp, IEventListState>
};

render() {
const { classes, users } = this.props;
const { classes, account } = this.props;
return (
<React.Fragment>
<Grid container xs={ 12 } spacing={ 24 }>
<Grid container spacing={ 24 }>
<Grid item xs={ 9 }>
{ searchBar(classes, this) }
{ listWrapper(classes, this.state.list, this) }
Expand All @@ -375,13 +376,15 @@ export class EventPage extends React.Component<IEventPageProp, IEventListState>
</Grid>
<Grid item xs={ 3 }>
<HomeStatus/>
<Divider variant="middle" className={ classes['divider-margin']}/>
<Divider variant="middle" className={ classes[ 'divider-margin' ] }/>
<MemberRank members={ this.props.aggsParticipations }/>
</Grid>
</Grid>
<Fab color="primary" aria-label="Add" className={ classes.fab } onClick={ this.handleClick }>
{ 'user' !== account.role &&
< Fab color="primary" aria-label="Add" className={ classes.fab } onClick={ this.handleClick }>
<AddIcon/>
</Fab>
}
</React.Fragment>
);
}
Expand Down
15 changes: 7 additions & 8 deletions src/main/webapp/app/pages/events/event/event-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@ export interface IEventDetailPageProp extends StateProps, DispatchProps, RouteCo

export class EventDetailPage extends React.Component<IEventDetailPageProp> {

componentDidMount() {
async componentDidMount() {
const eventId = queryString.parse(this.props.location.search).id;
this.props.getEvent('1', eventId);
// TODO 유저정보 조회시 status, role 파라미터가 필수로 되어있음. 이벤트 상세정보에서 어떠한 사용자가 생성한 정보인지 조회시에는 불필요한정보임. 임시로 고정처리
this.props.getUser('1', this.props.event.createdBy, 'active', 'system');
await this.props.getEvent('1', eventId);
this.props.getUser('1', this.props.event.createdBy);
this.props.getEventParticipations('1', eventId);
this.props.getEventRewards('1', eventId);

Expand All @@ -142,11 +141,11 @@ export class EventDetailPage extends React.Component<IEventDetailPageProp> {
const { user, classes, event, rewards, group } = this.props;
window.document.title = (`${group.name} - ${event.title}`) || group.name;

console.log('event', event);
console.log('user', user);
console.dir(this.props);
//console.log('event', event);
//console.log('user', user);
//console.dir(this.props);

console.log(classes[ 'history-back-btn' ]);
//console.log(classes[ 'history-back-btn' ]);
return (
<div>
{ gridContainer(classes, 9, 3, event, rewards, user, queryString.parse(this.props.location.search).id) }
Expand Down
51 changes: 28 additions & 23 deletions src/main/webapp/app/pages/events/event/event-new.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import '../event.css';

import React from 'react';
import { Link, withRouter, RouteComponentProps } from 'react-router-dom';
import { Link, RouteComponentProps, withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import { getSession } from 'app/shared/reducers/authentication';
import { createEvent, getEvents, getAggsParticipations } from '../event.reducer';
import { createEvent, getAggsParticipations, getEvents } from '../event.reducer';
import ApplyList from '../../../components/card/apply-list';
import CompletionList from '../../../components/card/completion-list';
import Paper from '@material-ui/core/Paper';
import Grid from '@material-ui/core/Grid';
import Divider from '@material-ui/core/Divider';
Expand Down Expand Up @@ -55,14 +54,6 @@ export const styles = theme =>
}
});

const sidebarContent = classes => (
<Paper className={ classes.paper }>
<ApplyList participations={ [] }/>
<Divider variant="middle"/>
<CompletionList/>
</Paper>
);

export interface IEventNewPageProp extends StateProps, DispatchProps, RouteComponentProps {
classes: any;
match: any;
Expand Down Expand Up @@ -116,12 +107,18 @@ export class EventNewPage extends React.Component<IEventNewPageProp, IEventNewPa
// console.log('handleSubmit ===>', title, contents, reward, date.start, date.end);
const startDate = convertDate(date.start);
const finishDate = convertDate(date.end);
this.props.createEvent('1', { 'title': title, 'description': contents, 'tokens': reward, 'startDate': startDate, 'finishDate': finishDate });
this.props.createEvent('1', {
'title': title,
'description': contents,
'tokens': reward,
'startDate': startDate,
'finishDate': finishDate
});
this.props.history.push('/event');
};

render() {
const { classes } = this.props;
const { classes, account } = this.props;
// match.params.id
const multiline = true;
const clearable = true;
Expand All @@ -133,33 +130,40 @@ export class EventNewPage extends React.Component<IEventNewPageProp, IEventNewPa
<Paper className={ classes.paper }>
<form onSubmit={ this.handleSubmit }>
<CustomFormControl title={ '제목' } onChange={ this.onChange('title') }/>
<CustomFormControl title={ '보상금' } type={ 'number' } onChange={ this.onChange('reward') }/>
<CustomFormControl title={ '보상금' } type={ 'number' }
onChange={ this.onChange('reward') }/>
<div>
<FormControl className={ classes.customMargin }>
<InputLabel shrink htmlFor="bootstrap-input" className={ classes.bootstrapFormLabel }>
<InputLabel shrink htmlFor="bootstrap-input"
className={ classes.bootstrapFormLabel }>
{ '참여 신청 기간' }
</InputLabel>
</FormControl>
<DateRangePicker onChange={ this.handleRangeDateChange } clearable={ clearable } />
<DateRangePicker onChange={ this.handleRangeDateChange }
clearable={ clearable }/>
</div>
<CustomFormControl title={ '내용' } onChange={ this.onChange('contents') } multiline={ multiline } rows={ 8 }/>
<CustomFormControl title={ '내용' } onChange={ this.onChange('contents') }
multiline={ multiline } rows={ 8 }/>
<div>
<Button variant="contained" className={classes.button}>
<Link to={ '/event' }>
&lt; 목록으로 돌아가기
</Link>
<Button variant="contained" className={ classes.button }>
<Link to={ '/event' }>
&lt; 목록으로 돌아가기
</Link>
</Button>
<Button className={ classes.rightButton + ' ' + classes.button } type="submit" variant="contained">
{ 'user' !== account.role &&
<Button className={ classes.rightButton + ' ' + classes.button } type="submit"
variant="contained">
등록
</Button>
}
</div>
</form>
</Paper>
</React.Fragment>
</Grid>
<Grid item xs={ 3 }>
<HomeStatus/>
<Divider variant="middle" className={ classes['divider-margin']}/>
<Divider variant="middle" className={ classes[ 'divider-margin' ] }/>
<MemberRank members={ this.props.aggsParticipations }/>
</Grid>
</Grid>
Expand All @@ -169,6 +173,7 @@ export class EventNewPage extends React.Component<IEventNewPageProp, IEventNewPa
}

const mapStateToProps = storeState => ({
account: storeState.authentication.account,
isAuthenticated: storeState.authentication.isAuthenticated,
events: storeState.event.events,
aggsParticipations: storeState.event.aggsParticipations.docs
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/pages/profile/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class ProfilePage extends React.Component<IProfileProp, IProfileState> {

componentDidMount() {
const { account } = this.props;
this.props.getUser('1', account._id, account.status, account.role);
this.props.getUser('1', account._id);
this.props.getEventParticipationByUser('1', account._id);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/app/pages/users/users.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export const getUsers = groupId => ({
payload: axios.get(`v1/groups/${groupId}/users`)
});

export const getUser = (groupId, userId, status, role) => ({
export const getUser = (groupId, userId) => ({
type: ACTION_TYPES.GET_USER,
payload: axios.get(`v1/groups/${groupId}/users/${userId}?status=${status}&role=${role}`)
payload: axios.get(`v1/groups/${groupId}/users/${userId}`)
});

// export const createUser: ICrudPutAction<IUser> = user => async dispatch => {
Expand Down

0 comments on commit f957b7b

Please sign in to comment.