-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from fga-eps-mds/154-listagem-de-usuario
154 listagem de usuario
- Loading branch information
Showing
20 changed files
with
1,386 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
103
src/components/action-buttons/delete-extensive-icon/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.