From 494c1f3271c810430fe34ae24bdf5b54d5502032 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Sat, 15 Jul 2023 08:00:25 +0100 Subject: [PATCH 1/3] account settings API added --- .../Settings/Tabs/NotificationSettingTab.jsx | 301 +++++------------- src/services/UsersService.js | 11 + 2 files changed, 86 insertions(+), 226 deletions(-) diff --git a/src/components/Settings/Tabs/NotificationSettingTab.jsx b/src/components/Settings/Tabs/NotificationSettingTab.jsx index 85dffc8..c8571a2 100644 --- a/src/components/Settings/Tabs/NotificationSettingTab.jsx +++ b/src/components/Settings/Tabs/NotificationSettingTab.jsx @@ -1,237 +1,86 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import SwitchCom from "../../Helpers/SwitchCom"; +import LoadingSpinner from "../../Spinners/LoadingSpinner"; +import usersService from "../../../services/UsersService"; +import localImgLoad from "../../../lib/localImgLoad"; + +import defaultImage from '../../../assets/images/banner-job-due.jpg' + + export default function NotificationSettingTab() { - const [updateNotification, setUpdateNotification] = useState(false); - const [uploadProduct, setUploadProduct] = useState(true); - const [saleProduct, setSaleProduct] = useState(true); - const [getProduct, setGetProduct] = useState(false); - const [authLevel, setAuthLevel] = useState(true); + const api = new usersService(); + + const [accSettings, setAccSettings] = useState({loading: true, data: []}) // STATE TO HOLD ACCOUNT SETTINGS + + // const [updateNotification, setUpdateNotification] = useState(false); + // const [uploadProduct, setUploadProduct] = useState(true); + // const [saleProduct, setSaleProduct] = useState(true); + // const [getProduct, setGetProduct] = useState(false); + // const [authLevel, setAuthLevel] = useState(true); + + const handleNotificationChange = (item) => { + setAccSettings(prev => { + let newAccSettings = prev.data.map(data => { + if(data.uid == item.uid){ + let newPrefValue = data.pref_value == null || data.pref_value == false ? true : false + return {...data, pref_value: newPrefValue} + }else{ + return data + } + }) + return {...prev, data: newAccSettings} + }) + } + + useEffect(()=>{ + api.getAccSettings().then(res => { + setAccSettings({loading: false, data: res.data?.result_list || []}) + }).catch(errer => { + setAccSettings({loading: false, data: []}) + }) + },[]) + return (
-
    -
  • -
    -
    - - - - - - - - - - - - +
      + {accSettings.loading ? + + : + accSettings.data.length ? + accSettings.data.map(item =>{ + console.log(item) + let image = '' //item.banner && localImgLoad(`images/payment-cards/${item.banner.toLowerCase()}`) + return( +
    • +
      +
      + account-settings +
      +
      +

      + {item.title} +

      +

      + {item.description} +

      +
      -
      -

      - All Notifcation update off -

      -

      - Unlockable content, only revealed by the owner of the item. -

      +
      + handleNotificationChange(item)} + // value={updateNotification} + // handler={() => setUpdateNotification(!updateNotification)} + />
      -
      -
      - setUpdateNotification(!updateNotification)} - /> -
      -
    • -
    • -
      -
      - - - - - - -
      -
      -

      - When you upload prodcuts -

      -

      - Evey new prodcuts upload seccessfullly doen you can get - notifcation -

      -
      -
      -
      - setUploadProduct(!uploadProduct)} - /> -
      -
    • -
    • -
      -
      - - - - - - - - -
      -
      -

      - You got sell your prodcuts -

      -

      - Evey new prodcuts sell you can get notifcation -

      -
      -
      -
      - setSaleProduct(!saleProduct)} - /> -
      -
    • -
    • -
      -
      - - - - - - -
      -
      -

      - Got new follower -

      -

      - Evey new follower you can get notifcation -

      -
      -
      -
      - setGetProduct(!getProduct)} - /> -
      -
    • -
    • -
      -
      - - - - -
      -
      -

      - Auther leavel up -

      -

      - Evey new prodcuts sell you can get notifcation -

      -
      -
      -
      - setAuthLevel(!authLevel)} - /> -
      -
    • + + )} + ) + : +

      No Cards Found

      + }
    diff --git a/src/services/UsersService.js b/src/services/UsersService.js index 79cb4a4..b143d6b 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -933,6 +933,17 @@ class usersService { return this.postAuxEnd("/profilepasschange", postData); } + // FUNCTION TO GET ACCOUNT SETTINGS + getAccSettings() { + var postData = { + uid: localStorage.getItem("uid"), + member_id: localStorage.getItem("member_id"), + sessionid: localStorage.getItem("session_token"), + action: 11059, + }; + return this.postAuxEnd("/getaccsettings", postData); + } + /* - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username) - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password) From c1af2b7fc93135fb952212458f21ac7fd3a27be1 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Sat, 15 Jul 2023 08:06:44 +0100 Subject: [PATCH 2/3] logged info removed --- src/components/Settings/Tabs/NotificationSettingTab.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Settings/Tabs/NotificationSettingTab.jsx b/src/components/Settings/Tabs/NotificationSettingTab.jsx index c8571a2..07e2a44 100644 --- a/src/components/Settings/Tabs/NotificationSettingTab.jsx +++ b/src/components/Settings/Tabs/NotificationSettingTab.jsx @@ -50,7 +50,6 @@ export default function NotificationSettingTab() { : accSettings.data.length ? accSettings.data.map(item =>{ - console.log(item) let image = '' //item.banner && localImgLoad(`images/payment-cards/${item.banner.toLowerCase()}`) return(
  • From 9cf6d137161c5690e8c19f68cbdc71f8fcef31a4 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 15 Jul 2023 04:37:52 -0400 Subject: [PATCH 3/3] images --- src/assets/images/payment-cards/american-express-card.svg | 1 + src/assets/images/settings/settings.svg | 1 + 2 files changed, 2 insertions(+) create mode 100644 src/assets/images/payment-cards/american-express-card.svg create mode 100644 src/assets/images/settings/settings.svg diff --git a/src/assets/images/payment-cards/american-express-card.svg b/src/assets/images/payment-cards/american-express-card.svg new file mode 100644 index 0000000..bbb0364 --- /dev/null +++ b/src/assets/images/payment-cards/american-express-card.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/images/settings/settings.svg b/src/assets/images/settings/settings.svg new file mode 100644 index 0000000..c608904 --- /dev/null +++ b/src/assets/images/settings/settings.svg @@ -0,0 +1 @@ + \ No newline at end of file