diff --git a/Nexia/src/Nexia/SystemAtm/screens/ConfigurationAtm.tsx b/Nexia/src/Nexia/SystemAtm/screens/ConfigurationAtm.tsx
index d762f3b..6d0940f 100644
--- a/Nexia/src/Nexia/SystemAtm/screens/ConfigurationAtm.tsx
+++ b/Nexia/src/Nexia/SystemAtm/screens/ConfigurationAtm.tsx
@@ -64,6 +64,8 @@ export const ConfigurationPanel = () => {
fetchUser()
}, [])
+
+ // Set theme
const handleSetTheme = (gradient: string) => {
localStorage.setItem("atmTheme", gradient)
window.dispatchEvent(new Event("themeChange"))
@@ -83,7 +85,7 @@ export const ConfigurationPanel = () => {
{!user ? (
- ) : !isGoogleUser ? (
+ ) : isGoogleUser ? (
<>
Perfil
diff --git a/Nexia/src/Nexia/SystemAtm/screens/leaderboard/components/TopLeaderboard.tsx b/Nexia/src/Nexia/SystemAtm/screens/leaderboard/components/TopLeaderboard.tsx
index 439fc45..7343076 100644
--- a/Nexia/src/Nexia/SystemAtm/screens/leaderboard/components/TopLeaderboard.tsx
+++ b/Nexia/src/Nexia/SystemAtm/screens/leaderboard/components/TopLeaderboard.tsx
@@ -1,6 +1,9 @@
/* Icons */
import { Crown } from "lucide-react";
+/* Images */
+import user from "../../../../../assets/Icons/user_light.svg"
+
/* Utils */
import { formatValue, getMetricValue } from "../utils/leaderboard.utils";
@@ -10,7 +13,11 @@ export const TopLeaderboard = ({ top3, balance, metric }: any) => (
<>
{[1, 0, 2].map((pos, idx) => (
- {top3[pos]?.avatar &&

}
+ {top3[pos]?.avatar ?
+

+ :
+

+ }
diff --git a/Nexia/src/Nexia/SystemPhone/Apps/ContactApp.tsx b/Nexia/src/Nexia/SystemPhone/Apps/ContactApp.tsx
index 2afb092..8ccd575 100644
--- a/Nexia/src/Nexia/SystemPhone/Apps/ContactApp.tsx
+++ b/Nexia/src/Nexia/SystemPhone/Apps/ContactApp.tsx
@@ -4,11 +4,14 @@ import { useEffect, useState } from "react"
/* Images */
import user from "../../../assets/Icons/user_light.svg"
+/* Icons */
+import { Trash } from "lucide-react"
+
/* Components */
import { LoadingIcon } from "../../components/loading.ldrs"
/* Services */
-import { getContacts } from "../../services/external/contacts/contacts.service"
+import { deleteContact, getContacts, updateContact } from "../../services/external/contacts/contacts.service"
@@ -20,6 +23,9 @@ type Contact = {
}
const ContactApp = () => {
const [data, setData] = useState([])
+ const [editingId, setEditingId] = useState(null)
+ const [editValue, setEditValue] = useState("")
+ const [trash, setTrash] = useState(false)
// Success send data
const [success, setSuccess] = useState(false)
@@ -31,7 +37,7 @@ const ContactApp = () => {
const [exitError, setExitError] = useState(false)
-
+ // Get contact
const fetchUser = async () => {
try {
@@ -39,6 +45,54 @@ const ContactApp = () => {
setData(res.data)
+ } catch (error: any) {
+
+ const message =
+ error?.response?.data?.message ||
+ error?.response?.data?.error ||
+ error?.message ||
+ "Error inesperado"
+
+ setErrorMsg(message)
+ setError(true)
+ setExitError(false)
+
+ setTimeout(() => setExitError(true), 2000)
+
+ setTimeout(() => {
+ setError(false)
+ setErrorMsg(null)
+ }, 2300)
+
+ }
+ }
+
+ useEffect(() => {
+ fetchUser()
+ }, [])
+
+
+ // Save contact
+ const saveContact = async (contact_id: number, newName: string) => {
+ try {
+
+ if (!newName) return null
+
+ await updateContact(contact_id, newName.trim())
+
+ // Actualización optimista
+ setData(prev =>
+ prev.map(contact =>
+ contact.contact_id === contact_id
+ ? { ...contact, name_contact: newName.trim() }
+ : contact
+ )
+ )
+
+ setEditingId(null)
+ setEditValue("")
+
+
setSuccess(true)
setVisible(false)
@@ -47,7 +101,7 @@ const ContactApp = () => {
// Delete animation success
setTimeout(() => setSuccess(false), 2300)
-
+
} catch (error: any) {
const message =
@@ -69,20 +123,58 @@ const ContactApp = () => {
}
}
- useEffect(() => {
- fetchUser()
- }, [])
+
+
+ // Delete contact
+ const deleteCon = async (contact_id: number) => {
+ try {
+
+ await deleteContact(contact_id)
+
+ await fetchUser()
+
+
+ setSuccess(true)
+ setVisible(false)
+
+ // Enter animation success
+ setTimeout(() => setVisible(true), 2000)
+
+ // Delete animation success
+ setTimeout(() => setSuccess(false), 2300)
+
+ } catch (error: any) {
+
+ const message =
+ error?.response?.data?.message ||
+ error?.response?.data?.error ||
+ error?.message ||
+ "Error inesperado"
+
+ setErrorMsg(message)
+ setError(true)
+ setExitError(false)
+
+ setTimeout(() => setExitError(true), 2000)
+
+ setTimeout(() => {
+ setError(false)
+ setErrorMsg(null)
+ }, 2300)
+
+ }
+ }
return (
<>
-
+
Contactos
+ {/* Contacts */}
-
{data === null ? (
@@ -93,28 +185,82 @@ const ContactApp = () => {
) : (
<>
- {data.map(c => (
-
-
+ {data.map((c) => (
+
+ {trash && (
+
+ )}
+
))}
>
)}
-
+
+
+ {/* Success */}
+ {success && (
+
+ ✔
+
+ )}
+
+ {/* Error */}
+ {error && (
+
+ {errorMsg}
+
+ )}
>
)
}
diff --git a/Nexia/src/Nexia/SystemPhone/Apps/Settings/SettingsApp.tsx b/Nexia/src/Nexia/SystemPhone/Apps/Settings/SettingsApp.tsx
index 8058e86..3cf894e 100644
--- a/Nexia/src/Nexia/SystemPhone/Apps/Settings/SettingsApp.tsx
+++ b/Nexia/src/Nexia/SystemPhone/Apps/Settings/SettingsApp.tsx
@@ -45,6 +45,9 @@ const SettingsApp = () => {
// Screens configuration render
const [options, setOptions] = useState
("settings")
+ // Search options
+ const [searchValue, setSearchValue] = useState("")
+
// Container from icons
type Options = {
id: number
@@ -70,6 +73,11 @@ const SettingsApp = () => {
{ id: 15, containImage: "settings-comments", src: comment, alt: "Comentarios", description: "Servicios y comentarios", optionRender: "services" },
]
+ // Filter menu options
+ const filteredOptions = optionsSettings.filter(v =>
+ v.description.toLowerCase().includes(searchValue.toLowerCase())
+ )
+
return (
@@ -88,11 +96,13 @@ const SettingsApp = () => {
className="input-app-settings"
type="text"
placeholder="Buscar en Ajustes"
+ value={searchValue}
+ onChange={(e) => setSearchValue(e.target.value)}
/>
- {optionsSettings.map((v, i) => (
+ {filteredOptions.map((v, i) => (
<>