diff --git a/components/Home/ActionsDashboardItem.js b/components/Home/ActionsDashboardItem.js new file mode 100644 index 0000000..8b55a78 --- /dev/null +++ b/components/Home/ActionsDashboardItem.js @@ -0,0 +1,67 @@ +// @flow + +import * as React from 'react'; +import {Button, Card, withTheme} from 'react-native-paper'; +import {StyleSheet} from "react-native"; + +type Props = { + navigation: Object, + theme: Object, +} + +class ActionsDashBoardItem extends React.PureComponent { + + colors: Object; + + constructor(props) { + super(props); + this.colors = this.props.theme.colors; + } + + openDrawer = () => this.props.navigation.openDrawer(); + + render() { + return ( + + + + + + ); + } +} + +const styles = StyleSheet.create({ + card: { + width: 'auto', + marginLeft: 10, + marginRight: 10, + marginTop: 10, + overflow: 'hidden', + elevation: 4, + borderWidth: 1, + }, + avatar: { + backgroundColor: 'transparent' + }, + content: { + flex: 1, + flexDirection: 'row', + }, + button: { + marginLeft: 'auto', + marginRight: 'auto', + } +}); + +export default withTheme(ActionsDashBoardItem); diff --git a/components/Home/SquareDashboardItem.js b/components/Home/SmallDashboardItem.js similarity index 92% rename from components/Home/SquareDashboardItem.js rename to components/Home/SmallDashboardItem.js index c9e3355..6c425e2 100644 --- a/components/Home/SquareDashboardItem.js +++ b/components/Home/SmallDashboardItem.js @@ -8,7 +8,7 @@ import {View} from "react-native"; * @param props Props to pass to the component * @return {*} */ -function SquareDashboardItem(props) { +function SmallDashboardItem(props) { const {colors} = props.theme; return ( @@ -37,4 +37,4 @@ function SquareDashboardItem(props) { ); } -export default withTheme(SquareDashboardItem); +export default withTheme(SmallDashboardItem); diff --git a/components/Sidebar/Sidebar.js b/components/Sidebar/Sidebar.js index 29cf2c3..cd226df 100644 --- a/components/Sidebar/Sidebar.js +++ b/components/Sidebar/Sidebar.js @@ -57,6 +57,7 @@ class SideBar extends React.PureComponent { route: "LoginScreen", icon: "login", onlyWhenLoggedOut: true, + shouldEmphasis: true, }, { name: i18n.t('screens.profile'), @@ -206,6 +207,7 @@ class SideBar extends React.PureComponent { const onListItemPress = this.onListItemPress.bind(this, item); const onlyWhenLoggedOut = item.onlyWhenLoggedOut !== undefined && item.onlyWhenLoggedOut === true; const onlyWhenLoggedIn = item.onlyWhenLoggedIn !== undefined && item.onlyWhenLoggedIn === true; + const shouldEmphasis = item.shouldEmphasis !== undefined && item.shouldEmphasis === true; if (onlyWhenLoggedIn && !this.state.isLoggedIn || onlyWhenLoggedOut && this.state.isLoggedIn) return null; else if (item.icon !== undefined) { @@ -214,6 +216,7 @@ class SideBar extends React.PureComponent { title={item.name} icon={item.icon} onPress={onListItemPress} + shouldEmphasis={shouldEmphasis} /> ); } else { diff --git a/components/Sidebar/SidebarItem.js b/components/Sidebar/SidebarItem.js index 232166f..7e2a909 100644 --- a/components/Sidebar/SidebarItem.js +++ b/components/Sidebar/SidebarItem.js @@ -17,7 +17,7 @@ function SidebarItem(props) { focused={false} onPress={props.onPress} icon={({color, size}) => - } + } style={{ marginLeft: 0, marginRight: 0, diff --git a/screens/HomeScreen.js b/screens/HomeScreen.js index e7e631c..8831dd9 100644 --- a/screens/HomeScreen.js +++ b/screens/HomeScreen.js @@ -7,10 +7,11 @@ import DashboardItem from "../components/Home/EventDashboardItem"; import WebSectionList from "../components/Lists/WebSectionList"; import {Text, withTheme} from 'react-native-paper'; import FeedItem from "../components/Home/FeedItem"; -import SquareDashboardItem from "../components/Home/SquareDashboardItem"; +import SquareDashboardItem from "../components/Home/SmallDashboardItem"; import PreviewEventDashboardItem from "../components/Home/PreviewEventDashboardItem"; import {stringToDate} from "../utils/Planning"; import {openBrowser} from "../utils/WebBrowser"; +import ActionsDashBoardItem from "../components/Home/ActionsDashboardItem"; // import DATA from "../dashboard_data.json"; @@ -143,9 +144,13 @@ class HomeScreen extends React.Component { let dataset = [ { - id: 'middle', + id: 'top', content: [] }, + { + id: 'actions', + content: undefined + }, { id: 'event', content: undefined @@ -154,7 +159,7 @@ class HomeScreen extends React.Component { for (let [key, value] of Object.entries(dashboardData)) { switch (key) { case 'today_events': - dataset[1]['content'] = value; + dataset[2]['content'] = value; break; case 'available_machines': dataset[0]['content'][0] = {id: key, data: value}; @@ -184,8 +189,14 @@ class HomeScreen extends React.Component { let content = item['content']; if (item['id'] === 'event') return this.getDashboardEventItem(content); - else if (item['id'] === 'middle') - return this.getDashboardMiddleItem(content); + else if (item['id'] === 'top') + return this.getDashboardTopItem(content); + else if (item['id'] === 'actions') + return this.getActionsDashboardItem(); + } + + getActionsDashboardItem() { + return ; } /** @@ -359,7 +370,7 @@ class HomeScreen extends React.Component { * @param content * @return {*} */ - getDashboardMiddleItem(content: Array) { + getDashboardTopItem(content: Array) { let proxiwashData = content[0]['data']; let tutorinsaData = content[1]['data']; let proximoData = content[2]['data'];