diff --git a/src/@types/contexts.ts b/src/@types/contexts.ts index e1936cf..f55f103 100644 --- a/src/@types/contexts.ts +++ b/src/@types/contexts.ts @@ -1,8 +1,8 @@ -import { IAdminData, IUserData } from '@/@types/admin' +import { IEditorData, IUserData } from '@/@types/data-settings' -export interface IAdminContextData { - isAdminLogged: boolean - userData: IUserData | null - adminData: IAdminData | null +export interface IContextData { + user: IUserData, + cardData: IEditorData | null + handleLogin: () => void handleLogout: () => void } diff --git a/src/@types/admin.ts b/src/@types/data-settings.ts similarity index 83% rename from src/@types/admin.ts rename to src/@types/data-settings.ts index db4cd4d..5eefde0 100644 --- a/src/@types/admin.ts +++ b/src/@types/data-settings.ts @@ -1,12 +1,12 @@ export interface IUserData { - adminId: string - adminName: string - adminEmail: string + id: string + name: string + email: string } export interface ISigninUser { - adminEmail: string - adminPassword: string + email: string + password: string } export interface IEditorSettings { @@ -44,6 +44,6 @@ export interface IEditorSettingsForm { borderBottomLeft: number } -export interface IAdminData { +export interface IEditorData { editor: IEditorSettings } diff --git a/src/screens/ParticipanteDashboard/index.tsx b/src/screens/ParticipanteDashboard/index.tsx index 849127f..34191d4 100644 --- a/src/screens/ParticipanteDashboard/index.tsx +++ b/src/screens/ParticipanteDashboard/index.tsx @@ -23,7 +23,7 @@ import { //import { useAdmin } from '@/contexts/AdminProvider' function useAdmin() { - const adminData = { + const cardData = { editor: { image: "/SouTrilheiro.png", size: { @@ -47,7 +47,7 @@ function useAdmin() { } } } - return { adminData } + return { cardData } } import { beforeUpload, onPreview } from '@/utils/functions/imageUpload' @@ -56,7 +56,7 @@ import useScreenSize from '@/hooks/use'; interface IParticipanteDashboard { } const ParticipanteDashboard = ({ }: IParticipanteDashboard) => { - const { adminData } = useAdmin() + const { cardData } = useAdmin() const configImg = useScreenSize() @@ -89,9 +89,9 @@ const ParticipanteDashboard = ({ }: IParticipanteDashboard) => { } const handleExportImage = useCallback(async () => { - if (ParticipanteDashboardPostRef.current && adminData?.editor.image) { + if (ParticipanteDashboardPostRef.current && cardData?.editor.image) { try { - const response = await fetch(adminData.editor.image, { mode: 'cors' }) + const response = await fetch(cardData.editor.image, { mode: 'cors' }) const blob = await response.blob() const localUrl = URL.createObjectURL(blob) @@ -133,7 +133,7 @@ const ParticipanteDashboard = ({ }: IParticipanteDashboard) => { console.error('Failed to download and export image:', err) } } - }, [ParticipanteDashboardPostRef, adminData]) + }, [ParticipanteDashboardPostRef, cardData]) const nome_informado = watch("name") @@ -229,31 +229,31 @@ const ParticipanteDashboard = ({ }: IParticipanteDashboard) => {
- {adminData && adminData.editor.image ? ( + {cardData && cardData.editor.image ? ( <> - Post Image + Post Image diff --git a/src/views/Editor/index.tsx b/src/views/Editor/index.tsx index 03a6cac..9de11af 100644 --- a/src/views/Editor/index.tsx +++ b/src/views/Editor/index.tsx @@ -42,7 +42,7 @@ const editorSettingsSchema = Yup.object().shape({ interface IEditor {} const Editor = ({}: IEditor) => { - const adminData = {} + const cardData = {} const [updatingEditor, setUpdatingEditor] = useState(false)