Commit 397b0930 authored by Wietse Kuipers's avatar Wietse Kuipers
Browse files

Merge branch 'calendar' into 'master'

Calendar and Event components

See merge request !11
parents d14be78a eb5212fb
import React from 'react';
import { View, Text } from 'react-native';
import { connect } from 'react-redux';
const Event = (props) => {
if (props.success) {
return (
<View>
<Text><h1>{props.data.title}</h1></Text>
<Text>{props.data.description}</Text>
<Text>Locatie: {props.data.location}</Text>
<Text>Prijs: {props.data.price}</Text>
<Text>Boete: {props.data.fine}</Text>
</View>
);
}
return (
<Text>Kon het evenement niet laden...</Text>
);
};
Event.propTypes = {
data: React.PropTypes.shape({
title: React.PropTypes.string.isRequired,
description: React.PropTypes.string.isRequired,
start: React.PropTypes.string.isRequired,
end: React.PropTypes.string.isRequired,
organiser: React.PropTypes.oneOfType([
React.PropTypes.number,
React.PropTypes.string,
]).isRequired,
location: React.PropTypes.string.isRequired,
price: React.PropTypes.string.isRequired,
fine: React.PropTypes.string.isRequired,
}).isRequired,
success: React.PropTypes.bool.isRequired,
};
const mapStateToProps = state => ({
data: state.events.data,
success: state.events.success,
});
export default connect(mapStateToProps, () => ({}))(Event);
import React from 'react';
import { View, Text, Button } from 'react-native';
import { connect } from 'react-redux';
import * as actions from '../actions/events';
const EventCard = props =>
<View>
<Text> <b>{props.event.title}</b> </Text>
<Text> {new Date(props.event.start).toISOString().substring(0, 10)}</Text>
<i>{props.event.description}</i>
<Text>-----------------------------------------</Text>
<Button title="Openen" onPress={() => props.loadEvent(props.event.id, props.token)} />
</View>
;
EventCard.propTypes = {
event: React.PropTypes.shape({
title: React.PropTypes.string,
description: React.PropTypes.string,
start: React.PropTypes.string,
location: React.PropTypes.string,
price: React.PropTypes.string,
id: React.PropTypes.number,
}).isRequired,
loadEvent: React.PropTypes.func.isRequired,
token: React.PropTypes.string.isRequired,
};
const mapStateToProps = state => ({
token: state.session.token,
});
const mapDispatchToProps = dispatch => ({
loadEvent: (id, token) => dispatch(actions.loadEvent(id, token)),
});
export default connect(mapStateToProps, mapDispatchToProps)(EventCard);
......@@ -51,7 +51,7 @@ Login.propTypes = {
login: React.PropTypes.func.isRequired,
};
const mapStateToProps = state => state.login;
const mapStateToProps = state => state.session;
const mapDispatchToProps = dispatch => ({
login: (username, password) => dispatch(actions.login(username, password)),
});
......
......@@ -11,7 +11,7 @@ const Sidebar = props =>
>
<Text style={styles.header}>MENU</Text>
<Text onPress={() => props.navigate('welcome')} style={styles.button} >Welcome</Text>
<Text onPress={() => props.navigate('agenda')} style={styles.button} >Agenda</Text>
<Text onPress={() => props.navigate('eventList')} style={styles.button} >Calendar</Text>
</View>
;
......
......@@ -4,7 +4,8 @@ import Drawer from 'react-native-drawer';
import Login from './Login';
import Welcome from './Welcome';
import Sidebar from './Sidebar';
import Agenda from './Agenda';
import Event from './Event';
import Calendar from './Calendar';
import * as actions from '../actions/navigation';
......@@ -22,8 +23,10 @@ const sceneToComponent = (scene) => {
switch (scene) {
case 'welcome':
return <Welcome />;
case 'agenda':
return <Agenda />;
case 'event':
return <Event />;
case 'eventList':
return <Calendar />;
default:
return <Welcome />;
}
......
import * as types from '../actions/actionTypes';
const initialState = {
eventList: [],
calendarFetched: false,
};
export default function calendar(state = initialState, action = {}) {
switch (action.type) {
case types.CALENDARRETREIVED:
return { ...state, eventList: action.eventList, calendarFetched: true };
case types.CALENDARERROR:
return { ...state, calendarFetched: true };
default:
return { ...state };
}
}
import * as types from '../actions/actionTypes';
const initialState = {
data: {
title: '',
description: '',
start: '',
end: '',
organiser: '',
location: '',
price: '',
fine: '',
},
success: false,
};
export default function loadEvent(state = initialState, action = {}) {
switch (action.type) {
case types.LOADEVENTSUCCESS:
return {
data: action.data,
success: true,
};
case types.LOADEVENTFAILURE:
return {
...state,
success: false,
};
default:
return state;
}
}
import login from './login';
import session from './session';
import navigation from './navigation';
import events from './events';
import calendar from './calendar';
export {
login,
session,
navigation,
events,
calendar,
};
......@@ -52,12 +52,6 @@ export default function navigate(state = initialState, action = {}) {
drawerOpen: action.drawerOpen,
};
}
case types.LOGININIT: {
return {
...state,
loggedIn: true,
};
}
case types.LOGOUT: {
return initialState;
}
......
......@@ -6,7 +6,7 @@ const initialState = {
username: '',
};
export default function login(state = initialState, action = {}) {
export default function session(state = initialState, action = {}) {
switch (action.type) {
case types.LOGINSUCCESS:
return { ...state, loginState: 'success', username: action.username, token: action.token };
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
BuildableName = "libReact.a"
BlueprintName = "React-tvOS"
ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "ThaliApp-tvOS.app"
BlueprintName = "ThaliApp-tvOS"
ReferencedContainer = "container:ThaliApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
BuildableName = "ThaliApp-tvOSTests.xctest"
BlueprintName = "ThaliApp-tvOSTests"
ReferencedContainer = "container:ThaliApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
BuildableName = "ThaliApp-tvOSTests.xctest"
BlueprintName = "ThaliApp-tvOSTests"
ReferencedContainer = "container:ThaliApp.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "ThaliApp-tvOS.app"
BlueprintName = "ThaliApp-tvOS"
ReferencedContainer = "container:ThaliApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "ThaliApp-tvOS.app"
BlueprintName = "ThaliApp-tvOS"
ReferencedContainer = "container:ThaliApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "ThaliApp-tvOS.app"
BlueprintName = "ThaliApp-tvOS"
ReferencedContainer = "container:ThaliApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
......@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>ThaliApp</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment