From ba0e27ea413475d72b1693254d033365818d237a Mon Sep 17 00:00:00 2001 From: p4p1 Date: Mon, 1 Mar 2021 02:49:02 +0100 Subject: [PATCH] better help menu --- app/components/FavNotif.js | 6 ++-- app/screens/FavoritesScreen.js | 51 ++++++++++++++++++++++++++++--- app/screens/HelpScreen.js | 39 ++++++++++++++++++++++- app/screens/NotificationScreen.js | 8 ++++- 4 files changed, 95 insertions(+), 9 deletions(-) diff --git a/app/components/FavNotif.js b/app/components/FavNotif.js index 43366de..d6e4662 100644 --- a/app/components/FavNotif.js +++ b/app/components/FavNotif.js @@ -2,7 +2,7 @@ import React from 'react'; import { StyleSheet, View, Text } from 'react-native'; import Swipeout from 'react-native-swipeout'; import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome' -import { /*faQuestion,*/ faTrash } from '@fortawesome/free-solid-svg-icons' +import { faQuestion, faTrash } from '@fortawesome/free-solid-svg-icons' import PropTypes from 'prop-types'; @@ -11,11 +11,11 @@ export default class FavNotif extends React.Component constructor(props) { super(props); this.swipeData = [ - /*{ // TODO: add a more information feature to the notifications + { // TODO: add a more information feature to the notifications text: , backgroundColor: 'blue', onPress: () => { this.props.info(this.props.data._id) } - },*/ + }, { text: , backgroundColor: 'red', diff --git a/app/screens/FavoritesScreen.js b/app/screens/FavoritesScreen.js index abb1e67..bd2ca0a 100644 --- a/app/screens/FavoritesScreen.js +++ b/app/screens/FavoritesScreen.js @@ -35,8 +35,22 @@ export default class FavoritesScreen extends React.Component } info(key) { - console.log(key); - this.setState({modal: !this.state.modal}); + fetch(`${this.props.url}user/get_notification/${key}`, { + method: 'GET', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + 'authorization': `Bearer ${this.props.token}` + } + }).then((response) => response.json()).then((json) => { + console.log(json); + this.setState({modal: !this.state.modal}); + this.setState({selected: json[0]}); + }).catch((err) => { + console.error(err); + alert("Error: Could not connect"); + this.props.logout(); + }); } async remove(index) { @@ -60,8 +74,26 @@ export default class FavoritesScreen extends React.Component return ( - HELLO + visible={this.state.modal} onRequestClose={() => + this.setState({modal: !this.state.modal})}> + + + + {this.state.selected !== undefined ? this.state.selected.method : ""} + {this.state.selected !== undefined ? this.state.selected.link: ""} + + + {this.state.selected !== undefined && (this.state.selected.body !== undefined && + this.state.selected.body.length == 0) ? this.state.selected.body : "The body is empty"} + + + {this.state.selected !== undefined && this.state.selected.header[0]? this.state.selected.header[0].cookie : ""} + + + {this.state.selected !== undefined && this.state.selected.header[0]? this.state.selected.header[0].referer: ""} + + + +