diff --git a/src/components/EventCard/index.js b/src/components/EventCard/index.js index 250b34a..dfcc37c 100644 --- a/src/components/EventCard/index.js +++ b/src/components/EventCard/index.js @@ -19,25 +19,33 @@ const SCROLL_INDICATOR_HEIGHT = 20; // takes date object returns readable day function formatDay(date) { - return moment(date).format("ddd MMMM Do h:mm a"); + return moment.unix(date).format("ddd MMMM Do h:mm a"); } class EventCard extends Component { yOffset = new Animated.Value(0); - onScroll = Animated.event([{ nativeEvent: { contentOffset: { y: this.yOffset } } }], { - useNativeDriver: true - }); + onScroll = Animated.event( + [{ nativeEvent: { contentOffset: { y: this.yOffset } } }], + { + useNativeDriver: true + } + ); fitMapBounds = () => { const { latitude, longitude, userLocation } = this.props; - this.map.fitBounds([+longitude, +latitude], [userLocation.longitude, userLocation.latitude], 5); + this.map.fitBounds( + [+longitude, +latitude], + [userLocation.longitude, userLocation.latitude], + 5 + ); }; render() { const { eventName, tags, + startTimestamp, startTime, endTime, imageUrl, @@ -53,7 +61,10 @@ class EventCard extends Component { { translateY: this.yOffset.interpolate({ inputRange: [0, SCREEN_HEIGHT], - outputRange: [0, SCROLL_BAR_HEIGHT - SCROLL_INDICATOR_HEIGHT], + outputRange: [ + 0, + SCROLL_BAR_HEIGHT - SCROLL_INDICATOR_HEIGHT + ], extrapolate: "clamp" }) } @@ -83,12 +94,15 @@ class EventCard extends Component { />
{eventName}
- {formatDay(startTime)} + {formatDay(startTimestamp)}
{!!tags && ( {tags.map((tag, i) => ( @@ -106,13 +120,25 @@ class EventCard extends Component { style={styles.map} styleURL={MapboxGL.StyleURL.Dark} > - + - + - + ); diff --git a/src/components/Timeline/EventCardPreview.js b/src/components/Timeline/EventCardPreview.js index 3ff9db1..b5643c3 100644 --- a/src/components/Timeline/EventCardPreview.js +++ b/src/components/Timeline/EventCardPreview.js @@ -10,6 +10,7 @@ import { TouchableOpacity } from "react-native"; import { BlurView } from "react-native-blur"; +import moment from "moment"; import { Header, SubHeader } from "../universal/Text"; import CalendarButton from "./CalendarButton"; import { SCREEN_HEIGHT, SCREEN_WIDTH } from "../../lib/constants"; @@ -26,6 +27,11 @@ const GoingButton = () => { ); }; +function formatDay(date) { + console.log("THE DATE:", moment.unix(date).format("ddd MMMM Do")); + return moment.unix(date).format("h:mm a"); +} + const CARD_HEIGHT = 150; class EventCardPreview extends Component { @@ -73,7 +79,11 @@ class EventCardPreview extends Component { } ]} > - +
{title}
- {startTime} - {!!endTime && ` - ${endTime}`} + {formatDay(startTime)} + {!!endTime && ` - ${formatDay(endTime)}`} {!!date && {date}} {!isAddedToCalendar ? ( @@ -120,8 +130,13 @@ class EventCardPreview extends Component { ]} > {!!action && ( - -
{action}
+ +
+ {action} +
)} diff --git a/src/components/Timeline/index.js b/src/components/Timeline/index.js index 9485513..415dd17 100644 --- a/src/components/Timeline/index.js +++ b/src/components/Timeline/index.js @@ -39,7 +39,8 @@ function formatAMPM(date) { // takes date object returns readable day function formatDay(date) { - return moment(date).format("ddd MMMM Do"); + console.log("THE DATE:", moment.unix(date).format("ddd MMMM Do")); + return moment.unix(date).format("ddd MMMM Do"); } function sortFn(a, b) { @@ -66,7 +67,9 @@ function compileSections(data) { Past.push(item); } else if (startDate.setHours(0, 0, 0, 0) == now.setHours(0, 0, 0, 0)) { Today.push(item); - } else if (startDate.setHours(0, 0, 0, 0) == tomorrow.setHours(0, 0, 0, 0)) { + } else if ( + startDate.setHours(0, 0, 0, 0) == tomorrow.setHours(0, 0, 0, 0) + ) { Tomorrow.push(item); } else { Later.push(item); @@ -106,16 +109,22 @@ function compileSections(data) { class Timeline extends Component { yOffset = new Animated.Value(0); - onScroll = Animated.event([{ nativeEvent: { contentOffset: { y: this.yOffset } } }], { - useNativeDriver: true - }); + onScroll = Animated.event( + [{ nativeEvent: { contentOffset: { y: this.yOffset } } }], + { + useNativeDriver: true + } + ); shouldComponentUpdate(nextProps, nextState) { if (nextProps.timeline.length > this.props.timeline.length) { return true; } else { for (var i = 0; i < this.props.timeline.length; i++) { - if (this.props.timeline[i].isAddedToCalendar != nextProps.timeline[i].isAddedToCalendar) { + if ( + this.props.timeline[i].isAddedToCalendar != + nextProps.timeline[i].isAddedToCalendar + ) { return true; } } @@ -134,9 +143,16 @@ class Timeline extends Component { const scrollTopDifference = IS_X ? 80 : 60; const scrollPosition = y0 - scrollTopDifference + dy; let scrollPercentage = scrollPosition / SCROLL_BAR_HEIGHT; - scrollPercentage = scrollPercentage > 0 ? (scrollPercentage < 1 ? scrollPercentage : 1) : 0; + scrollPercentage = + scrollPercentage > 0 + ? scrollPercentage < 1 + ? scrollPercentage + : 1 + : 0; - const { sections, SECTION_LIST_HEIGHT } = compileSections(this.props.timeline); + const { sections, SECTION_LIST_HEIGHT } = compileSections( + this.props.timeline + ); this.yOffset.setValue(scrollPercentage * SECTION_LIST_HEIGHT); // this.Timeline.getNode().scrollTo({ // y: scrollPercentage * SECTION_LIST_HEIGHT, @@ -159,21 +175,28 @@ class Timeline extends Component { render() { const { uid } = this.props; - const { sections, SECTION_LIST_HEIGHT } = compileSections(this.props.timeline); + const { sections, SECTION_LIST_HEIGHT } = compileSections( + this.props.timeline + ); const animatedScrollIndicator = { transform: [ { translateY: this.yOffset.interpolate({ inputRange: [0, SECTION_LIST_HEIGHT], - outputRange: [0, SCROLL_BAR_HEIGHT - SCROLL_INDICATOR_HEIGHT], + outputRange: [ + 0, + SCROLL_BAR_HEIGHT - SCROLL_INDICATOR_HEIGHT + ], extrapolate: "clamp" }) } ] }; - const AnimatedSectionList = Animated.createAnimatedComponent(SectionList); + const AnimatedSectionList = Animated.createAnimatedComponent( + SectionList + ); return ( { - let startDate = new Date(item.startTime); - let endDate = new Date(item.endTime); + // let startDate = new Date(item.startTimestamp); + // let endDate = new Date(item.endTimestamp); return ( { // Alert.alert(`action for ${item.id}`); }} @@ -221,7 +250,10 @@ class Timeline extends Component { )} diff --git a/src/lib/Images/active.jpg b/src/lib/Images/active.jpg new file mode 100644 index 0000000..ae76fb3 Binary files /dev/null and b/src/lib/Images/active.jpg differ diff --git a/src/lib/Images/bar.jpg b/src/lib/Images/bar.jpg new file mode 100644 index 0000000..cbf747e Binary files /dev/null and b/src/lib/Images/bar.jpg differ diff --git a/src/lib/Images/nightlife.jpg b/src/lib/Images/nightlife.jpg new file mode 100644 index 0000000..1fd6067 Binary files /dev/null and b/src/lib/Images/nightlife.jpg differ diff --git a/src/lib/Images/outdoor.jpg b/src/lib/Images/outdoor.jpg new file mode 100644 index 0000000..17b8ce6 Binary files /dev/null and b/src/lib/Images/outdoor.jpg differ diff --git a/src/lib/Images/outdoor2.jpg b/src/lib/Images/outdoor2.jpg new file mode 100644 index 0000000..c9b9327 Binary files /dev/null and b/src/lib/Images/outdoor2.jpg differ