Skip to content

Commit

Permalink
Merge pull request #21 from artursanntos/dev/general-ui-fixes
Browse files Browse the repository at this point in the history
Dev/general UI fixes
  • Loading branch information
gugaccampos committed Oct 2, 2023
2 parents 3afd361 + 8ca0314 commit edcf7d9
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 36 deletions.
15 changes: 7 additions & 8 deletions src/contexts/IndicatorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { collaboratorType, indicatorType } from '../types';
import { useContext } from 'react';
import { VfoodsContext } from './VfoodsContext';
import axios from 'axios';
import Api from '../Api';

interface IndicatorContextType {
collaborator: collaboratorType[];
Expand All @@ -24,22 +25,20 @@ export function IndicatorProvider({ children }: IndicatorProviderProps) {
const { manager } = useContext(VfoodsContext);

const createIndicator = async () => {
console.log("Chegou aqui");
//console.log("Chegou aqui");

try {
const url = 'http://localhost:3000/indicador'
const url = 'indicador/'

const headers = {
'Content-Type': 'application/json'
}

console.log(manager.id);

// setIndicator({...indicator, gestor: manager.id})
// console.log(manager.id);

const response = await axios.post(url, {...indicator, idGestor: manager.id}, { headers })

console.log(response)
Api.post(url, {...indicator, idGestor: manager.id}, { headers }).then(response => {
console.log(response)
});
} catch (error) {
console.log(error)
}
Expand Down
54 changes: 32 additions & 22 deletions src/contexts/VfoodsContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createContext, SetStateAction, useState, Dispatch, ReactNode, useEffect } from 'react';
import { collaboratorType, indicatorType, managerType, metasMesIndicadorType } from '../types';
import axios from 'axios';
import Api from '../Api';

interface VfoodsContextType {
allCollaborators: collaboratorType[];
Expand Down Expand Up @@ -33,16 +34,21 @@ export function VfoodsProvider({ children }: VfoodsProviderProps) {
// TODO: get manager id from backend
const tempId = '[email protected]'
try {
const url = 'http://localhost:3000/gestor/' + tempId

const response = axios.get(url)

const man = (await response).data

setManager(man)
getCollaborators(man)
getIndicators(man)

const url = 'gestor/' + tempId

// const response = axios.get(url)

Api.get(url).then(response => {
const man = response.data
setManager(man)
getCollaborators(man)
getIndicators(man)
})
/*
console.log(manager);
console.log(allCollaborators);
console.log(allIndicators);
*/
} catch (error) {
console.log(error)
}
Expand All @@ -51,12 +57,13 @@ export function VfoodsProvider({ children }: VfoodsProviderProps) {
const getCollaborators = async (manager: managerType) => {
const urlEmail = manager.email
try {
const url = 'http://localhost:3000/gestor/colaboradores/' + urlEmail
const response = axios.get(url)

const collab = (await response).data
setAllCollab(collab)
console.log(allCollaborators)
const url = 'gestor/colaboradores/' + urlEmail
//const response = axios.get(url)
Api.get(url).then(response => {
const collab = response.data
setAllCollab(collab)
console.log(allCollaborators);
})

} catch (error) {
console.log(error)
Expand All @@ -66,12 +73,15 @@ export function VfoodsProvider({ children }: VfoodsProviderProps) {
const getIndicators = async (manager: managerType) => {
const urlID = manager.id
try {
const url = 'http://localhost:3000/indicador/' + urlID
const response = axios.get(url)

const ind = (await response).data
setAllIndicators(ind)
console.log(allIndicators)
const url = 'indicador/' + urlID

Api.get(url).then(response => {
// console.log(response)
const ind = response.data
setAllIndicators(ind)
// console.log(allIndicators);

})

} catch (error) {
console.log(error)
Expand Down
2 changes: 2 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

:root {
font-family: 'Inter', sans-serif;
background: #FBFBFB;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;

}
2 changes: 1 addition & 1 deletion src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Home() {
return (

<>
<div className='flex'>
<div className='flex w-full'>

<SideBar/>

Expand Down
2 changes: 1 addition & 1 deletion src/pages/Indicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function Indicators() {

<SideBar />

<div className='flex flex-col pt-12 ml-[15rem]'>
<div className='flex flex-col pt-12 ml-[15rem] w-full'>

<div className='flex flex-col items-center pb-16'>

Expand Down
2 changes: 1 addition & 1 deletion src/pages/NewIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function NewIndicator() {

</div>

<div className="flex justify-center items-center">
<div className="flex justify-center items-center bg-white rounded-17">

<div className="flex flex-col justify-center items-center border rounded-17 border-cinza-300 gap-4 w-[34rem] h-[26.5rem]">
<img className="ml-4" src="https://cdn.discordapp.com/attachments/1130244004710195333/1157410547474632744/indicadornovo.png?ex=65188212&is=65173092&hm=0bf52d75be02f5fb12ae781ebee69b357443876afa795638742ff3d334653699&" alt="concluido" />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function Profile () {

<SideBar/>

<div className='flex flex-col items-center pt-12 ml-[15rem] w-full'>
<div className='flex flex-col pt-12 ml-[15rem] w-full'>

<div className='flex flex-col items-center pb-16'>

Expand Down
4 changes: 2 additions & 2 deletions src/pages/Ranking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { SideBar } from "../componets/SideBar/SideBar"
export default function Ranking() {
return (
<>
<div className='flex'>
<div className='flex w-full'>

<SideBar/>

<div className='flex flex-col items-center pt-12 ml-[15rem] w-full'>
<div className='flex flex-col pt-12 ml-[15rem] w-full'>

<div className='flex flex-col items-center pb-16'>

Expand Down

0 comments on commit edcf7d9

Please sign in to comment.