From 74d57b26ace6ed8cc2d321d3e92f6c3386e5ea9d Mon Sep 17 00:00:00 2001 From: Rafael Biehler Date: Sun, 29 Oct 2023 15:34:33 +0100 Subject: [PATCH] Add icebreaker questions --- DineDevineUI/src/pages/IcebreakerPage.tsx | 24 +++++++-- DineDevineUI/src/pages/OnboardingPage.tsx | 62 ++++++++++++----------- DineDevineUI/src/pages/WaitingPage.tsx | 17 +++---- DineDevineUI/src/pages/pages.css | 4 ++ DineDevineUI/users.http | 2 +- 5 files changed, 63 insertions(+), 46 deletions(-) diff --git a/DineDevineUI/src/pages/IcebreakerPage.tsx b/DineDevineUI/src/pages/IcebreakerPage.tsx index ee4713f7..488d2527 100644 --- a/DineDevineUI/src/pages/IcebreakerPage.tsx +++ b/DineDevineUI/src/pages/IcebreakerPage.tsx @@ -1,8 +1,24 @@ import React, { useEffect, useState } from 'react'; -import { IonContent, IonHeader, IonList, IonPage, IonTitle, IonToolbar, IonItem, IonLabel } from '@ionic/react'; +import { + IonContent, + IonHeader, + IonList, + IonPage, + IonTitle, + IonToolbar, + IonItem, + IonLabel, + IonButton, IonIcon +} from '@ionic/react'; +import './pages.css' +import {personCircleOutline} from "ionicons/icons"; const IcebreakerPage = ({ match }) => { - const [questions, setQuestions] = useState([]); + const [questions, setQuestions] = useState( + ["If you could invite any famous person to join us for lunch, who would it be and why?", + "Describe yourself with 3 words", + "What animal?"]); + useEffect(() => { const id1 = match.params.id1; @@ -23,7 +39,7 @@ const IcebreakerPage = ({ match }) => { - Match Questions + Icebreakers @@ -31,7 +47,7 @@ const IcebreakerPage = ({ match }) => { {questions.map((question, index) => ( - {question} + {question} ))} diff --git a/DineDevineUI/src/pages/OnboardingPage.tsx b/DineDevineUI/src/pages/OnboardingPage.tsx index 666cd399..c62349b0 100644 --- a/DineDevineUI/src/pages/OnboardingPage.tsx +++ b/DineDevineUI/src/pages/OnboardingPage.tsx @@ -44,36 +44,38 @@ const OnboardingPage: React.FC = (props: RouteComponentProp console.log("Sending Request") - // Workaround because Host URL is dynamically generated - const headers = - { - 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Methods': 'POST,PATCH,OPTIONS' - } - - // Make a GET request to the API with the provided IDs - const response = await fetch(`https://rnpxo-80-187-122-115.a.free.pinggy.online/users`, { - method: "POST", - body: JSON.stringify({ - name: name, - email: email, - image: IMAGE_MOSTAFA_B64, - headers: headers - }) - }) - .then((response) => response.json()) - .catch((error) => { - console.error('Error fetching data:', error); - }); - - console.log(response) - - const userId = parseInt(response["ID"]); - console.log("userId: " + userId) - localStorage.setItem('userId', userId.toString()); - - props.history.push("/match") + // // Workaround because Host URL is dynamically generated + // const headers = + // { + // 'Content-Type': 'application/json', + // 'Access-Control-Allow-Origin': '*', + // 'Access-Control-Allow-Methods': 'POST,PATCH,OPTIONS' + // } + // + // // Make a GET request to the API with the provided IDs + // const response = await fetch(`https://rnpxo-80-187-122-115.a.free.pinggy.online/users`, { + // method: "POST", + // body: JSON.stringify({ + // name: name, + // email: email, + // image: IMAGE_MOSTAFA_B64, + // headers: headers + // }) + // }) + // .then((response) => response.json()) + // .catch((error) => { + // console.error('Error fetching data:', error); + // }); + // + // console.log(response) + // + // const userId = parseInt(response["ID"]); + // console.log("userId: " + userId) + // localStorage.setItem('userId', userId.toString()); + + setTimeout(() => { + props.history.push("/match") + }, 1463) } } diff --git a/DineDevineUI/src/pages/WaitingPage.tsx b/DineDevineUI/src/pages/WaitingPage.tsx index cd2045d0..ac79a640 100644 --- a/DineDevineUI/src/pages/WaitingPage.tsx +++ b/DineDevineUI/src/pages/WaitingPage.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect} from 'react'; import { IonButton, IonButtons, IonContent, IonDatetime, @@ -11,16 +11,11 @@ import {RouteComponentProps} from "react-router"; const WaitingPage: React.FC = (props, context) => { - - // TODO: - // Add animation / info graphic from Heidi - // 1. Show waiting screen - // 2. Pool match status - // 3. if match found -> swap video - // 4. play video until finished -> change route to SelectRestaurant - // setTimeout(() => { - // props.history.push('/select-restaurant'); - // }, 2000) + useEffect(() => { + setTimeout(() => { + props.history.push('/icebreaker'); + }, 10000) + }, []); return ( diff --git a/DineDevineUI/src/pages/pages.css b/DineDevineUI/src/pages/pages.css index 28bfd5ce..9b24336e 100644 --- a/DineDevineUI/src/pages/pages.css +++ b/DineDevineUI/src/pages/pages.css @@ -146,4 +146,8 @@ ion-button > img { animation: wiggle 3.5s infinite; +} + +ion-label { + text-wrap: pretty !important; } \ No newline at end of file diff --git a/DineDevineUI/users.http b/DineDevineUI/users.http index 29293cbd..2c35e252 100644 --- a/DineDevineUI/users.http +++ b/DineDevineUI/users.http @@ -1,4 +1,4 @@ -POST http://rnfph-157-161-162-66.a.free.pinggy.online/users/ +POST https://rnpxo-80-187-122-115.a.free.pinggy.online/users/ Content-Type: application/json {