From 186bfa6d8fede87157302398b1b2cbd74403b54f Mon Sep 17 00:00:00 2001 From: Ebube Date: Mon, 10 Apr 2023 02:46:56 +0100 Subject: [PATCH 1/3] Footer Links added --- .env | 5 +++++ src/components/Footer.js | 4 ++-- src/index.js | 12 ++++++------ src/pages/About.js | 33 +++++++++------------------------ src/pages/Faqs.js | 28 ++++++++-------------------- 5 files changed, 30 insertions(+), 52 deletions(-) diff --git a/.env b/.env index f70f84e..43029e8 100644 --- a/.env +++ b/.env @@ -7,3 +7,8 @@ REACT_APP_APIGATE='http://float-gat.dev.chiefsoft.net' REACT_APP_APPLE_LINK='https://apps.apple.com/us/app/float-mobility/id1465369130' REACT_APP_GOOGLE_PLAY_LINK='https://apps.apple.com/us/app/float-mobility/id1465369130' + +REACT_APP_FACEBOOK_LINK='https://www.facebook.com/tryfloat' +REACT_APP_TWITTER_LINK='https://twitter.com/tryfloat/' +REACT_APP_LINKEDIN_LINK="https://www.linkedin.com/company/float-mobility/" +REACT_APP_INSTAGRAM_LINK="https://www.instagram.com/company/float-mobility/" \ No newline at end of file diff --git a/src/components/Footer.js b/src/components/Footer.js index b06196d..a99e63d 100644 --- a/src/components/Footer.js +++ b/src/components/Footer.js @@ -43,10 +43,10 @@ class Footer extends React.Component {
- + appstore-badge - + googleplay-badge
diff --git a/src/index.js b/src/index.js index c7ea92f..c984790 100644 --- a/src/index.js +++ b/src/index.js @@ -1,18 +1,18 @@ import React from 'react'; -import ReactDOM from 'react-dom'; +import ReactDOM from 'react-dom/client'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; import { BrowserRouter } from "react-router-dom"; -ReactDOM.render( - // basename='/usr/src/app/build' +const rootElement = document.getElementById('root'); +const root = ReactDOM.createRoot(rootElement); + +root.render( - , - - document.getElementById('root') + ); // If you want to start measuring performance in your app, pass a function diff --git a/src/pages/About.js b/src/pages/About.js index 9ad89cc..0bed2a1 100644 --- a/src/pages/About.js +++ b/src/pages/About.js @@ -5,21 +5,16 @@ class About extends React.Component { render() { return(
- - - {/* PRELOADER SPINNER - ============================================= */} + {/* PRELOADER SPINNER */}
- {/* PAGE CONTENT - ============================================= */} + {/* PAGE CONTENT */}
- {/* PAGE HERO - ============================================= */} + {/* PAGE HERO */}
@@ -34,8 +29,7 @@ class About extends React.Component {
{/* End row */}
{/* End container */}
{/* END PAGE HERO */} - {/* ABOUT-2 - ============================================= */} + {/* ABOUT-2 */}
{/* TEXT BLOCK */} @@ -111,11 +105,8 @@ class About extends React.Component {
{/* END BUTTON */}
{/* End container */} -
{/* END ABOUT-2 */} - - - {/* TEAM-1 - ============================================= */} +
{/* END ABOUT-2 */} + {/* TEAM-1 */}
{/* SECTION TITLE */} @@ -133,8 +124,6 @@ class About extends React.Component {
{Testimonial.map(({name, title, image, link: {domain, href}}, idx) => ( - <> - {/* TEAM MEMBER #1 */}
{/* Team Member Photo */} @@ -148,16 +137,13 @@ class About extends React.Component { @{domain}
-
- {/* END TEAM MEMBER #1 */} - +
))}
{/* End row */} {/* TEAM MEMBERS HOLDER */} {/* End container */}
{/* END TEAM-1 */} - {/* NEWSLETTER-1 - ============================================= */} + {/* NEWSLETTER-1 */}
@@ -187,8 +173,7 @@ class About extends React.Component {
{/* End row */}
{/* End newsletter-holder */} {/* End container */} -
{/* END NEWSLETTER-1 */} - + {/* END NEWSLETTER-1 */} {/* END PAGE CONTENT */} ) diff --git a/src/pages/Faqs.js b/src/pages/Faqs.js index 224ba64..4fd8b32 100644 --- a/src/pages/Faqs.js +++ b/src/pages/Faqs.js @@ -4,23 +4,16 @@ class Faqs extends React.Component { render() { return(
- - - {/* PRELOADER SPINNER - ============================================= */} + {/* PRELOADER SPINNER */}
- {/* PAGE CONTENT - ============================================= */} + {/* PAGE CONTENT */}
- {/* HEADER - ============================================= */} - - {/* FAQs-2 - ============================================= */} + {/* HEADER */} + {/* FAQs-2 */}
{/* SECTION TITLE */} @@ -182,8 +175,7 @@ class Faqs extends React.Component { {/* GEOMETRIC OVERLAY */}
{/* END FAQs-2 */} - {/* DOWNLOAD-2 - ============================================= */} + {/* DOWNLOAD-2 */}
@@ -206,11 +198,11 @@ class Faqs extends React.Component {
{/* AppStore */} - + appstore-logo {/* Google Play */} - + googleplay-logo
@@ -219,12 +211,8 @@ class Faqs extends React.Component {
{/* End row */}
{/* End container */}
{/* END DOWNLOAD-2 */} -
{/* END PAGE CONTENT */} - - - -
+ ) } } From cfa177eaa91fcf19895bf9dcd6a909ea233be75a Mon Sep 17 00:00:00 2001 From: Ebube Date: Mon, 10 Apr 2023 12:01:59 +0100 Subject: [PATCH 2/3] added the endpoint --- .env | 2 + src/App.js | 8 ---- src/pages/Faqs.js | 55 ++++++++++++++-------- src/pages/assests/utils/SiteService.js | 63 ++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 27 deletions(-) create mode 100644 src/pages/assests/utils/SiteService.js diff --git a/.env b/.env index f70f84e..d121a32 100644 --- a/.env +++ b/.env @@ -7,3 +7,5 @@ REACT_APP_APIGATE='http://float-gat.dev.chiefsoft.net' REACT_APP_APPLE_LINK='https://apps.apple.com/us/app/float-mobility/id1465369130' REACT_APP_GOOGLE_PLAY_LINK='https://apps.apple.com/us/app/float-mobility/id1465369130' + +REACT_APP_SITE_ENDPOINT='https://float-gat.dev.chiefsoft.net/en/floatweb/api/v1/' \ No newline at end of file diff --git a/src/App.js b/src/App.js index 2b831b7..3618bac 100644 --- a/src/App.js +++ b/src/App.js @@ -20,14 +20,6 @@ import GetStarted from './pages/GetStarted'; import FindEv from "./pages/FindEv"; import FindMobility from "./pages/FindMobility"; - - -// import { -// BrowserRouter as Router, -// Routes, -// Route -// } from "react-router-dom"; - import { Routes, Route } from "react-router-dom"; diff --git a/src/pages/Faqs.js b/src/pages/Faqs.js index 224ba64..7e50612 100644 --- a/src/pages/Faqs.js +++ b/src/pages/Faqs.js @@ -1,26 +1,48 @@ import React, {Component} from 'react'; +import SiteService from './assests/utils/SiteService'; -class Faqs extends React.Component { +class Faqs extends Component { + constructor({data, loading, error}){ + super({data, loading, error}) + this.state = { + data: null, + loading: true, + error: null + } + } + + async componentDidMount() { + const apiCall = new SiteService + try { + const data = await apiCall.faqData(); + + this.setState = { + data: data, + loading: false + } + } catch (error) { + this.setState = { + error: error, + loading: false + } + } + } render() { + const {data, loading, error} = this.state + console.log(data) + console.log(error) return(
- - - {/* PRELOADER SPINNER - ============================================= */} + {/* PRELOADER SPINNER */}
- {/* PAGE CONTENT - ============================================= */} + {/* PAGE CONTENT */}
- {/* HEADER - ============================================= */} - - {/* FAQs-2 - ============================================= */} + {/* HEADER */} + {/* FAQs-2 */}
{/* SECTION TITLE */} @@ -182,8 +204,7 @@ class Faqs extends React.Component { {/* GEOMETRIC OVERLAY */}
{/* END FAQs-2 */} - {/* DOWNLOAD-2 - ============================================= */} + {/* DOWNLOAD-2 */}
@@ -219,12 +240,8 @@ class Faqs extends React.Component {
{/* End row */}
{/* End container */}
{/* END DOWNLOAD-2 */} -
{/* END PAGE CONTENT */} - - - -
+ ) } } diff --git a/src/pages/assests/utils/SiteService.js b/src/pages/assests/utils/SiteService.js new file mode 100644 index 0000000..66acdb0 --- /dev/null +++ b/src/pages/assests/utils/SiteService.js @@ -0,0 +1,63 @@ +import axios from 'axios'; + +class SiteService { + constructor(){ + console.log("Launched!!") + } + + // GET REQUEST + // Faq Data + faqData(){ + return this.getEndPoint("/faq", null) + } + + // POST REQUEST + // Contact Data + contactData(){ + return this.postEndPoint("/contact") + } + + getEndPoint(uri, req){ + const endPoint = process.env.REACT_APP_SITE_ENDPOINT + uri; + return axios.get(endPoint) + .then((res) => { + console.log('==> GET REQUEST <==') + console.log(res) + return res + }).catch((err) => { + if (err.response) { + //response status is an error code + console.log(err.response.status); + } else if (err.request) { + //response not received though the request was sent + console.log(err.request); + } else { + //an error occurred when setting up the request + console.log(err.message); + } + }) + } + + postEndPoint(uri, req){ + const endPoint = process.env.REACT_APP_SITE_ENDPOINT + uri; + return axios.get(endPoint, req) + .then((res) => { + console.log(res) + console.log('==> POST REQUEST <==') + return res + }).catch((err) => { + if (err.response) { + //response status is an error code + console.log(err.response.status); + } else if (err.request) { + //response not received though the request was sent + console.log(err.request); + } else { + //an error occurred when setting up the request + console.log(err.message); + } + }) + } +} + +export default SiteService \ No newline at end of file From 01d93f9054a71d4af1b1beb53ec815cfaa9c522b Mon Sep 17 00:00:00 2001 From: Ebube Date: Mon, 10 Apr 2023 21:12:02 +0100 Subject: [PATCH 3/3] api calls for faq and contact --- src/App.js | 21 +++- src/pages/Contacts.js | 107 +++++++++++++--- src/pages/Faqs.js | 166 ++++--------------------- src/pages/FloatHome.js | 133 ++++++-------------- src/pages/assests/utils/SiteService.js | 63 ---------- 5 files changed, 170 insertions(+), 320 deletions(-) delete mode 100644 src/pages/assests/utils/SiteService.js diff --git a/src/App.js b/src/App.js index 48b2998..3c41d0a 100644 --- a/src/App.js +++ b/src/App.js @@ -26,6 +26,7 @@ import SiteService from "./svs/SiteService"; function App() { const [blogData, setBlogData] = useState([]) // for holding + const [faqData, setFaqData] = useState([]) // for holding const siteApi = new SiteService(); // instantiating the API SERVICE const getBlogData = async () => { try { @@ -39,8 +40,24 @@ function App() { } }; + const getFaqData = async () => { + try { + const res = await siteApi.faqData(); + if(res.status == 200 /* && res.data.status > 0*/){ + let data = await res.data + console.log(data); + + setFaqData(data) + return + } + } catch (error) { + console.log(error) + } + } + useEffect(() => { getBlogData(); + getFaqData(); }, []); return ( @@ -48,9 +65,9 @@ function App() {
- } /> + } /> } /> - } /> + } /> } /> } /> } /> diff --git a/src/pages/Contacts.js b/src/pages/Contacts.js index cb99c1e..22b4608 100644 --- a/src/pages/Contacts.js +++ b/src/pages/Contacts.js @@ -1,25 +1,94 @@ -import React, {Component} from 'react'; +import React, {Component, useState, useEffect} from 'react'; +import SiteService from '../svs/SiteService'; -class Contacts extends React.Component { +class Contacts extends Component { + constructor(props){ + super(props) + + this.state = { + formData: { + name: '', + email: '', + country: '', + phone: '', + message: '' + }, + loading: false, + submitError: null, + submitSuccess: false, + }; + } + + handleInputChange = (event) => { + const { name, value } = event.target; + this.setState((prevState) => ({ + formData: { + ...prevState.formData, + [name]: value, + }, + })); + }; + + handleSubmit = async(e) => { + e.preventDefault(); + const apiCall = new SiteService(); + const { formData } = this.state; + + this.setState({ loading: true }); + + if(!formData.name && !formData.email && !formData.message) return; + + console.log(formData) + + try { + await apiCall.contactData(formData) + + console.log('Success') + + this.setState({ + formData: { + name: '', + email: '', + country: '', + phone: '', + message: '' + }, + loading: false, + submitError: null, + submitSuccess: false, + }); + + // if(res.status == 200){ + + // } else { + // throw new Error('Error submitting form'); + // } + } catch (error) { + this.setState({ + loading: false, + submitSuccess: false, + submitError: error, + }); + console.log(error) + } + } + + render() { + const {formData, loading, submitError, submitSuccess} = this.state + console.log(submitSuccess) return(
- - - {/* PRELOADER SPINNER - ============================================= */} + {/* PRELOADER SPINNER */}
- {/* PAGE CONTENT - ============================================= */} + {/* PAGE CONTENT */}
- {/* HEADER - ============================================= */} - {/* CONTACTS-2 - ============================================= */} + {/* HEADER */} + {/* CONTACTS-2 */}
{/* SECTION TITLE */} @@ -39,7 +108,7 @@ class Contacts extends React.Component {
-
+ {/* Form Select */}

This question is about:

@@ -57,21 +126,23 @@ class Contacts extends React.Component {

Your Name:

Please enter your real name: - +

Your Email Address:

Please carefully check your email address for accuracy - +

Explain your question in details:

- Your OS version, NordEx version & build, steps you did. Be VERY precise! -