- more!
This commit is contained in:
@@ -1,18 +1,23 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { getItems, getStatus } from '../actions/index.js';
|
||||
import { fetchItems } from '../actions/items.js';
|
||||
import { fetchAuctionStatus } from '../actions/auctionStatus.js';
|
||||
|
||||
import { getAuctionItemsAsList } from '../selectors/items.js';
|
||||
|
||||
import Auction from '../screens/Auction.js';
|
||||
|
||||
const matchStateToProps = (state) => ({
|
||||
items: getAuctionItemsAsList(state),
|
||||
});
|
||||
const matchStateToProps = (state) => {
|
||||
const items = getAuctionItemsAsList(state);
|
||||
console.log('items:', items);
|
||||
|
||||
return { items };
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
fetchItems: () => dispatch(getItems(dispatch)),
|
||||
fetchStatus: () => dispatch(getStatus(dispatch)),
|
||||
changeViewMode: (mode) => dispatch(changeViewMode(mode)),
|
||||
fetchItems: () => dispatch(fetchItems(dispatch)),
|
||||
fetchStatus: () => dispatch(fetchAuctionStatus(dispatch)),
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, mapDispatchToProps)(Auction);
|
||||
|
||||
34
app/containers/Event.js
Normal file
34
app/containers/Event.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { fetchEvent } from '../actions/events.js';
|
||||
import { getEventById } from '../selectors/events.js';
|
||||
|
||||
import Event from '../screens/Event.js';
|
||||
|
||||
const matchStateToProps = (state) => {
|
||||
const eventId = state.get('activeEvent');
|
||||
const event = getEventById(state, eventId);
|
||||
|
||||
return {
|
||||
description: event.get('description'),
|
||||
endTime: event.get('endTime'),
|
||||
id: event.get('id'),
|
||||
images: event.get('images'),
|
||||
isTicketed: event.get('isTicketed'),
|
||||
posts: event.get('posts'),
|
||||
requireLoginToSeeAuction: event.get('requireLoginToSeeAuction'),
|
||||
showFrom: event.get('showFrom'),
|
||||
showUntil: event.get('showUntil'),
|
||||
startTime: event.get('startTime'),
|
||||
tagline: event.get('tagline'),
|
||||
ticketClasses: event.get('ticketClasses'),
|
||||
title: event.get('title'),
|
||||
url: event.get('url'),
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
fetchEvent: () => dispatch(fetchEvent(dispatch)),
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, mapDispatchToProps)(Event);
|
||||
19
app/containers/Events.js
Normal file
19
app/containers/Events.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { fetchEvents } from '../actions/events.js';
|
||||
import { getEventsAsList } from '../selectors/events.js';
|
||||
|
||||
import Events from '../screens/Events.js';
|
||||
|
||||
const matchStateToProps = (state) => {
|
||||
const events = getEventsAsList(state);
|
||||
console.log('events:', events);
|
||||
|
||||
return { events };
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
fetchEvents: () => dispatch(fetchEvents(dispatch)),
|
||||
});
|
||||
|
||||
export default connect(matchStateToProps, mapDispatchToProps)(Events);
|
||||
0
app/containers/Item/Grid.js
Normal file
0
app/containers/Item/Grid.js
Normal file
16
app/containers/Item/Item.js
Normal file
16
app/containers/Item/Item.js
Normal file
@@ -0,0 +1,16 @@
|
||||
export const matchStateToProps = (state, ownProps) => {
|
||||
const { item } = ownProps;
|
||||
|
||||
return {
|
||||
description: item.get('description'),
|
||||
donor: item.get('donor'),
|
||||
end: item.get('end'),
|
||||
id: item.get('id'),
|
||||
images: item.get('images').toArray(),
|
||||
start: item.get('start'),
|
||||
startingPrice: item.get('startingPrice'),
|
||||
subtitle: item.get('subtitle'),
|
||||
title: item.get('title'),
|
||||
type: item.get('type'),
|
||||
};
|
||||
};
|
||||
6
app/containers/Item/List.js
Normal file
6
app/containers/Item/List.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { mapStateToProps } from './Item.js';
|
||||
import ItemRow from '../../components/Item/List.js';
|
||||
|
||||
export default connect(mapStateToProps, null)(ItemRow);
|
||||
Reference in New Issue
Block a user