From 7fb4702fefd2b0e5332808c82ba9a3f50792aa7e Mon Sep 17 00:00:00 2001 From: dappsar Date: Mon, 14 Oct 2024 22:01:07 -0300 Subject: [PATCH 01/27] [feat] :alien: update api to update user (#57) --- src/app/api/_data/data-service.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/api/_data/data-service.ts b/src/app/api/_data/data-service.ts index 70afa64..095791d 100644 --- a/src/app/api/_data/data-service.ts +++ b/src/app/api/_data/data-service.ts @@ -94,6 +94,14 @@ export async function updateUserCode(userId: string, code: number | undefined): return result } +export async function updateUser(contact: IAccount): Promise { + const filter = { _id: getObjectId(contact.id) } + const updateData = { name: contact.name } + const setValue = { $set: updateData } + const result: boolean = await updateOneCommon(DB_CHATTERPAY_NAME, SCHEMA_USERS, filter, setValue) + return result +} + export async function getWalletNfts(wallet: string): Promise { const client = await getClientPromise() const db = client.db(DB_CHATTERPAY_NAME) @@ -179,12 +187,12 @@ export async function getWalletNfts(wallet: string): Promise return nfts } -export async function getNftById(id: string): Promise { +export async function getNftById(nftId: string): Promise { const client = await getClientPromise() const db = client.db(DB_CHATTERPAY_NAME) const nft: INFT | null = await db.collection(SCHEMA_NFTS).findOne({ - id + id: nftId }) if (!nft) { From 1aeafef5462ee40b278784335f0ec3b0daad8865 Mon Sep 17 00:00:00 2001 From: dappsar Date: Mon, 14 Oct 2024 22:01:52 -0300 Subject: [PATCH 02/27] [chore] :mute: remove logs --- src/app/api/v1/nft/[id]/route.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/api/v1/nft/[id]/route.ts b/src/app/api/v1/nft/[id]/route.ts index 33c8631..9b23bed 100644 --- a/src/app/api/v1/nft/[id]/route.ts +++ b/src/app/api/v1/nft/[id]/route.ts @@ -33,7 +33,6 @@ export async function GET(request: Request, { params }: { params: IParams }) { try { const nft: INFT | undefined = await getNftById(params.id) - console.log('3', params, nft) if (nft) { return NextResponse.json(nft) From 88ba00b71e8002a4406a38e8cb1d5a1f7258156f Mon Sep 17 00:00:00 2001 From: dappsar Date: Mon, 14 Oct 2024 22:03:04 -0300 Subject: [PATCH 03/27] [feat] :alien: add logic tu update user (#57) --- src/app/api/_hooks/api-resolver.ts | 3 +- src/app/api/_hooks/use-contact.ts | 7 +++- src/app/api/v1/user/[id]/route.ts | 59 +++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/app/api/_hooks/api-resolver.ts b/src/app/api/_hooks/api-resolver.ts index 9be071d..58d2754 100644 --- a/src/app/api/_hooks/api-resolver.ts +++ b/src/app/api/_hooks/api-resolver.ts @@ -54,7 +54,8 @@ export const endpoints = { dashboard: { root: getFullUIEndpoint('app'), user: { - id: (id: string) => getFullUIEndpoint(`user/${id}`) + id: (id: string) => getFullUIEndpoint(`user/${id}`), + update: (id: string) => getFullUIEndpoint(`user/${id}`) }, wallet: { balance: (id: string) => getFullUIEndpoint(`wallet/${id}/balance`), diff --git a/src/app/api/_hooks/use-contact.ts b/src/app/api/_hooks/use-contact.ts index 527c5da..68f8629 100644 --- a/src/app/api/_hooks/use-contact.ts +++ b/src/app/api/_hooks/use-contact.ts @@ -1,4 +1,4 @@ -import { endpoints } from 'src/app/api/_hooks/api-resolver' +import { post, endpoints } from 'src/app/api/_hooks/api-resolver' import { useGetCommon } from './common' @@ -7,3 +7,8 @@ import { useGetCommon } from './common' export function useGetContact(contactId: string) { return useGetCommon(endpoints.dashboard.user.id(contactId)) } + +export async function updateContact(userId: string, data: { name: string }) { + const res = await post(endpoints.dashboard.user.update(userId), data, {}) + return res +} diff --git a/src/app/api/v1/user/[id]/route.ts b/src/app/api/v1/user/[id]/route.ts index 3c1faa3..d9c3596 100644 --- a/src/app/api/v1/user/[id]/route.ts +++ b/src/app/api/v1/user/[id]/route.ts @@ -1,6 +1,6 @@ -import { NextResponse } from 'next/server' +import { NextRequest, NextResponse } from 'next/server' -import { getUserByPhone } from 'src/app/api/_data/data-service' +import { updateUser, getUserById, getUserByPhone } from 'src/app/api/_data/data-service' import { IAccount } from 'src/types/account' @@ -56,3 +56,58 @@ export async function GET(request: Request, { params }: { params: IParams }) { }) } } + +export async function POST(req: NextRequest, { params }: { params: IParams }) { + try { + const { id } = params + const { name }: { name: string } = await req.json() + + if (!name || !id) { + return new NextResponse( + JSON.stringify({ + code: 'INVALID_REQUEST_PARAMS', + error: 'Missing id or name in request body' + }), + { + status: 400, + headers: { 'Content-Type': 'application/json' } + } + ) + } + + const user: IAccount | undefined = await getUserById(id) + if (!user) { + return new NextResponse( + JSON.stringify({ code: 'USER_NOT_FOUND', error: 'user not found with that id' }), + { + status: 404, + headers: { 'Content-Type': 'application/json' } + } + ) + } + + user.name = name + const reult: boolean = await updateUser(user) + + if (!reult) { + return new NextResponse( + JSON.stringify({ + code: 'USER_UPDATE_ERROR', + error: 'user update error' + }), + { + status: 400, + headers: { 'Content-Type': 'application/json' } + } + ) + } + + return NextResponse.json({ reult }) + } catch (ex) { + console.error(ex) + return new NextResponse(JSON.stringify({ error: 'Error in update user' }), { + status: 400, + headers: { 'Content-Type': 'application/json' } + }) + } +} From bab3ffb7d01a5796f86fe71e28c849d429f59e7b Mon Sep 17 00:00:00 2001 From: dappsar Date: Mon, 14 Oct 2024 22:04:21 -0300 Subject: [PATCH 04/27] [feat] :technologist: improve updateCommon to return true when no-records update --- src/app/api/_data/mongo-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/_data/mongo-utils.ts b/src/app/api/_data/mongo-utils.ts index 6f25e87..c31d20f 100644 --- a/src/app/api/_data/mongo-utils.ts +++ b/src/app/api/_data/mongo-utils.ts @@ -42,7 +42,7 @@ export async function updateOneCommon( `updated ${colName}: ${matchedDocuments} document(s) found and ${modifiedDocuments} document(s) updated.` ) - return result.modifiedCount > 0 + return result.modifiedCount > 0 || matchedDocuments > 0 } finally { // NONE } From 7960fc39dfbcaa663f53134707c8905ba2e40bf3 Mon Sep 17 00:00:00 2001 From: dappsar Date: Mon, 14 Oct 2024 22:05:16 -0300 Subject: [PATCH 05/27] [feat] :sparkles: add wallhaven as image provider in config --- next.config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/next.config.js b/next.config.js index e370b02..0b2a57b 100644 --- a/next.config.js +++ b/next.config.js @@ -19,6 +19,7 @@ module.exports = { 'storage.googleapis.com', 'cilxj-yiaaa-aaaag-alkxq-cai.icp0.io', 'gateway.pinata.cloud', + 'w.wallhaven.cc', 'img.freepik.com'], remotePatterns: [ { @@ -44,6 +45,12 @@ module.exports = { hostname: 'img.freepik.com', port: '', pathname: '/**', + }, + { + protocol: 'https', + hostname: 'w.wallhaven.cc', + port: '', + pathname: '/**', } ], }, From d461e914b9f6f8136d402a71094414d428f45065 Mon Sep 17 00:00:00 2001 From: dappsar Date: Wed, 16 Oct 2024 19:38:07 -0300 Subject: [PATCH 06/27] [feat] :sparkles: add updateUser to context (#57) --- src/auth/context/jwt/auth-provider.tsx | 87 +++++++++++++++----------- src/auth/types.ts | 1 + 2 files changed, 52 insertions(+), 36 deletions(-) diff --git a/src/auth/context/jwt/auth-provider.tsx b/src/auth/context/jwt/auth-provider.tsx index 05be150..ede90b1 100644 --- a/src/auth/context/jwt/auth-provider.tsx +++ b/src/auth/context/jwt/auth-provider.tsx @@ -16,7 +16,8 @@ enum Types { LOGIN = 'LOGIN', GENERATE_CODE = 'GENERATE_CODE', REGISTER = 'REGISTER', - LOGOUT = 'LOGOUT' + LOGOUT = 'LOGOUT', + UPDATE_USER = 'UPDATE_USER' } type Payload = { @@ -33,6 +34,9 @@ type Payload = { user: AuthUserType } [Types.LOGOUT]: undefined + [Types.UPDATE_USER]: { + user: AuthUserType + } } type ActionsType = ActionMapType[keyof ActionMapType] @@ -45,40 +49,40 @@ const initialState: AuthStateType = { } const reducer = (state: AuthStateType, action: ActionsType) => { - if (action.type === Types.INITIAL) { - return { - loading: false, - user: action.payload.user - } - } - if (action.type === Types.LOGIN) { - return { - ...state, - user: action.payload.user - } - } - - if (action.type === Types.GENERATE_CODE) { - return { - ...state, - user: null - } - } - - if (action.type === Types.REGISTER) { - return { - ...state, - user: action.payload.user - } - } - - if (action.type === Types.LOGOUT) { - return { - ...state, - user: null - } + switch (action.type) { + case Types.INITIAL: + return { + loading: false, + user: action.payload.user + } + case Types.LOGIN: + return { + ...state, + user: action.payload.user + } + case Types.GENERATE_CODE: + return { + ...state, + user: null + } + case Types.REGISTER: + return { + ...state, + user: action.payload.user + } + case Types.LOGOUT: + return { + ...state, + user: null + } + case Types.UPDATE_USER: // <-- Manejar la acción UPDATE_USER + return { + ...state, + user: action.payload.user + } + default: + return state } - return state } // ---------------------------------------------------------------------- @@ -241,6 +245,16 @@ export function AuthProvider({ children }: Props) { }) }, []) + // update_user + const updateUser = useCallback((user: AuthUserType) => { + dispatch({ + type: Types.UPDATE_USER, + payload: { + user + } + }) + }, []) + // ---------------------------------------------------------------------- const checkAuthenticated = state.user ? 'authenticated' : 'unauthenticated' @@ -259,9 +273,10 @@ export function AuthProvider({ children }: Props) { loginWithCode, generateCode, register, - logout + logout, + updateUser }), - [generateCode, login, loginWithCode, logout, register, state.user, status] + [generateCode, login, loginWithCode, logout, register, state.user, status, updateUser] ) return {children} diff --git a/src/auth/types.ts b/src/auth/types.ts index 48328ef..8530a44 100644 --- a/src/auth/types.ts +++ b/src/auth/types.ts @@ -51,4 +51,5 @@ export type JWTContextType = CanRemove & { generateCode: (email: string, codeMsg: string, recaptchaToken: string) => Promise register: (email: string, password: string, firstName: string, lastName: string) => Promise logout: () => Promise + updateUser: (user: AuthUserType) => void } From 97a532cb4adbd2e2e9187401ee8aa559d490337d Mon Sep 17 00:00:00 2001 From: dappsar Date: Wed, 16 Oct 2024 19:39:03 -0300 Subject: [PATCH 07/27] [feat] :sparkles: add business logic to update user name (#57) --- src/app/dashboard/user/account/page.tsx | 4 +- src/locales/langs/br.json | 12 +- src/locales/langs/en.json | 10 +- src/locales/langs/es.json | 10 +- .../account/account-change-password.tsx | 126 ------------------ src/sections/account/account-general.tsx | 70 ++++++++-- ...account-view.tsx => account-edit-view.tsx} | 2 +- src/sections/account/view/index.ts | 2 +- 8 files changed, 85 insertions(+), 151 deletions(-) delete mode 100644 src/sections/account/account-change-password.tsx rename src/sections/account/view/{user-account-view.tsx => account-edit-view.tsx} (97%) diff --git a/src/app/dashboard/user/account/page.tsx b/src/app/dashboard/user/account/page.tsx index 89b0459..541f08d 100644 --- a/src/app/dashboard/user/account/page.tsx +++ b/src/app/dashboard/user/account/page.tsx @@ -1,4 +1,4 @@ -import { AccountView } from 'src/sections/account/view' +import { AccountEditView } from 'src/sections/account/view' // ---------------------------------------------------------------------- @@ -7,5 +7,5 @@ export const metadata = { } export default function AccountPage() { - return + return } diff --git a/src/locales/langs/br.json b/src/locales/langs/br.json index a899066..98c936a 100644 --- a/src/locales/langs/br.json +++ b/src/locales/langs/br.json @@ -11,12 +11,17 @@ "required": "obrigatório", "must-be-numeric": "Deve ser numérico", "must-be-max": "Deve ter no máximo {MAX_DIGITS} dígitos", - "must-be-valid-email": "O email deve ser um endereço de email válido", + "must-be-valid-email": "O email deve ser um endereço de email válido", + "must-be-min": "Deve ter no mínimo {MIN_CHARS} caracteres", "nodata": "Sem Dados", "close": "Fechar", "view": "Ver", "share": "Compartilhar", - "metadata": "Ver Metadata" + "metadata": "Ver Metadata", + "msg": { + "update-success": "Atualização bem-sucedida!", + "update-error": "Erro de atualização" + } }, "menu": { "overview": "Visão geral", @@ -318,6 +323,7 @@ } }, "account": { - "title": "Conta" + "title": "Conta", + "save": "Salvar Alterações" } } diff --git a/src/locales/langs/en.json b/src/locales/langs/en.json index 0855775..a4d6b34 100644 --- a/src/locales/langs/en.json +++ b/src/locales/langs/en.json @@ -12,11 +12,16 @@ "must-be-numeric": "Must be numeric", "must-be-max": "Must be a maximum of {MAX_DIGITS} digits", "must-be-valid-email": "Email must be a valid email address", + "must-be-min": "Must have a minimum of {MIN_CHARS} chars", "nodata": "No Data", "close": "Close", "view": "View", "share": "Share", - "metadata": "View Metadata" + "metadata": "View Metadata", + "msg": { + "update-success": "Update Success!", + "update-error": "Update error" + } }, "menu": { "overview": "overview", @@ -318,6 +323,7 @@ } }, "account": { - "title": "Account" + "title": "Account", + "save": "Save Changes" } } \ No newline at end of file diff --git a/src/locales/langs/es.json b/src/locales/langs/es.json index 74063aa..f43c407 100644 --- a/src/locales/langs/es.json +++ b/src/locales/langs/es.json @@ -12,11 +12,16 @@ "must-be-numeric": "Debe ser numérico", "must-be-max": "Debe tener un máximo de {MAX_DIGITS} dígitos", "must-be-valid-email": "El correo electrónico debe ser una dirección de correo válida", + "must-be-min": "Debe tener un mínimo de {MIN_CHARS} caracteres", "nodata": "Sin Datos", "close": "Cerrar", "view": "Ver", "share": "Compartir", - "metadata": "Ver Metadata" + "metadata": "Ver Metadata", + "msg": { + "update-success": "¡Actualización exitosa!", + "update-error": "Error de actualización" + } }, "menu": { "overview": "Visión general", @@ -319,6 +324,7 @@ } }, "account": { - "title": "Cuenta" + "title": "Cuenta", + "save": "Guardar Cambios" } } diff --git a/src/sections/account/account-change-password.tsx b/src/sections/account/account-change-password.tsx deleted file mode 100644 index 05bca30..0000000 --- a/src/sections/account/account-change-password.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import * as Yup from 'yup' -import { useForm } from 'react-hook-form' -import { yupResolver } from '@hookform/resolvers/yup' - -import Card from '@mui/material/Card' -import Stack from '@mui/material/Stack' -import IconButton from '@mui/material/IconButton' -import InputAdornment from '@mui/material/InputAdornment' - -import { useBoolean } from 'src/hooks/use-boolean' - -import Iconify from 'src/components/iconify' -import { useSnackbar } from 'src/components/snackbar' -import FormProvider, { RHFTextField } from 'src/components/hook-form' - -// ---------------------------------------------------------------------- - -export default function AccountChangePassword() { - const { enqueueSnackbar } = useSnackbar() - - const password = useBoolean() - - const ChangePassWordSchema = Yup.object().shape({ - oldPassword: Yup.string().required('Old Password is required'), - newPassword: Yup.string() - .required('New Password is required') - .min(6, 'Password must be at least 6 characters') - .test( - 'no-match', - 'New password must be different than old password', - (value, { parent }) => value !== parent.oldPassword - ), - confirmNewPassword: Yup.string().oneOf([Yup.ref('newPassword')], 'Passwords must match') - }) - - const defaultValues = { - oldPassword: '', - newPassword: '', - confirmNewPassword: '' - } - - const methods = useForm({ - resolver: yupResolver(ChangePassWordSchema), - defaultValues - }) - - const { - reset, - handleSubmit - // formState: { isSubmitting } - } = methods - - const onSubmit = handleSubmit(async (data) => { - try { - await new Promise((resolve) => setTimeout(resolve, 500)) - reset() - enqueueSnackbar('Update success!') - console.info('DATA', data) - } catch (error) { - console.error(error) - } - }) - - return ( - - - - - - - - ) - }} - /> - - - - - - - ) - }} - helperText={ - - Password must be minimum - 6+ - - } - /> - - - - - - - ) - }} - /> - - {/* - - Save Changes - - */} - - - ) -} diff --git a/src/sections/account/account-general.tsx b/src/sections/account/account-general.tsx index 8df043b..8669aed 100644 --- a/src/sections/account/account-general.tsx +++ b/src/sections/account/account-general.tsx @@ -1,17 +1,23 @@ import * as Yup from 'yup' +import { useMemo } from 'react' import { useForm } from 'react-hook-form' import { yupResolver } from '@hookform/resolvers/yup' import Box from '@mui/material/Box' import Card from '@mui/material/Card' +import Stack from '@mui/material/Stack' import Grid from '@mui/material/Unstable_Grid2' +import LoadingButton from '@mui/lab/LoadingButton' import { useTranslate } from 'src/locales' import { useAuthContext } from 'src/auth/hooks' +import { updateContact } from 'src/app/api/_hooks/use-contact' import { useSnackbar } from 'src/components/snackbar' import FormProvider, { RHFTextField } from 'src/components/hook-form' +import { IAccount } from 'src/types/account' + // ---------------------------------------------------------------------- type UserType = { @@ -25,37 +31,67 @@ type UserType = { export default function AccountGeneral() { const { enqueueSnackbar } = useSnackbar() const { t } = useTranslate() - const { user } = useAuthContext() + const { user, updateUser } = useAuthContext() const UpdateUserSchema = Yup.object().shape({ - displayName: Yup.string().required(t('common.required')), + displayName: Yup.string() + .trim() + .required(t('common.required')) + .min(3, t('common.must-be-min').replace('{MIN_CHARS}', '3')), email: Yup.string().required(t('common.required')).email(t('common.must-be-valid-email')), photoURL: Yup.mixed().nullable().required(t('common.required')), phoneNumber: Yup.string().required(t('common.required')), wallet: Yup.string().nullable() }) - const defaultValues: UserType = { - displayName: user?.displayName || '', - email: user?.email || '', - photoURL: user?.photoURL || null, - phoneNumber: user?.phoneNumber || '', - wallet: user?.wallet || '' - } + const defaultValues: UserType = useMemo( + () => ({ + displayName: user?.displayName || '', + email: user?.email || '', + photoURL: user?.photoURL || null, + phoneNumber: user?.phoneNumber || '', + wallet: user?.wallet || '' + }), + [user?.displayName, user?.email, user?.phoneNumber, user?.photoURL, user?.wallet] + ) const methods = useForm({ resolver: yupResolver(UpdateUserSchema), defaultValues }) - const { handleSubmit } = methods + const { + getValues, + handleSubmit, + formState: { isSubmitting } + } = methods const onSubmit = handleSubmit(async (data) => { + const confirmMsg = t('common.msg.update-success') + const errorMsg = t('common.msg.update-error') + try { - await new Promise((resolve) => setTimeout(resolve, 500)) - enqueueSnackbar('Update success!') + const formData = getValues() + const userData: IAccount = { + id: user!.id, + name: formData.displayName, + email: user!.email, + phone_number: user!.phoneNumber, + photo: user!.photoURL, + wallet: user!.wallet + } + await updateContact(user!.id, userData) + + // TODO: Actualizar el contexto (para que se actualice el form) + updateUser({ + ...user, // Mantiene los campos que no cambian + displayName: formData.displayName + }) + + console.info('DATA', data) + enqueueSnackbar(confirmMsg) } catch (error) { - console.error(error) + enqueueSnackbar(errorMsg, { variant: 'error' }) } }) @@ -73,11 +109,17 @@ export default function AccountGeneral() { sm: 'repeat(1, 1fr)' }} > - + + + + + {t('account.save')} + + diff --git a/src/sections/account/view/user-account-view.tsx b/src/sections/account/view/account-edit-view.tsx similarity index 97% rename from src/sections/account/view/user-account-view.tsx rename to src/sections/account/view/account-edit-view.tsx index 0842888..f83be7a 100644 --- a/src/sections/account/view/user-account-view.tsx +++ b/src/sections/account/view/account-edit-view.tsx @@ -28,7 +28,7 @@ const TABS = [ // ---------------------------------------------------------------------- -export default function AccountView() { +export default function AccountEditView() { const settings = useSettingsContext() const { t } = useTranslate() const [currentTab, setCurrentTab] = useState('general') diff --git a/src/sections/account/view/index.ts b/src/sections/account/view/index.ts index 8336646..c828d75 100644 --- a/src/sections/account/view/index.ts +++ b/src/sections/account/view/index.ts @@ -1 +1 @@ -export { default as AccountView } from './user-account-view' +export { default as AccountEditView } from './account-edit-view' From d4eddafbf6e010e485b8fe6fad5e2f066e0450fd Mon Sep 17 00:00:00 2001 From: dappsar Date: Thu, 17 Oct 2024 10:03:40 -0300 Subject: [PATCH 08/27] [chore] :clown_face: move countries mock (#129) --- src/app/api/_data/{_mock => }/_countries.ts | 0 src/app/api/_data/_mock/index.ts | 1 - src/components/country-select/country-select.tsx | 2 +- src/components/hook-form/rhf-autocomplete.tsx | 2 +- src/sections/auth/jwt/jwt-login-view.tsx | 2 +- src/sections/auth/jwt/jwt-register-view.tsx | 2 +- 6 files changed, 4 insertions(+), 5 deletions(-) rename src/app/api/_data/{_mock => }/_countries.ts (100%) diff --git a/src/app/api/_data/_mock/_countries.ts b/src/app/api/_data/_countries.ts similarity index 100% rename from src/app/api/_data/_mock/_countries.ts rename to src/app/api/_data/_countries.ts diff --git a/src/app/api/_data/_mock/index.ts b/src/app/api/_data/_mock/index.ts index 0f99637..543c050 100644 --- a/src/app/api/_data/_mock/index.ts +++ b/src/app/api/_data/_mock/index.ts @@ -2,4 +2,3 @@ export * from './_mock' export * from './assets' export * from './_others' export * from './_wallet' -export * from './_countries' diff --git a/src/components/country-select/country-select.tsx b/src/components/country-select/country-select.tsx index a997a3b..0e6a3c9 100644 --- a/src/components/country-select/country-select.tsx +++ b/src/components/country-select/country-select.tsx @@ -3,7 +3,7 @@ import TextField from '@mui/material/TextField' import InputAdornment from '@mui/material/InputAdornment' import Autocomplete, { AutocompleteProps } from '@mui/material/Autocomplete' -import { allCountries } from 'src/app/api/_data/_mock' +import { allCountries } from 'src/app/api/_data/_countries' import Iconify from 'src/components/iconify' diff --git a/src/components/hook-form/rhf-autocomplete.tsx b/src/components/hook-form/rhf-autocomplete.tsx index 2955483..babe182 100644 --- a/src/components/hook-form/rhf-autocomplete.tsx +++ b/src/components/hook-form/rhf-autocomplete.tsx @@ -5,7 +5,7 @@ import TextField from '@mui/material/TextField' import InputAdornment from '@mui/material/InputAdornment' import Autocomplete, { AutocompleteProps } from '@mui/material/Autocomplete' -import { allCountries } from 'src/app/api/_data/_mock' +import { allCountries } from 'src/app/api/_data/_countries' import Iconify from 'src/components/iconify' diff --git a/src/sections/auth/jwt/jwt-login-view.tsx b/src/sections/auth/jwt/jwt-login-view.tsx index 0319c94..e7c9198 100644 --- a/src/sections/auth/jwt/jwt-login-view.tsx +++ b/src/sections/auth/jwt/jwt-login-view.tsx @@ -27,7 +27,7 @@ import { getRecaptchaLng } from 'src/utils/format-number' import { useAuthContext } from 'src/auth/hooks' import { useLocales, useTranslate } from 'src/locales' -import { allCountries } from 'src/app/api/_data/_mock' +import { allCountries } from 'src/app/api/_data/_countries' import { PATH_AFTER_LOGIN, RECAPTCHA_SITE_KEY } from 'src/config-global' import FormProvider, { RHFCode, RHFTextField } from 'src/components/hook-form' diff --git a/src/sections/auth/jwt/jwt-register-view.tsx b/src/sections/auth/jwt/jwt-register-view.tsx index 5e58a3c..003c97c 100644 --- a/src/sections/auth/jwt/jwt-register-view.tsx +++ b/src/sections/auth/jwt/jwt-register-view.tsx @@ -18,7 +18,7 @@ import { RouterLink } from 'src/routes/components' import { useTranslate } from 'src/locales' import { BOT_WAPP_URL } from 'src/config-global' -import { allCountries } from 'src/app/api/_data/_mock' +import { allCountries } from 'src/app/api/_data/_countries' import FormProvider, { RHFTextField } from 'src/components/hook-form' From bd0753c99edf095c5575b9d9fe8ab179023431ec Mon Sep 17 00:00:00 2001 From: dappsar Date: Thu, 17 Oct 2024 10:06:17 -0300 Subject: [PATCH 09/27] [chore] :clown_face: move countries outside mocks (#129) --- src/app/api/_data/_mock/_others.ts | 31 ------------------------------ src/config-global.ts | 31 ++++++++++++++++++++++++++++++ src/layouts/main/footer.tsx | 3 +-- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/app/api/_data/_mock/_others.ts b/src/app/api/_data/_mock/_others.ts index f66eced..6f2d3bf 100644 --- a/src/app/api/_data/_mock/_others.ts +++ b/src/app/api/_data/_mock/_others.ts @@ -1,36 +1,5 @@ // ---------------------------------------------------------------------- -export const _socials = [ - { - value: 'facebook', - name: 'FaceBook', - icon: 'eva:facebook-fill', - color: '#1877F2', - path: 'https://www.facebook.com/caitlyn.kerluke' - }, - { - value: 'instagram', - name: 'Instagram', - icon: 'ant-design:instagram-filled', - color: '#E02D69', - path: 'https://www.instagram.com/caitlyn.kerluke' - }, - { - value: 'linkedin', - name: 'Linkedin', - icon: 'eva:linkedin-fill', - color: '#007EBB', - path: 'https://www.linkedin.com/caitlyn.kerluke' - }, - { - value: 'twitter', - name: 'Twitter', - icon: 'eva:twitter-fill', - color: '#00AAEC', - path: 'https://www.twitter.com/caitlyn.kerluke' - } -] - // ---------------------------------------------------------------------- export const _homePlans = [...Array(3)].map((_, index) => ({ diff --git a/src/config-global.ts b/src/config-global.ts index c9e8cf3..87e32c6 100644 --- a/src/config-global.ts +++ b/src/config-global.ts @@ -185,3 +185,34 @@ export const tokensByNetwork: { [networkKey: string]: Network } = { } } } + +export const _socials = [ + { + value: 'facebook', + name: 'FaceBook', + icon: 'eva:facebook-fill', + color: '#1877F2', + path: 'https://www.facebook.com/caitlyn.kerluke' + }, + { + value: 'instagram', + name: 'Instagram', + icon: 'ant-design:instagram-filled', + color: '#E02D69', + path: 'https://www.instagram.com/caitlyn.kerluke' + }, + { + value: 'linkedin', + name: 'Linkedin', + icon: 'eva:linkedin-fill', + color: '#007EBB', + path: 'https://www.linkedin.com/caitlyn.kerluke' + }, + { + value: 'twitter', + name: 'Twitter', + icon: 'eva:twitter-fill', + color: '#00AAEC', + path: 'https://www.twitter.com/caitlyn.kerluke' + } +] diff --git a/src/layouts/main/footer.tsx b/src/layouts/main/footer.tsx index fa4f462..aa71c67 100644 --- a/src/layouts/main/footer.tsx +++ b/src/layouts/main/footer.tsx @@ -13,8 +13,7 @@ import { usePathname } from 'src/routes/hooks' import { RouterLink } from 'src/routes/components' import { useTranslate } from 'src/locales' -import { _socials } from 'src/app/api/_data/_mock' -import { BOT_WAPP_URL, CONTACT_EMAIL } from 'src/config-global' +import { _socials, BOT_WAPP_URL, CONTACT_EMAIL } from 'src/config-global' import Logo from 'src/components/logo' import Iconify from 'src/components/iconify' From 55231b7c0cc916186209f23d8735256517ca1b0d Mon Sep 17 00:00:00 2001 From: dappsar Date: Thu, 17 Oct 2024 10:25:28 -0300 Subject: [PATCH 10/27] [chore] :clown_face: remove mocks folder (#129) --- src/app/api/_data/_mock/_mock.ts | 65 ----- src/app/api/_data/_mock/_others.ts | 21 -- src/app/api/_data/_mock/_wallet.ts | 130 --------- src/app/api/_data/_mock/assets.ts | 268 ------------------ src/app/api/_data/_mock/index.ts | 4 - src/app/api/_data/blk-service.ts | 20 +- src/app/api/_hooks/common.ts | 1 - .../api/v1/wallet/[id]/transactions/route.ts | 12 +- 8 files changed, 8 insertions(+), 513 deletions(-) delete mode 100644 src/app/api/_data/_mock/_mock.ts delete mode 100644 src/app/api/_data/_mock/_others.ts delete mode 100644 src/app/api/_data/_mock/_wallet.ts delete mode 100644 src/app/api/_data/_mock/assets.ts delete mode 100644 src/app/api/_data/_mock/index.ts diff --git a/src/app/api/_data/_mock/_mock.ts b/src/app/api/_data/_mock/_mock.ts deleted file mode 100644 index b7b37c9..0000000 --- a/src/app/api/_data/_mock/_mock.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { sub } from 'date-fns' - -import { - _id, - _ages, - _prices, - _emails, - _ratings, - _nativeS, - _nativeM, - _nativeL, - _percents, - _booleans, - _sentences, - _lastNames, - _fullNames, - _firstNames, - _descriptions, - _phoneNumbers -} from './assets' - -// ---------------------------------------------------------------------- - -export const _mock = { - id: (index: number) => _id[index], - time: (index: number) => sub(new Date(), { days: index, hours: index }), - boolean: (index: number) => _booleans[index], - // role: (index: number) => _roles[index], - // Text - // taskNames: (index: number) => _taskNames[index], - // postTitle: (index: number) => _postTitles[index], - // jobTitle: (index: number) => _jobTitles[index], - // tourName: (index: number) => _tourNames[index], - // productName: (index: number) => _productNames[index], - sentence: (index: number) => _sentences[index], - description: (index: number) => _descriptions[index], - // Contact - email: (index: number) => _emails[index], - phoneNumber: (index: number) => _phoneNumbers[index], - // fullAddress: (index: number) => _fullAddress[index], - // Name - firstName: (index: number) => _firstNames[index], - lastName: (index: number) => _lastNames[index], - fullName: (index: number) => _fullNames[index], - // companyName: (index: number) => _companyNames[index], - // Number - number: { - percent: (index: number) => _percents[index], - rating: (index: number) => _ratings[index], - age: (index: number) => _ages[index], - price: (index: number) => _prices[index], - nativeS: (index: number) => _nativeS[index], - nativeM: (index: number) => _nativeM[index], - nativeL: (index: number) => _nativeL[index] - }, - // Image - image: { - cover: (index: number) => `/assets/images/cover_1.jpg`, - avatar: (index: number) => `/assets/images/avatars/avatar_${index + 1}.jpg`, - travel: (index: number) => `/assets/images/travel_1.jpg`, - company: (index: number) => `/assets/images/company_1.png`, - product: (index: number) => `/assets/images/product_1.jpg`, - portrait: (index: number) => `/assets/images/portrait_1.jpg` - } -} diff --git a/src/app/api/_data/_mock/_others.ts b/src/app/api/_data/_mock/_others.ts deleted file mode 100644 index 6f2d3bf..0000000 --- a/src/app/api/_data/_mock/_others.ts +++ /dev/null @@ -1,21 +0,0 @@ -// ---------------------------------------------------------------------- - -// ---------------------------------------------------------------------- - -export const _homePlans = [...Array(3)].map((_, index) => ({ - license: ['Standard', 'Standard Plus', 'Extended'][index], - commons: ['One end products', '12 months updates', '6 months of support'], - options: [ - 'JavaScript version', - 'TypeScript version', - 'Design Resources', - 'Commercial applications' - ], - icons: [ - '/assets/icons/platforms/ic_js.svg', - '/assets/icons/platforms/ic_ts.svg', - '/assets/icons/platforms/ic_figma.svg' - ] -})) - -// ---------------------------------------------------------------------- diff --git a/src/app/api/_data/_mock/_wallet.ts b/src/app/api/_data/_mock/_wallet.ts deleted file mode 100644 index 8e512e6..0000000 --- a/src/app/api/_data/_mock/_wallet.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { IBalance, ITransaction } from 'src/types/wallet' - -import { _mock } from './_mock' - -export const _balances: IBalance[] = [ - { - network: 'sepolia', - balance: 23432.03, - token: 'USDC', - balance_conv: { - usd: 1, - ars: 1, - brl: 1, - uyu: 1 - } - }, - { - network: 'sepolia', - balance: 1.5, - token: 'ETH', - balance_conv: { - usd: 1, - ars: 1, - brl: 1, - uyu: 1 - } - }, - { - network: 'sepolia', - balance: 1, - token: 'BTC', - balance_conv: { - usd: 1, - ars: 1, - brl: 1, - uyu: 1 - } - } -] - -export const _transactions: ITransaction[] = [ - { - id: _mock.id(2), - trx_hash: '0x469c61b085335276861a90a7dc6809c6144317f9a811c95c923a1b3b35d85c29', - wallet_from: '0x35dad65F60c1A32c9895BE97f6bcE57D32792E83', - contact_from_phone: '5491153475555', - contact_from_name: _mock.fullName(2), - contact_from_avatar_url: _mock.fullName(2), - wallet_to: '0x117b706DEF40310eF5926aB57868dAcf46605b8d', - contact_to_phone: '5491131997779', - contact_to_name: _mock.fullName(10), - contact_to_avatar_url: _mock.image.avatar(10), - type: 'transfer', - date: _mock.time(2), - status: 'completed', - amount: _mock.number.price(2), - token: 'USDC' - }, - { - id: _mock.id(3), - trx_hash: '0x5832143b88fcd1727760bc656ee61219f74a1329eee401f2f9afc2e4802a0974', - wallet_from: '0x117b706DEF40310eF5926aB57868dAcf46605b8d', - contact_from_phone: '5491131997779', - contact_from_name: _mock.fullName(10), - contact_from_avatar_url: _mock.fullName(10), - wallet_to: '0x35dad65F60c1A32c9895BE97f6bcE57D32792E83', - contact_to_phone: '5491153475555', - contact_to_name: _mock.fullName(3), - contact_to_avatar_url: _mock.image.avatar(3), - type: 'transfer', - - date: _mock.time(3), - status: 'completed', - amount: _mock.number.price(3), - token: 'USDC' - }, - { - id: _mock.id(4), - wallet_from: '0x35dad65F60c1A32c9895BE97f6bcE57D32792E83', - trx_hash: '0x3eb9d217ff24604ad149c61487dd166296982849eb87d9992988f21ee22fdc17', - contact_from_phone: '5491153475555', - contact_from_name: _mock.fullName(4), - contact_from_avatar_url: _mock.fullName(4), - wallet_to: '0x117b706DEF40310eF5926aB57868dAcf46605b8d', - contact_to_phone: '5491131997779', - contact_to_name: _mock.fullName(10), - contact_to_avatar_url: _mock.image.avatar(10), - type: 'transfer', - - date: _mock.time(4), - status: 'failed', - amount: _mock.number.price(4), - token: 'USDC' - }, - { - id: _mock.id(5), - trx_hash: '0x4f6c005226909336066dd8f199bb0e0346175e53e1a53c50231b2395ba770b67', - wallet_from: '0x117b706DEF40310eF5926aB57868dAcf46605b8d', - contact_from_phone: '5491131997779', - contact_from_name: _mock.fullName(10), - contact_from_avatar_url: _mock.fullName(10), - wallet_to: '0x35dad65F60c1A32c9895BE97f6bcE57D32792E83', - contact_to_phone: '5491153475555', - contact_to_name: _mock.fullName(5), - contact_to_avatar_url: _mock.image.avatar(5), - type: 'transfer', - - date: _mock.time(5), - status: 'completed', - amount: _mock.number.price(5), - token: 'USDC' - }, - { - id: _mock.id(6), - trx_hash: '0x1fb00e771fdac89017694d22504a45568785c903c568fa6ffb40641f9ea59a2f', - wallet_from: '0x117b706DEF40310eF5926aB57868dAcf46605b8d', - contact_from_phone: '5491131997779', - contact_from_name: _mock.fullName(10), - contact_from_avatar_url: _mock.fullName(10), - wallet_to: '0x35dad65F60c1A32c9895BE97f6bcE57D32792E83', - contact_to_phone: '5491153475555', - contact_to_name: _mock.fullName(6), - contact_to_avatar_url: _mock.image.avatar(6), - type: 'transfer', - date: _mock.time(6), - status: 'failed', - amount: _mock.number.price(6), - token: 'USDC' - } -] diff --git a/src/app/api/_data/_mock/assets.ts b/src/app/api/_data/_mock/assets.ts deleted file mode 100644 index 6a244b6..0000000 --- a/src/app/api/_data/_mock/assets.ts +++ /dev/null @@ -1,268 +0,0 @@ -// ---------------------------------------------------------------------- - -export const _id = [...Array(40)].map( - (_, index) => `e99f09a7-dd88-49d5-b1c8-1daf80c2d7b${index + 1}` -) - -// ---------------------------------------------------------------------- - -export const _booleans = [ - true, - true, - true, - false, - false, - true, - false, - false, - false, - false, - true, - true, - true, - false, - false, - false, - true, - false, - false, - false, - true, - false, - false, - true -] - -// ---------------------------------------------------------------------- - -export const _emails = [ - 'nannie_abernathy70@yahoo.com', - 'ashlynn_ohara62@gmail.com', - 'milo.farrell@hotmail.com', - 'violet.ratke86@yahoo.com', - 'letha_lubowitz24@yahoo.com', - 'aditya_greenfelder31@gmail.com', - 'lenna_bergnaum27@hotmail.com', - 'luella.ryan33@gmail.com', - 'joana.simonis84@gmail.com', - 'marjolaine_white94@gmail.com', - 'vergie_block82@hotmail.com', - 'vito.hudson@hotmail.com', - 'tyrel_greenholt@gmail.com', - 'dwight.block85@yahoo.com', - 'mireya13@hotmail.com', - 'dasia_jenkins@hotmail.com', - 'benny89@yahoo.com', - 'dawn.goyette@gmail.com', - 'zella_hickle4@yahoo.com', - 'avery43@hotmail.com', - 'olen_legros@gmail.com', - 'jimmie.gerhold73@hotmail.com', - 'genevieve.powlowski@hotmail.com', - 'louie.kuphal39@gmail.com' -] - -// ---------------------------------------------------------------------- - -export const _fullNames = [ - 'Jayvion Simon', - 'Lucian Obrien', - 'Deja Brady', - 'Harrison Stein', - 'Reece Chung', - 'Lainey Davidson', - 'Cristopher Cardenas', - 'Melanie Noble', - 'Chase Day', - 'Shawn Manning', - 'Soren Durham', - 'Cortez Herring', - 'Brycen Jimenez', - 'Giana Brandt', - 'Aspen Schmitt', - 'Colten Aguilar', - 'Angelique Morse', - 'Selina Boyer', - 'Lawson Bass', - 'Ariana Lang', - 'Amiah Pruitt', - 'Harold Mcgrath', - 'Esperanza Mcintyre', - 'Mireya Conner' -] - -export const _firstNames = [ - 'Mossie', - 'David', - 'Ebba', - 'Chester', - 'Eula', - 'Jaren', - 'Boyd', - 'Brady', - 'Aida', - 'Anastasia', - 'Gregoria', - 'Julianne', - 'Ila', - 'Elyssa', - 'Lucio', - 'Lewis', - 'Jacinthe', - 'Molly', - 'Brown', - 'Fritz', - 'Keon', - 'Ella', - 'Ken', - 'Whitney' -] - -export const _lastNames = [ - 'Carroll', - 'Simonis', - 'Yost', - 'Hand', - 'Emmerich', - 'Wilderman', - 'Howell', - 'Sporer', - 'Boehm', - 'Morar', - 'Koch', - 'Reynolds', - 'Padberg', - 'Watsica', - 'Upton', - 'Yundt', - 'Pfeffer', - 'Parker', - 'Zulauf', - 'Treutel', - 'McDermott', - 'McDermott', - 'Cruickshank', - 'Parisian' -] - -// ---------------------------------------------------------------------- - -export const _prices = [ - 83.74, 97.14, 68.71, 85.21, 52.17, 25.18, 43.84, 60.98, 98.42, 53.37, 72.75, 56.61, 64.55, 77.32, - 60.62, 79.81, 93.68, 47.44, 76.24, 92.87, 72.91, 20.54, 94.25, 37.51 -] - -export const _ratings = [ - 4.2, 3.7, 4.5, 3.5, 0.5, 3.0, 2.5, 2.8, 4.9, 3.6, 2.5, 1.7, 3.9, 2.8, 4.1, 4.5, 2.2, 3.2, 0.6, - 1.3, 3.8, 3.8, 3.8, 2.0 -] - -export const _ages = [ - 30, 26, 59, 47, 29, 46, 18, 56, 39, 19, 45, 18, 46, 56, 38, 41, 44, 48, 32, 45, 42, 60, 33, 57 -] - -export const _percents = [ - 10.1, 13.6, 28.2, 42.1, 37.2, 18.5, 40.1, 94.8, 91.4, 53.0, 25.4, 62.9, 86.6, 62.4, 35.4, 17.6, - 52.0, 6.8, 95.3, 26.6, 69.9, 92.1, 46.2, 85.6 -] - -export const _nativeS = [ - 11, 10, 7, 10, 12, 5, 10, 1, 8, 8, 10, 11, 12, 8, 4, 11, 8, 9, 4, 9, 2, 6, 3, 7 -] - -export const _nativeM = [ - 497, 763, 684, 451, 433, 463, 951, 194, 425, 435, 807, 521, 538, 839, 394, 269, 453, 821, 364, - 849, 804, 776, 263, 239 -] - -export const _nativeL = [ - 9911, 1947, 9124, 6984, 8488, 2034, 3364, 8401, 8996, 5271, 8478, 1139, 8061, 3035, 6733, 3952, - 2405, 3127, 6843, 4672, 6995, 6053, 5192, 9686 -] - -// ---------------------------------------------------------------------- - -export const _phoneNumbers = [ - '365-374-4961', - '904-966-2836', - '399-757-9909', - '692-767-2903', - '990-588-5716', - '955-439-2578', - '226-924-4058', - '552-917-1454', - '285-840-9338', - '306-269-2446', - '883-373-6253', - '476-509-8866', - '201-465-1954', - '538-295-9408', - '531-492-6028', - '981-699-7588', - '500-268-4826', - '205-952-3828', - '222-255-5190', - '408-439-8033', - '272-940-8266', - '812-685-8057', - '353-801-5212', - '606-285-8928' -] - -// ---------------------------------------------------------------------- - -export const _sentences = [ - 'The sun slowly set over the horizon, painting the sky in vibrant hues of orange and pink.', - 'She eagerly opened the gift, her eyes sparkling with excitement.', - 'The old oak tree stood tall and majestic, its branches swaying gently in the breeze.', - 'The aroma of freshly brewed coffee filled the air, awakening my senses.', - 'The children giggled with joy as they ran through the sprinklers on a hot summer day.', - 'He carefully crafted a beautiful sculpture out of clay, his hands skillfully shaping the intricate details.', - 'The concert was a mesmerizing experience, with the music filling the venue and the crowd cheering in delight.', - 'The waves crashed against the shore, creating a soothing symphony of sound.', - 'The scent of blooming flowers wafted through the garden, creating a fragrant paradise.', - 'She gazed up at the night sky, marveling at the twinkling stars that dotted the darkness.', - 'The professor delivered a captivating lecture, engaging the students with thought-provoking ideas.', - 'The hiker trekked through the dense forest, guided by the soft glow of sunlight filtering through the trees.', - 'The delicate butterfly gracefully fluttered from flower to flower, sipping nectar with its slender proboscis.', - 'The aroma of freshly baked cookies filled the kitchen, tempting everyone with its irresistible scent.', - "The majestic waterfall cascaded down the rocks, creating a breathtaking display of nature's power.", - 'The actor delivered a powerful performance, moving the audience to tears with his emotional portrayal.', - 'The book transported me to a magical world, where imagination knew no bounds.', - 'The scent of rain filled the air as dark clouds gathered overhead, promising a refreshing downpour.', - 'The chef skillfully plated the dish, turning simple ingredients into a work of culinary art.', - 'The newborn baby let out a tiny cry, announcing its arrival to the world.', - 'The athlete sprinted across the finish line, arms raised in victory as the crowd erupted in applause.', - 'The ancient ruins stood as a testament to a civilization long gone, their grandeur still awe-inspiring.', - 'The artist dipped the brush into vibrant paint, bringing the canvas to life with bold strokes and vivid colors.', - 'The laughter of children echoed through the playground, filling the atmosphere with pure joy.' -] - -// ---------------------------------------------------------------------- - -export const _descriptions = [ - `Occaecati est et illo quibusdam accusamus qui. Incidunt aut et molestiae ut facere aut. Est quidem iusto praesentium excepturi harum nihil tenetur facilis. Ut omnis voluptates nihil accusantium doloribus eaque debitis.`, - `Atque eaque ducimus minima distinctio velit. Laborum et veniam officiis. Delectus ex saepe hic id laboriosam officia. Odit nostrum qui illum saepe debitis ullam. Laudantium beatae modi fugit ut. Dolores consequatur beatae nihil voluptates rem maiores.`, - `Rerum eius velit dolores. Explicabo ad nemo quibusdam. Voluptatem eum suscipit et ipsum et consequatur aperiam quia. Rerum nulla sequi recusandae illum velit quia quas. Et error laborum maiores cupiditate occaecati.`, - `Et non omnis qui. Qui sunt deserunt dolorem aut velit cumque adipisci aut enim. Nihil quis quisquam nesciunt dicta nobis ab aperiam dolorem repellat. Voluptates non blanditiis. Error et tenetur iste soluta cupiditate ratione perspiciatis et. Quibusdam aliquid nam sunt et quisquam non esse.`, - `Nihil ea sunt facilis praesentium atque. Ab animi alias sequi molestias aut velit ea. Sed possimus eos. Et est aliquid est voluptatem.`, - `Non rerum modi. Accusamus voluptatem odit nihil in. Quidem et iusto numquam veniam culpa aperiam odio aut enim. Quae vel dolores. Pariatur est culpa veritatis aut dolorem.`, - `Est enim et sit non impedit aperiam cumque animi. Aut eius impedit saepe blanditiis. Totam molestias magnam minima fugiat.`, - `Unde a inventore et. Sed esse ut. Atque ducimus quibusdam fuga quas id qui fuga.`, - `Eaque natus adipisci soluta nostrum dolorem. Nesciunt ipsum molestias ut aliquid natus ut omnis qui fugiat. Dolor et rem. Ut neque voluptatem blanditiis quasi ullam deleniti.`, - `Nam et error exercitationem qui voluptate optio. Officia omnis qui accusantium ipsam qui. Quia sequi nulla perspiciatis optio vero omnis maxime omnis ipsum. Perspiciatis consequuntur asperiores veniam dolores.`, - `Perspiciatis nulla ut ut ut voluptates totam consectetur eligendi qui. Optio ut cum. Dolorum sapiente qui laborum. Impedit temporibus totam delectus nihil. Voluptatem corrupti rem.`, - `Distinctio omnis similique omnis eos. Repellat cumque rerum nisi. Reiciendis soluta non ut veniam temporibus. Accusantium et dolorem voluptas harum. Nemo eius voluptate dicta et hic nemo. Dolorem assumenda et beatae molestias sit quo mollitia quis consequatur.`, - `Sed ut mollitia tempore ipsam et illum doloribus ut. Occaecati ratione veritatis explicabo. Omnis nam omnis sunt placeat tempore accusantium placeat distinctio velit.`, - `Eum illo dicta et perspiciatis ut blanditiis eos sequi. Ea veritatis aut et voluptas aut. Laborum eos quia tempore a culpa.`, - `Aut quos quae dolores repudiandae similique perferendis perferendis earum laudantium. Facere placeat natus nobis. Eius vitae ullam dolorem.`, - `Vero dolorem et voluptatem fugit tempore a quam iure. Fuga consequatur corrupti sunt asperiores vitae. Libero totam repellendus animi debitis illum et sunt officia.`, - `Cupiditate illum officiis id molestiae. Numquam non molestiae aliquid et natus sed hic. Alias quia explicabo sed corrupti sint. Natus in et odio qui unde facilis quia. Est sit eius laboriosam aliquid non aperiam quia quo corporis.`, - `Et a ab. Optio aspernatur minus tempora amet vitae consectetur inventore cumque. Sed et omnis. Aspernatur a magnam.`, - `Ipsum omnis et. Quia ea et autem tempore consequuntur veniam dolorem officiis. Ipsa dicta et ut quidem quia doloremque. Sequi vitae doloremque temporibus. Deserunt incidunt id aperiam itaque natus. Earum sit eaque quas incidunt nihil.`, - `Quae consequatur reiciendis. Consequatur non optio. Eaque id placeat. Commodi quo officia aut repudiandae reiciendis tempore voluptatem et. Ut accusamus qui itaque maxime aliquam. Fugit ut animi molestiae porro maiores.`, - `Modi hic asperiores ab cumque quam est aut. Voluptas atque quos molestias. Ut excepturi distinctio ipsam aspernatur sit.`, - `Sunt totam facilis. Quam commodi voluptatem veniam. Tempora deleniti itaque fugit nihil voluptas.`, - `Ipsam aliquam velit nobis repellendus officiis aut deserunt id et. Nihil sunt aut dolores aut. Dolores est ipsa quia et laborum quidem laborum accusamus id. Facilis odit quod hic laudantium saepe omnis nisi in sint. Sed cupiditate possimus id.`, - `Magnam non eveniet optio optio ut aliquid atque. Velit libero aspernatur quis laborum consequatur laudantium. Tempora facere optio fugit accusantium ut. Omnis aspernatur reprehenderit autem esse ut ut enim voluptatibus.` -] diff --git a/src/app/api/_data/_mock/index.ts b/src/app/api/_data/_mock/index.ts deleted file mode 100644 index 543c050..0000000 --- a/src/app/api/_data/_mock/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './_mock' -export * from './assets' -export * from './_others' -export * from './_wallet' diff --git a/src/app/api/_data/blk-service.ts b/src/app/api/_data/blk-service.ts index 080c666..a123df1 100644 --- a/src/app/api/_data/blk-service.ts +++ b/src/app/api/_data/blk-service.ts @@ -2,7 +2,6 @@ import axios from 'axios' import { ethers, JsonRpcProvider } from 'ethers' import { - USE_MOCK, API3_ENABLED, defaultBalance, BACKEND_API_URL, @@ -12,7 +11,6 @@ import { import { IBalance, IBalances, CurrencyKey } from 'src/types/wallet' -import { _balances } from './_mock' import { cache } from './cache-connection' import TokenPriceFeedsAbi from './_abis/TokenPriceFeedsAbi.json' @@ -61,19 +59,15 @@ export async function getBalancesWithTotals(walletAddress: string): Promise = calculateTotals(balances) const result = { balances, @@ -129,7 +123,7 @@ async function getBalances(walletAddress: string): Promise { const ethRateApi3 = getRateByKey(api3Rates, 'eth') const ethRateApi3Usd = parseFloat(ethers.formatUnits(ethRateApi3.usd, 18)) // API3: no rate in ARS or BRL - // netowrk Main Token + // network Main Token balances.push({ network: network.config.chainName, token: network.config.chainCurrency, diff --git a/src/app/api/_hooks/common.ts b/src/app/api/_hooks/common.ts index f97ee49..d541366 100644 --- a/src/app/api/_hooks/common.ts +++ b/src/app/api/_hooks/common.ts @@ -1,4 +1,3 @@ -// @ts-ignore import useSWR from 'swr' import { useMemo } from 'react' diff --git a/src/app/api/v1/wallet/[id]/transactions/route.ts b/src/app/api/v1/wallet/[id]/transactions/route.ts index c8e1cd1..ec817b8 100644 --- a/src/app/api/v1/wallet/[id]/transactions/route.ts +++ b/src/app/api/v1/wallet/[id]/transactions/route.ts @@ -1,7 +1,5 @@ import { NextResponse } from 'next/server' -import { USE_MOCK } from 'src/config-global' -import { _transactions } from 'src/app/api/_data/_mock' import { geUserTransactions } from 'src/app/api/_data/data-service' import { IErrorResponse } from 'src/types/api' @@ -14,8 +12,6 @@ type IParams = { } export async function GET(request: Request, { params }: { params: IParams }) { - // TODO: Check if id exists in backend - if (!params.id) { const errorMessage: IErrorResponse = { error: { @@ -38,13 +34,7 @@ export async function GET(request: Request, { params }: { params: IParams }) { } try { - let data: ITransaction[] = [] - if (USE_MOCK) { - data = _transactions - } else { - data = _transactions - data = (await geUserTransactions(params.id)) ?? [] - } + const data: ITransaction[] = (await geUserTransactions(params.id)) ?? [] return NextResponse.json(data) } catch (ex) { console.error(ex) From 0ac593a6f636dd4b64eedb3207e0893190e123e2 Mon Sep 17 00:00:00 2001 From: dappsar Date: Thu, 17 Oct 2024 16:32:16 -0300 Subject: [PATCH 11/27] [func] :sparkles: add social links in footer (#131) --- src/config-global.ts | 40 ++++++++++++++++++++++++++--------- src/layouts/main/footer.tsx | 42 ++++++++++++++++++++++++------------- src/layouts/main/index.tsx | 2 +- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/src/config-global.ts b/src/config-global.ts index 87e32c6..c1288d8 100644 --- a/src/config-global.ts +++ b/src/config-global.ts @@ -191,28 +191,48 @@ export const _socials = [ value: 'facebook', name: 'FaceBook', icon: 'eva:facebook-fill', - color: '#1877F2', - path: 'https://www.facebook.com/caitlyn.kerluke' + colorDark: '#1877F2', + colorLight: '#1877F2', + path: 'https://www.facebook.com/chatterpay' }, { value: 'instagram', name: 'Instagram', icon: 'ant-design:instagram-filled', - color: '#E02D69', - path: 'https://www.instagram.com/caitlyn.kerluke' + colorDark: '#E02D69', + colorLight: '#E02D69', + path: 'https://www.instagram.com/chatterpayofficial' }, { value: 'linkedin', name: 'Linkedin', icon: 'eva:linkedin-fill', - color: '#007EBB', - path: 'https://www.linkedin.com/caitlyn.kerluke' + colorDark: '#007EBB', + colorLight: '#007EBB', + path: 'https://www.linkedin.com/company/chatterpay' }, { - value: 'twitter', - name: 'Twitter', + value: 'X', + name: 'X', icon: 'eva:twitter-fill', - color: '#00AAEC', - path: 'https://www.twitter.com/caitlyn.kerluke' + colorDark: '#00AAEC', + colorLight: '#00AAEC', + path: 'https://www.twitter.com/chatterpay' + }, + { + value: 'youtube', + name: 'YouTube', + icon: 'logos:youtube-icon', + colorDark: '#FF0000', + colorLight: '#FF0000', + path: 'https://www.youtube.com/@chatterpay' + }, + { + value: 'github', + name: 'Github', + icon: 'eva:github-fill', + colorDark: '#FFFFFF', + colorLight: '#181717', + path: 'https://github.com/chatterpay' } ] diff --git a/src/layouts/main/footer.tsx b/src/layouts/main/footer.tsx index aa71c67..651022d 100644 --- a/src/layouts/main/footer.tsx +++ b/src/layouts/main/footer.tsx @@ -2,14 +2,13 @@ import Box from '@mui/material/Box' import Link from '@mui/material/Link' import Stack from '@mui/material/Stack' import Divider from '@mui/material/Divider' -import { alpha } from '@mui/material/styles' import Container from '@mui/material/Container' import Grid from '@mui/material/Unstable_Grid2' import IconButton from '@mui/material/IconButton' import Typography from '@mui/material/Typography' +import { alpha, useTheme } from '@mui/material/styles' import { paths } from 'src/routes/paths' -import { usePathname } from 'src/routes/hooks' import { RouterLink } from 'src/routes/components' import { useTranslate } from 'src/locales' @@ -20,11 +19,14 @@ import Iconify from 'src/components/iconify' // ---------------------------------------------------------------------- -export default function Footer() { - const pathname = usePathname() - const { t } = useTranslate() +interface FooterProps { + simple: boolean +} - const homePage = pathname === '/' +export default function Footer({ simple }: FooterProps) { + const { t } = useTranslate() + const theme = useTheme() + const lightMode = theme.palette.mode === 'light' const contactUsUrl = BOT_WAPP_URL.replaceAll('MESSAGE', t('home.common.contact-us-wapp-msg')) const LINKS = [ @@ -117,16 +119,26 @@ export default function Footer() { }} > {_socials.map((social) => ( - - - + + + + ))} @@ -168,5 +180,5 @@ export default function Footer() { ) - return homePage ? simpleFooter : mainFooter + return simple ? simpleFooter : mainFooter } diff --git a/src/layouts/main/index.tsx b/src/layouts/main/index.tsx index 1dd330f..dd1ef95 100644 --- a/src/layouts/main/index.tsx +++ b/src/layouts/main/index.tsx @@ -32,7 +32,7 @@ export default function MainLayout({ children }: Props) { {children} -