Skip to content

Commit

Permalink
Merge pull request #62 from fga-eps-mds/154-listagem-de-usuario
Browse files Browse the repository at this point in the history
154 listagem de usuario
  • Loading branch information
JoaoVitorFarias authored Jul 10, 2023
2 parents 2b09cd3 + ae73a38 commit f6be836
Show file tree
Hide file tree
Showing 20 changed files with 1,386 additions and 575 deletions.
180 changes: 90 additions & 90 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
{
"name": "alectrion",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "node server/app.js",
"dev": "vite",
"build": " rm -rf dist && tsc && vite build",
"preview": "vite preview --port 8080",
"test": "vitest",
"coverage": "vitest run --coverage",
"lint": "eslint ./",
"lint:fix": "yarn lint --fix",
"prepare": "husky install",
"lint-staged": "lint-staged"
},
"lint-staged": {
"*.ts": [
"yarn lint:fix"
],
"*.tsx": [
"yarn lint:fix"
]
},
"dependencies": {
"@chakra-ui/icons": "^2.0.19",
"@chakra-ui/react": "^2.4.6",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@react-pdf/renderer": "^3.1.11",
"@tanstack/react-query": "^4.3.9",
"@tanstack/react-query-devtools": "^4.3.9",
"axios": "^1.2.2",
"chakra-react-select": "^4.4.3",
"date-fns": "^2.30.0",
"express": "^4.18.2",
"express-history-api-fallback": "^2.2.1",
"express-static-gzip": "^2.1.7",
"formik": "^2.2.9",
"framer-motion": "^6",
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.5.28",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-datepicker": "^4.11.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.41.5",
"react-icons": "^4.8.0",
"react-input-mask": "^2.0.4",
"react-pdf": "^7.0.3",
"react-render-if-visible": "^2.1.1",
"react-router-dom": "^6.6.1",
"react-toastify": "^9.1.2",
"sass": "^1.57.1",
"xlsx": "^0.18.5",
"vitest-sonar-reporter": "^0.4.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/react": "^18.0.26",
"@types/react-datepicker": "^4.8.0",
"@types/react-dom": "^18.0.9",
"@types/react-input-mask": "^3.0.2",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@vitejs/plugin-react-swc": "^3.0.0",
"@vitest/coverage-c8": "^0.27.0",
"eslint": "^8.2.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"husky": "^8.0.3",
"intersection-observer": "^0.12.2",
"jsdom": "^20.0.3",
"lint-staged": "^13.1.0",
"prettier": "^2.8.1",
"typescript": "^4.9.3",
"vite": "^4.0.0",
"vite-plugin-compression": "^0.5.1",
"vite-tsconfig-paths": "^4.0.3",
"vitest": "^0.26.3",
"zlib": "^1.0.5"
}
}
"name": "alectrion",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "node server/app.js",
"dev": "vite",
"build": " rm -rf dist && tsc && vite build",
"preview": "vite preview --port 8080",
"test": "vitest",
"coverage": "vitest run --coverage",
"lint": "eslint ./",
"lint:fix": "yarn lint --fix",
"prepare": "husky install",
"lint-staged": "lint-staged"
},
"lint-staged": {
"*.ts": [
"yarn lint:fix"
],
"*.tsx": [
"yarn lint:fix"
]
},
"dependencies": {
"@chakra-ui/icons": "^2.0.19",
"@chakra-ui/react": "^2.4.6",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@react-pdf/renderer": "^3.1.11",
"@tanstack/react-query": "^4.3.9",
"@tanstack/react-query-devtools": "^4.3.9",
"axios": "^1.2.2",
"chakra-react-select": "^4.4.3",
"date-fns": "^2.30.0",
"express": "^4.18.2",
"express-history-api-fallback": "^2.2.1",
"express-static-gzip": "^2.1.7",
"formik": "^2.2.9",
"framer-motion": "^6",
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.5.28",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-datepicker": "^4.11.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.41.5",
"react-icons": "^4.8.0",
"react-input-mask": "^2.0.4",
"react-pdf": "^7.0.3",
"react-render-if-visible": "^2.1.1",
"react-router-dom": "^6.6.1",
"react-toastify": "^9.1.2",
"sass": "^1.57.1",
"xlsx": "^0.18.5",
"vitest-sonar-reporter": "^0.4.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/react": "^18.0.26",
"@types/react-datepicker": "^4.8.0",
"@types/react-dom": "^18.0.9",
"@types/react-input-mask": "^3.0.2",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@vitejs/plugin-react-swc": "^3.0.0",
"@vitest/coverage-c8": "^0.27.0",
"eslint": "^8.2.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"husky": "^8.0.3",
"intersection-observer": "^0.12.2",
"jsdom": "^20.0.3",
"lint-staged": "^13.1.0",
"prettier": "^2.8.1",
"typescript": "^4.9.3",
"vite": "^4.0.0",
"vite-plugin-compression": "^0.5.1",
"vite-tsconfig-paths": "^4.0.3",
"vitest": "^0.26.3",
"zlib": "^1.0.5"
}
}
103 changes: 103 additions & 0 deletions src/components/action-buttons/delete-extensive-icon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
Este código foi adaptado do repositório "2022-2-schedula-front":https://github.com/fga-eps-mds/2022-2-schedula-front/
Agradecemos aos contribuidores desse projeto por fornecer um ponto de partida útil para nossa
implementação.
Aqui, fizemos modificações no código original para se adequar ao nosso caso específico de uso.
Quaisquer erros ou bugs nesta implementação são de nossa responsabilidade.
*/
import { useCallback, useState } from 'react';
import {
Button,
Flex,
Heading,
Popover,
PopoverAnchor,
PopoverArrow,
PopoverBody,
PopoverCloseButton,
PopoverContent,
PopoverFooter,
PopoverHeader,
Text,
useDisclosure,
IconButton,
} from '@chakra-ui/react';
import { MdDelete } from 'react-icons/md';
import { ActionButtonProps } from '../types';

type DeleteButtonProps<Data> = ActionButtonProps<Data>;

const tooltipStyle = {
bg: 'red.500',
color: 'white',
};

export function DeleteExtensiveIcon<Data>({
label,
onClick,
...props
}: DeleteButtonProps<Data>) {
const { isOpen, onOpen, onClose } = useDisclosure();

const [isLoading, setIsLoading] = useState(false);

const handleDelete = useCallback(async () => {
setIsLoading(true);
await (onClick as () => void)?.();
onClose?.();
setIsLoading(false);
}, [onClose, onClick]);

return (
<Popover isOpen={isOpen} onOpen={onOpen} onClose={onClose} placement="top">
<PopoverAnchor>
<IconButton
aria-label="Excluir Usuário"
variant="ghost"
icon={<MdDelete />}
width="5%"
onClick={onOpen}
/>
</PopoverAnchor>
<PopoverContent
data-testid="delete-confirmation-popover"
border={0}
borderRadius="base"
bg="blackAlpha.600"
backdropFilter="blur(8px)"
color="white"
>
<PopoverArrow />
<PopoverCloseButton color="white" top={2} right={2} />

<PopoverHeader bg="blackAlpha.600" borderTopRadius="base" border={0}>
<Heading size="md" color="white" fontWeight="semibold">
Excluir {label}
</Heading>
</PopoverHeader>

<PopoverBody bg="blackAlpha.300">
<Text>
Você realmente deseja excluir o <strong>{label}</strong>?
</Text>
<Text fontStyle="italic" mt={1}>
Está ação não poderá ser desfeita.
</Text>
</PopoverBody>

<PopoverFooter borderBottomRadius="base" border={0} bg="blackAlpha.300">
<Flex justifyContent="space-between">
<Button onClick={onClose} variant="solid" colorScheme="blackAlpha">
Cancelar
</Button>
<Button onClick={handleDelete} colorScheme="red" variant="solid">
Excluir
</Button>
</Flex>
</PopoverFooter>
</PopoverContent>
</Popover>
);
}
13 changes: 8 additions & 5 deletions src/components/equipment-edit-form/equipment-edit-form.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import EquipmentEditForm from '.';
const EQUIPMENT_MOCK = {
tippingNumber: 'tippingNumber',
serialNumber: 'serialNumber',
type: 'type',
type: { name: 'type' },
situacao: 'situacao',
model: 'model',
description: 'description',
Expand Down Expand Up @@ -39,7 +39,7 @@ describe('EquipmentEditForm', () => {
});

it('should render cpu fields', () => {
const equipmentMock = { ...EQUIPMENT_MOCK, type: 'CPU' };
const equipmentMock = { ...EQUIPMENT_MOCK, type: { name: 'CPU' } };
render(
<EquipmentEditForm
onClose={vi.fn()}
Expand All @@ -58,7 +58,7 @@ describe('EquipmentEditForm', () => {
});

it('should render monitor fields', () => {
const equipmentMock = { ...EQUIPMENT_MOCK, type: 'Monitor' };
const equipmentMock = { ...EQUIPMENT_MOCK, type: { name: 'Monitor' } };
render(
<EquipmentEditForm
onClose={vi.fn()}
Expand All @@ -73,7 +73,10 @@ describe('EquipmentEditForm', () => {
});

it('should render estabilizador fields', () => {
const equipmentMock = { ...EQUIPMENT_MOCK, type: 'Estabilizador' };
const equipmentMock = {
...EQUIPMENT_MOCK,
type: { name: 'Estabilizador' },
};
render(
<EquipmentEditForm
onClose={vi.fn()}
Expand All @@ -87,7 +90,7 @@ describe('EquipmentEditForm', () => {
});

it('should render Nobreak fields', () => {
const equipmentMock = { ...EQUIPMENT_MOCK, type: 'Nobreak' };
const equipmentMock = { ...EQUIPMENT_MOCK, type: { name: 'Nobreak' } };
render(
<EquipmentEditForm
onClose={vi.fn()}
Expand Down
Loading

0 comments on commit f6be836

Please sign in to comment.