From 858dd399368ab024ab2cdb71763139f4cd3db316 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 30 Aug 2025 12:46:32 -0400 Subject: [PATCH] Improve contacts --- src/component/contacts/Contacts.js | 348 +++++++++++--------- src/component/layout/layoutcom/UserMenu.jsx | 4 +- 2 files changed, 188 insertions(+), 164 deletions(-) diff --git a/src/component/contacts/Contacts.js b/src/component/contacts/Contacts.js index 61e7332..90a69b0 100644 --- a/src/component/contacts/Contacts.js +++ b/src/component/contacts/Contacts.js @@ -1,13 +1,13 @@ "use client" -import React, { useEffect, useState } from "react"; +import React, {useEffect, useState} from "react"; import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS"; import getImage from "../../utils/getImage"; -import { useMutation, useQuery } from "@tanstack/react-query"; -import { contactData } from "../../services/services"; +import {useMutation, useQuery} from "@tanstack/react-query"; +import {contactData} from "../../services/services"; import queryKeys from "../../services/queryKeys"; import getCustomTime from "../../utils/getCustomTime"; -export default function Contacts(){ +export default function Contacts() { // const {data:contacts, isFetching, isError, error} = useQuery({ // queryKey: queryKeys.contacts, @@ -21,7 +21,7 @@ export default function Contacts(){ const [filteredContactData, setFiltererdContactData] = useState([]) - + const getContactData = useMutation({ mutationFn: (reqData) => { return contactData(reqData) @@ -30,7 +30,7 @@ export default function Contacts(){ console.log(error) }, onSuccess: (res) => { - if(res?.data?.resultCode != '0'){ + if (res?.data?.resultCode != '0') { throw({message: 'Something went wrong'}) } setFiltererdContactData(res?.data?.contacts) @@ -46,30 +46,30 @@ export default function Contacts(){ const changeActiveCategoryUID = (id) => { let filteredConData = [] setActiveCategoryUID(id) - if(id == '0'){ + if (id == '0') { filteredConData = contactsData - }else{ + } else { filteredConData = contactsData.filter(item => item.category == id) } setFiltererdContactData(filteredConData) changeActiveUID(filteredConData[0]?.uid) } - useEffect(()=>{ - let reqData = { - token: localStorage.getItem('token'), // USER TOKEN - uid: localStorage.getItem('uid') // USER UID - } - getContactData.mutate(reqData) - },[]) + useEffect(() => { + let reqData = { + token: localStorage.getItem('token'), // USER TOKEN + uid: localStorage.getItem('uid') // USER UID + } + getContactData.mutate(reqData) + }, []) const contactsData = getContactData?.data?.data?.contacts // LIST OF CONTACTS const contactsCategory = getContactData?.data?.data?.category // LIST OF CATEGORY - return( + return ( <> - - {getContactData?.isPending ? + + {getContactData?.isPending ? <>
@@ -78,61 +78,69 @@ export default function Contacts(){
: getContactData?.error ? -
-
-

{getContactData?.error?.message}

+
+
+

{getContactData?.error?.message}

+
-
- : -
- {/*
Coming Soon
*/} -
-
-
-
-
-
-
-
-
- + : +
+ {/*
Coming Soon
*/} +
+
+
+
+
+
+
+
+
+ +
-
-
-
- -
    -
  • changeActiveCategoryUID('0')} style={{cursor: 'pointer'}}> +
      +
    • changeActiveCategoryUID('0')} + style={{cursor: 'pointer'}}>
      @@ -144,9 +152,11 @@ export default function Contacts(){
    • - {contactsCategory && contactsCategory.map(item => ( -
    • changeActiveCategoryUID(`${item?.cid}`)} style={{cursor: 'pointer'}}> -
      + {contactsCategory && contactsCategory.map(item => ( +
    • changeActiveCategoryUID(`${item?.cid}`)} + style={{cursor: 'pointer'}}> +
      @@ -155,10 +165,10 @@ export default function Contacts(){ {item?.description} -
      -
    • - ))} - {/*
    • +
+ + ))} + {/*
  • @@ -182,127 +192,141 @@ export default function Contacts(){
  • */} - + +
    -
    -
    -
    -
    -
    -
    - {/*
    */} - {/* */} - {/* */} - {/*
    */} +
    +
    +
    +
    +
    + {/*
    */} + {/* */} + {/* */} + {/*
    */} +
    -
    -
    - {contactsData && filteredContactData?.map((contact, index)=> { - const isActive = (contact?.uid == activeContactUID) || (!activeContactUID && index == 0) - return ( -
    changeActiveUID(contact?.uid)} className={`mail-msg-item ${isActive && 'bg-light'}`}> - -
    -
    -
    - user +
    + {contactsData && filteredContactData?.map((contact, index) => { + const isActive = (contact?.uid == activeContactUID) || (!activeContactUID && index == 0) + return ( + - -
    - ) - })} + +
    + ) + })} +
    -
    -
    +
    -
    -
    -
    - user +
    +
    +
    + user +
    +
    +

    {activeContactUID ? activeDetail[0]?.sender : filteredContactData[0]?.sender}

    +

    {activeContactUID ? new Date(activeDetail[0]?.added).toDateString() : new Date(filteredContactData[0]?.added).toDateString()}

    +
    +
    +
    +
    +

    {activeContactUID ? activeDetail[0]?.title : filteredContactData[0]?.title}

    +
    +
    + {/**/} + {/**/} +
    -

    {activeContactUID ? activeDetail[0]?.sender : filteredContactData[0]?.sender}

    -

    {activeContactUID ? new Date(activeDetail[0]?.added).toDateString() : new Date(filteredContactData[0]?.added).toDateString()}

    -
    -
    -
    -
    -

    {activeContactUID ? activeDetail[0]?.title : filteredContactData[0]?.title}

    -
    -
    - {/**/} - {/**/} -
    -
    -
    -

    {activeContactUID ? activeDetail[0]?.message : filteredContactData[0]?.message}

    - {/*

    hey adminjon...

    +

    {activeContactUID ? activeDetail[0]?.message : filteredContactData[0]?.message}

    + {/*

    hey adminjon...

    I truly believe Augustine’s words are true and if you look at history you know it is true. There are many people in the world with amazing talents who realize only a small percentage of their potential. We all know people who live this truth.

    We also know those epic stories, those modern-day legends surrounding the early failures of such supremely successful folks as Michael Jordan and Bill Gates. We can look a bit further back in time to Albert Einstein or even further back to Abraham Lincoln. What made each of these people so successful? Motivation.

    We know this in our gut, but what can we do about it? How can we motivate ourselves? One of the most difficult aspects of achieving success is staying motivated over the long haul.

    */} - {/*
    */} - {/*

    Have lovely Day,

    */} - {/*

    adminjon

    */} - {/*
    */} + {/*
    */} + {/*

    Have lovely Day,

    */} + {/*

    adminjon

    */} + {/*
    */} +
    -
    -
    -
    -

    Click here to ReplyorForward

    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - {/*
      */} - {/*
    • */} - {/*
    • */} - {/*
    • */} - {/*
    */} -
    -
    - {/*Send */} -
    -
    + {/*
    */} + {/*
    */} + {/*

    Click here to ReplyorForward

    */} + {/* */} + {/*
    */} + {/*
    */} + {/*
    */} + {/* */} + {/*
    */} + {/*
    */} + {/*
    */} + {/*
    */} + {/* */} + {/*
    */} + {/*
    */} + {/*
    */} + {/*
    */} + {/* /!*
      *!/*/} + {/* /!*
    • *!/*/} + {/* /!*
    • *!/*/} + {/* /!*
    • *!/*/} + {/* /!*
    *!/*/} + {/*
    */} + {/*
    */} + {/* /!*Send *!/*/} + {/*
    */} + {/*
    */} + {/*
    */}
    -
    } ) diff --git a/src/component/layout/layoutcom/UserMenu.jsx b/src/component/layout/layoutcom/UserMenu.jsx index 8e1090c..3c933b9 100644 --- a/src/component/layout/layoutcom/UserMenu.jsx +++ b/src/component/layout/layoutcom/UserMenu.jsx @@ -30,8 +30,8 @@ export default function UserMenu() {
    • Home
    • Calendar
    • -
    • Contacts
    • -
    • Comments
    • +
    • Sites Contacts
    • +
    • Sites Comments