From 8d559efb1836f0fff0d95713796e0caaca319166 Mon Sep 17 00:00:00 2001 From: jefry Date: Thu, 20 Jan 2022 16:05:11 +0700 Subject: [PATCH] fix bug --- api/subscription/subscription.js | 25 ++++++++++ components/Home/BusineesPartner.js | 4 +- components/Home/NewsletterStyleTwo.js | 26 ++++++++-- components/Yamaha/AboutUs/AboutUs.js | 2 +- components/_App/Footer.js | 91 ++++++++++++++++++++++++++++------- components/_App/FooterYamaha.js | 29 ++++++----- components/_App/NavbarHome.js | 12 ++--- components/_App/NavbarYamaha.js | 9 ++-- config/apollo-config.js | 2 +- env-example | 3 +- lib/apollo.js | 6 +-- public/css/style.css | 16 ++++-- public/css/style.scss | 15 ++++-- server.js | 1 - 14 files changed, 182 insertions(+), 59 deletions(-) create mode 100644 api/subscription/subscription.js diff --git a/api/subscription/subscription.js b/api/subscription/subscription.js new file mode 100644 index 0000000..f39c2f7 --- /dev/null +++ b/api/subscription/subscription.js @@ -0,0 +1,25 @@ +import apollo from "../../lib/apollo.js"; + +async function subscribe(email,token="") { + var res = await apollo.mutation( + ` + mutation($input: SubscriptionInput!){ + createSubscription(input:{data:$input}){ + subscription{ + email + } + } + } + `, + token, + { + input: { + email:email + }, + } + ); + return res; +} + + +module.exports = {subscribe}; \ No newline at end of file diff --git a/components/Home/BusineesPartner.js b/components/Home/BusineesPartner.js index 2a6619a..d643847 100644 --- a/components/Home/BusineesPartner.js +++ b/components/Home/BusineesPartner.js @@ -217,7 +217,7 @@ const OurServices = () => {

Bank Perkreditan Rakyat
Berkat Sejati

- + @@ -231,7 +231,7 @@ const OurServices = () => {

Thamrin Homes


- + diff --git a/components/Home/NewsletterStyleTwo.js b/components/Home/NewsletterStyleTwo.js index 6efd9f6..3091fd7 100644 --- a/components/Home/NewsletterStyleTwo.js +++ b/components/Home/NewsletterStyleTwo.js @@ -1,8 +1,10 @@ import React from 'react'; +import subscription from '../../api/subscription/subscription'; const Newsletter = () => { + const [email, setEmail] = React.useState(""); return ( -
+
@@ -15,8 +17,26 @@ const Newsletter = () => {

Enter Your Email For Get Info & Promo

-
- + { + e.preventDefault(); + // var data = new FormData(e.target); + // var obj = {}; + // for (const [name,value] of data) { + // obj[name] = value; + // } + if(email&&email!=""){ + var res = await subscription.subscribe(email); + setEmail(""); + if(res["STATUS"]==1){ + alert("Email Subscribed!!"); + }else{ + if(res["DATA"].toUpperCase().includes("DUPLICATE")){ + alert("Email Already Subscribed!"); + } + } + } + }}> + setEmail(e.target.value)}name="email" type="email" className="input-newsletter" value={email} placeholder="Enter your business email here" />
diff --git a/components/Yamaha/AboutUs/AboutUs.js b/components/Yamaha/AboutUs/AboutUs.js index 1b3f02f..f6a5326 100644 --- a/components/Yamaha/AboutUs/AboutUs.js +++ b/components/Yamaha/AboutUs/AboutUs.js @@ -54,7 +54,7 @@ const About1 = () => {

Ingin Info Lebih Lanjut ?

Tanyakan Kepada Pihak Kami Untuk Info Lebih Lanjutnya

- + Contact Us diff --git a/components/_App/Footer.js b/components/_App/Footer.js index 12a019e..7960775 100644 --- a/components/_App/Footer.js +++ b/components/_App/Footer.js @@ -1,5 +1,6 @@ import React from 'react'; -import Link from 'next/link'; +// import Link from 'next/link'; +import { Link } from 'react-scroll'; import * as Icon from 'react-feather'; const Footer = () => { @@ -13,7 +14,7 @@ const Footer = () => {
- + logo @@ -28,35 +29,91 @@ const Footer = () => {

Menu

-
+ {/*

Support

    @@ -87,9 +144,9 @@ const Footer = () => {
-
+
*/} -
+

Address

@@ -109,23 +166,23 @@ const Footer = () => {
  • - +
  • - +
  • - +
  • - - + +
diff --git a/components/_App/FooterYamaha.js b/components/_App/FooterYamaha.js index 2b0e8c8..a0b98ea 100644 --- a/components/_App/FooterYamaha.js +++ b/components/_App/FooterYamaha.js @@ -42,21 +42,26 @@ const Footer = () => { Latest News -
  • + {/*
  • Carrer -
  • + */}
  • About Us
  • +
  • + + Contact Us + +
  • -
    + {/*

    Support

    -
    +
    */} -
    +

    Address

    @@ -109,23 +114,23 @@ const Footer = () => {
    • - +
    • - +
    • - +
    • - - + +
    diff --git a/components/_App/NavbarHome.js b/components/_App/NavbarHome.js index 6f208b7..b172be8 100644 --- a/components/_App/NavbarHome.js +++ b/components/_App/NavbarHome.js @@ -31,7 +31,7 @@ const NavbarStyleFour = () => {
    -
    - +
    {!username || username == "" ? ( @@ -176,10 +175,10 @@ export default function NavbarYamaha({ username, ...props }) { }).then((res) => { //if (res.ok) { window.location.href = "../yamaha"; - /*} - else{ + // } + // else{ - }*/ + // } }); }} > diff --git a/config/apollo-config.js b/config/apollo-config.js index 191e2ac..c6d9e29 100644 --- a/config/apollo-config.js +++ b/config/apollo-config.js @@ -1,6 +1,6 @@ // Apollo Value Configuration const ApolloConfig = { - graphql_uri: process.env.API_GRAPHQL_URI, + graphql_uri: process.env.NEXT_PUBLIC_API_GRAPHQL_URI, }; export default ApolloConfig; diff --git a/env-example b/env-example index f861480..c099582 100644 --- a/env-example +++ b/env-example @@ -1,5 +1,4 @@ -API_URL=#STRAPI URL# -API_GRAPHQL_URI=#STRAPI URL#/graphql +NEXT_PUBLIC_API_GRAPHQL_URI=#STRAPI URL#/graphql BACKEND_SERVER_URI =#STRAPI URL# PORT=#PORT# diff --git a/lib/apollo.js b/lib/apollo.js index e5de7aa..5e4076e 100644 --- a/lib/apollo.js +++ b/lib/apollo.js @@ -51,7 +51,7 @@ async function query(query, token = "", variables = {}, cache = false) { }); res = { STATUS: 1, DATA: sql.data }; } catch (e) { - res = { STATUS: 0, DATA: errorHandler(e) }; + res = { STATUS: 0, DATA: e.message }; } return res; } @@ -68,8 +68,8 @@ async function mutation(mutation, token = "", variables = {}) { }); res = { STATUS: 1, DATA: sql.data }; } catch (e) { - console.log(e.networkError.result); - res = { STATUS: 0, DATA: errorHandler(e) }; + // console.log(mutation,e); + res = { STATUS: 0, DATA: e.message }; } return res; } diff --git a/public/css/style.css b/public/css/style.css index dec496a..698aa4c 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -10630,12 +10630,22 @@ Footer CSS } .single-footer-widget ul.social-links li a.instagram { - border-color: #231F20; - color: #231F20; + border-color: #bb58aa; + color: #bb58aa; } .single-footer-widget ul.social-links li a.instagram:hover { - background: #231F20; + background: #bb58aa; + color: #ffffff; +} + +.single-footer-widget ul.social-links li a.youtube { + border-color: #cf3259; + color: #cf3259; +} + +.single-footer-widget ul.social-links li a.youtube:hover { + background: #cf3259; color: #ffffff; } diff --git a/public/css/style.scss b/public/css/style.scss index 84d63ee..7694607 100644 --- a/public/css/style.scss +++ b/public/css/style.scss @@ -4909,11 +4909,20 @@ Shop Details CSS } } &.instagram { - border-color: #231F20; - color: #231F20; + border-color: #bb58aa; + color: #bb58aa; &:hover { - background: #231F20; + background: #bb58aa; + color: $white-color; + } + } + &.youtube { + border-color: #cf3259; + color: #cf3259; + + &:hover { + background: #cf3259; color: $white-color; } } diff --git a/server.js b/server.js index 3225375..3ad5bb5 100644 --- a/server.js +++ b/server.js @@ -7,7 +7,6 @@ const app = next({ dev }); const handle = app.getRequestHandler(); // require("dotenv").config(); -console.log(process.env.PORT); const port = process.env.PORT || "14009"; app.prepare().then(() => {