Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: create team page refactor and tests #1226

Merged
merged 37 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9477867
refactor: remove unnecessary ref
jpvsalvador Mar 6, 2023
1539c7c
Merge remote-tracking branch 'origin/main' into 1190-feature-create-t…
jpvsalvador Mar 8, 2023
275058e
refactor: group up alert dialog primitives
jpvsalvador Mar 8, 2023
9e70e27
refactor: normalize ListMembersDialog component
jpvsalvador Mar 8, 2023
bd53222
fix: change alert dialog paths
jpvsalvador Mar 8, 2023
3105580
test: add checkboxUserItem tests
jpvsalvador Mar 8, 2023
018c667
test: add userListDialog tests
jpvsalvador Mar 8, 2023
f15e9a3
Merge branch 'main' into 1190-feature-create-team-page-refactor-and-t…
StereoPT Mar 10, 2023
c96ce8d
refactor: alerts & avatars
StereoPT Mar 10, 2023
63e716a
refactor: breadcrumb
StereoPT Mar 10, 2023
68cd4f1
refactor: dialogs
StereoPT Mar 10, 2023
da11255
refactor: inputs & loadings
StereoPT Mar 10, 2023
a8442bf
refactor: tooltip
StereoPT Mar 10, 2023
74d80f0
refactor: layout
StereoPT Mar 10, 2023
f8bd770
refactor: button
StereoPT Mar 10, 2023
4732787
refactor: switches & checkbox
StereoPT Mar 10, 2023
8703595
refactor: icon & svg
StereoPT Mar 10, 2023
362e9b0
refactor: input elements
StereoPT Mar 10, 2023
7696790
refactor: popover & toast
StereoPT Mar 10, 2023
363e9eb
refactor: text
StereoPT Mar 10, 2023
5d07fea
refactor: team list
StereoPT Mar 10, 2023
1759750
refactor: new joiner tooltip
StereoPT Mar 10, 2023
f084281
refactor: role selector & popover
StereoPT Mar 10, 2023
790f487
refactor: team folder
StereoPT Mar 10, 2023
bca2ec8
refactor: create team
StereoPT Mar 10, 2023
05d9633
refactor: userCheckbox
jpvsalvador Mar 10, 2023
d84743f
refactor: primitive story paths
jpvsalvador Mar 10, 2023
14d2491
refactor: story locations
jpvsalvador Mar 10, 2023
3d6a8b8
feat: coverage
StereoPT Mar 10, 2023
97786ab
fix: coverage ignore stories
StereoPT Mar 10, 2023
4d52a19
test: breadcrumb
StereoPT Mar 10, 2023
1f50a47
test: test suit names
StereoPT Mar 10, 2023
0ed3133
test: configuration switch
StereoPT Mar 10, 2023
cf59112
test: add avatar group tests
jpvsalvador Mar 10, 2023
bd01c82
test: add dialog primitive tests
jpvsalvador Mar 10, 2023
fc1ac0f
fix: pr suggestions
jpvsalvador Mar 13, 2023
2063283
fix: pr suggestions
jpvsalvador Mar 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const customJestConfig = {
'^@/(.*)$': '<rootDir>/src/$1',
},
collectCoverage: true,
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.stories.tsx',
'!src/{schema,store,stories,styles,types}/**/*.*',
],
};

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"pre-commit": "lint-staged",
"cy:run": "cypress run",
"cy:ci": "start-server-and-test dev http-get://localhost:3000 cy:run",
"jest": "jest",
"jest": "jest --coverage",
"test:watch": "jest --watchAll",
"test:ci": "jest --ci",
"storybook": "start-storybook -p 6006",
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/Board/AddCardOrComment.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect, useMemo, useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import { joiResolver } from '@hookform/resolvers/joi';
import Button from '@/components/Primitives/Button';
import Checkbox from '@/components/Primitives/Checkbox';
import Flex from '@/components/Primitives/Flex';
import TextArea from '@/components/Primitives/TextArea';
import Button from '@/components/Primitives/Inputs/Button/Button';
import Checkbox from '@/components/Primitives/Inputs/Checkboxes/Checkbox/Checkbox';
import Flex from '@/components/Primitives/Layout/Flex';
import TextArea from '@/components/Primitives/Inputs/TextArea/TextArea';
import useCards from '@/hooks/useCards';
import useComments from '@/hooks/useComments';
import { SchemaAddCommentForm } from '@/schema/schemaAddCommentForm';
Expand All @@ -15,7 +15,7 @@ import AddCommentDto from '@/types/comment/addComment.dto';
import UpdateCommentDto from '@/types/comment/updateComment.dto';
import { styled } from '@/styles/stitches/stitches.config';
import { CARD_TEXT_DEFAULT } from '@/utils/constants';
import Icon from '../Primitives/Icon';
import Icon from '../Primitives/Icons/Icon/Icon';

const StyledForm = styled('form', Flex, { width: '100%' });

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Board/Card/CardBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Draggable } from '@hello-pangea/dnd';

import { styled } from '@/styles/stitches/stitches.config';

import Icon from '@/components/Primitives/Icon';
import Flex from '@/components/Primitives/Flex';
import Text from '@/components/Primitives/Text';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import Flex from '@/components/Primitives/Layout/Flex';
import Text from '@/components/Primitives/Text/Text';
import { cardBlur } from '@/helper/board/blurFilter';
import { getCommentsFromCardGroup } from '@/helper/board/comments';
import { BoardUser } from '@/types/board/board.user';
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/Board/Card/CardFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useEffect, useMemo, useState } from 'react';

import Icon from '@/components/Primitives/Icon';
import Avatar from '@/components/Primitives/Avatar/Avatar';
import Button from '@/components/Primitives/Button';
import Flex from '@/components/Primitives/Flex';
import Text from '@/components/Primitives/Text';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import Avatar from '@/components/Primitives/Avatars/Avatar/Avatar';
import Button from '@/components/Primitives/Inputs/Button/Button';
import Flex from '@/components/Primitives/Layout/Flex';
import Text from '@/components/Primitives/Text/Text';
import { getCardVotes } from '@/helper/board/votes';
import useVotes from '@/hooks/useVotes';
import { BoardUser } from '@/types/board/board.user';
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Board/Card/CardItem/CardItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import React, { useState } from 'react';
import { styled } from '@/styles/stitches/stitches.config';

import AddCardOrComment from '@/components/Board/AddCardOrComment';
import Flex from '@/components/Primitives/Flex';
import Text from '@/components/Primitives/Text';
import Flex from '@/components/Primitives/Layout/Flex';
import Text from '@/components/Primitives/Text/Text';
import { CardItemType } from '@/types/card/cardItem';
import useCards from '@/hooks/useCards';
import CardFooter from '../CardFooter';
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Board/Card/CardItem/CardItemList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Icon from '@/components/Primitives/Icon';
import Flex from '@/components/Primitives/Flex';
import Separator from '@/components/Primitives/Separator';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import Flex from '@/components/Primitives/Layout/Flex';
import Separator from '@/components/Primitives/Separator/Separator';
import { CardItemType } from '@/types/card/cardItem';
import CardItem from './CardItem';

Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/Board/Card/PopoverSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { useState } from 'react';

import Icon from '@/components/Primitives/Icon';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import {
Popover,
PopoverContent,
PopoverItem,
PopoverTrigger,
} from '@/components/Primitives/Popover';
import Text from '@/components/Primitives/Text';
} from '@/components/Primitives/Popovers/Popover/Popover';
import Text from '@/components/Primitives/Text/Text';
import useCards from '@/hooks/useCards';
import { CardItemType } from '@/types/card/cardItem';
import ConfirmationDialog from '@/components/Primitives/ConfirmationDialog';
import ConfirmationDialog from '@/components/Primitives/Alerts/ConfirmationDialog/ConfirmationDialog';

interface PopoverSettingsContentProps {
isItem: boolean;
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/Board/Column/Column.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useCallback, useEffect, useState } from 'react';
import { Draggable, Droppable } from '@hello-pangea/dnd';
import Flex from '@/components/Primitives/Flex';
import Separator from '@/components/Primitives/Separator';
import Text from '@/components/Primitives/Text';
import Flex from '@/components/Primitives/Layout/Flex';
import Separator from '@/components/Primitives/Separator/Separator';
import Text from '@/components/Primitives/Text/Text';
import { getCardVotes } from '@/helper/board/votes';
import { ColumnBoardType } from '@/types/column';
import { useSetRecoilState } from 'recoil';
import { filteredColumnsState } from '@/store/board/atoms/filterColumns';
import { countColumnCards } from '@/helper/board/countCards';
import Icon from '@/components/Primitives/Icon';
import Tooltip from '@/components/Primitives/Tooltip';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import Tooltip from '@/components/Primitives/Tooltips/Tooltip/Tooltip';
import { useResizeDetector } from 'react-resize-detector';
import AddCardOrComment from '../AddCardOrComment';
import CardsList from './CardsList';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Flex from '@/components/Primitives/Flex';
import Flex from '@/components/Primitives/Layout/Flex';
import { PopoverItemSquareStyled } from '../OptionsMenu/styles';

type ColorSquareProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import Icon from '@/components/Primitives/Icon';
import Flex from '@/components/Primitives/Flex';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import Flex from '@/components/Primitives/Layout/Flex';
import {
Popover,
PopoverContent,
PopoverTrigger,
PopoverItem,
} from '@/components/Primitives/Popover';
import Separator from '@/components/Primitives/Separator';
import Text from '@/components/Primitives/Text';
} from '@/components/Primitives/Popovers/Popover/Popover';
import Separator from '@/components/Primitives/Separator/Separator';
import Text from '@/components/Primitives/Text/Text';
import useColumn from '@/hooks/useColumn';
import CardType from '@/types/card/card';
import { useState } from 'react';
import ConfirmationDialog from '@/components/Primitives/ConfirmationDialog';
import ConfirmationDialog from '@/components/Primitives/Alerts/ConfirmationDialog/ConfirmationDialog';
import useBoard from '@/hooks/useBoard';
import { BoardUserRoles } from '@/utils/enums/board.user.roles';
import { useRecoilValue } from 'recoil';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { styled } from '@/styles/stitches/stitches.config';

import { PopoverItem } from '@/components/Primitives/Popover';
import { PopoverItem } from '@/components/Primitives/Popovers/Popover/Popover';

const PopoverItemSquareStyled = styled(PopoverItem, {
alignItems: 'center',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Board/Column/partials/SortMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Icon from '@/components/Primitives/Icon';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import {
Popover,
PopoverContent,
PopoverTrigger,
PopoverItem,
PopoverClose,
} from '@/components/Primitives/Popover';
import Text from '@/components/Primitives/Text';
} from '@/components/Primitives/Popovers/Popover/Popover';
import Text from '@/components/Primitives/Text/Text';

type Props = {
setFilter: (value: 'desc' | 'asc' | undefined) => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Flex from '@/components/Primitives/Flex';
import Switch from '@/components/Primitives/Switch';
import Flex from '@/components/Primitives/Layout/Flex';
import Switch from '@/components/Primitives/Inputs/Switches/Switch/Switch';

type SwitchDefaultTextProps = {
isChecked: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import {
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
} from '@/components/Primitives/AlertDialog';
import Flex from '@/components/Primitives/Flex';
import Input from '@/components/Primitives/Input';
} from '@/components/Primitives/Alerts/AlertDialog/AlertDialog';
import Flex from '@/components/Primitives/Layout/Flex';
import Input from '@/components/Primitives/Inputs/Input/Input';
import { SchemaChangeColumnName } from '@/schema/schemaChangeColumnName';
import { useRef } from 'react';
import { joiResolver } from '@hookform/resolvers/joi';
import { FormProvider, useForm, useWatch } from 'react-hook-form';
import { styled } from '@/styles/stitches/stitches.config';
import useColumn from '@/hooks/useColumn';
import CardType from '@/types/card/card';
import Text from '@/components/Primitives/Text';
import TextArea from '@/components/Primitives/TextArea';
import Text from '@/components/Primitives/Text/Text';
import TextArea from '@/components/Primitives/Inputs/TextArea/TextArea';

type UpdateColumnNameProps = {
boardId: string;
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Board/Column/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { styled } from '@/styles/stitches/stitches.config';

import Box from '@/components/Primitives/Box';
import Flex from '@/components/Primitives/Flex';
import Text from '@/components/Primitives/Text';
import Box from '@/components/Primitives/Layout/Box';
import Flex from '@/components/Primitives/Layout/Flex';
import Text from '@/components/Primitives/Text/Text';

const CardsContainer = styled(Flex, {
mt: '$20',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Board/Comment/Comment.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';

import Flex from '@/components/Primitives/Flex';
import Text from '@/components/Primitives/Text';
import Flex from '@/components/Primitives/Layout/Flex';
import Text from '@/components/Primitives/Text/Text';
import useComments from '@/hooks/useComments';
import CommentType from '@/types/comment/comment';
import DeleteCommentDto from '@/types/comment/deleteComment.dto';
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/Board/Comment/Comments.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState } from 'react';

import Icon from '@/components/Primitives/Icon';
import Flex from '@/components/Primitives/Flex';
import Separator from '@/components/Primitives/Separator';
import Text from '@/components/Primitives/Text';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import Flex from '@/components/Primitives/Layout/Flex';
import Separator from '@/components/Primitives/Separator/Separator';
import Text from '@/components/Primitives/Text/Text';
import { CardItemType } from '@/types/card/cardItem';
import CommentType from '@/types/comment/comment';
import { BoardPhases } from '@/utils/enums/board.phases';
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/Board/Comment/PopoverSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';

import Icon from '@/components/Primitives/Icon';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import {
Popover,
PopoverContent,
PopoverItem,
PopoverTrigger,
} from '@/components/Primitives/Popover';
import Text from '@/components/Primitives/Text';
} from '@/components/Primitives/Popovers/Popover/Popover';
import Text from '@/components/Primitives/Text/Text';

interface PopoverSettingsContentProps {
setEditCard: () => void;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Board/DragDropArea/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
import { DragDropContext, DropResult, BeforeCapture, Droppable } from '@hello-pangea/dnd';
import Flex from '@/components/Primitives/Flex';
import Flex from '@/components/Primitives/Layout/Flex';
import { countBoardCards } from '@/helper/board/countCards';
import useCards from '@/hooks/useCards';
import { toastState } from '@/store/toast/atom/toast.atom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';

import Flex from '@/components/Primitives/Flex';
import Text from '@/components/Primitives/Text';
import Icon from '@/components/Primitives/Icon';
import Flex from '@/components/Primitives/Layout/Flex';
import Text from '@/components/Primitives/Text/Text';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import { InnerContainer } from '@/components/Teams/styles';
import { BoardUser, UpdateBoardUser } from '@/types/board/board.user';
import Tooltip from '@/components/Primitives/Tooltip';
import Tooltip from '@/components/Primitives/Tooltips/Tooltip/Tooltip';
import { useRouter } from 'next/router';
import ConfigurationSwitch from '@/components/Primitives/ConfigurationSwitch';
import ConfigurationSwitch from '@/components/Primitives/Inputs/Switches/ConfigurationSwitch/ConfigurationSwitch';
import { BoardUserRoles } from '@/utils/enums/board.user.roles';
import useParticipants from '@/hooks/useParticipants';
import Button from '@/components/Primitives/Button';
import Button from '@/components/Primitives/Inputs/Button/Button';

type CardBodyProps = {
member: BoardUser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Icon from '@/components/Primitives/Icon';
import Icon from '@/components/Primitives/Icons/Icon/Icon';
import { ContentSection } from '@/components/layouts/Layout/styles';
import Button from '@/components/Primitives/Button';
import Flex from '@/components/Primitives/Flex';
import Text from '@/components/Primitives/Text';
import ListMembersDialog from '@/components/Teams/Team/ListMembers/ListMembersDialog';
import Button from '@/components/Primitives/Inputs/Button/Button';
import Flex from '@/components/Primitives/Layout/Flex';
import Text from '@/components/Primitives/Text/Text';
import UserListDialog from '@/components/Primitives/Dialogs/UserListDialog/UserListDialog';
import useParticipants from '@/hooks/useParticipants';
import { boardParticipantsState } from '@/store/board/atoms/board.atom';
import { usersListState } from '@/store/team/atom/team.atom';
Expand Down Expand Up @@ -89,13 +89,13 @@ const ParticipantsLayout = ({ children, hasPermissionsToEdit }: Props) => {
</Flex>
{children}
</Flex>
<ListMembersDialog
<UserListDialog
usersList={usersList}
isOpen={isOpen}
setIsOpen={setIsOpen}
saveUsers={saveParticipants}
confirmationHandler={saveParticipants}
title="Board Participants"
btnTitle="Add/remove participants"
confirmationLabel="Add/remove participants"
/>
</ContentSection>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { useRecoilValue } from 'recoil';
import Flex from '@/components/Primitives/Flex';
import Flex from '@/components/Primitives/Layout/Flex';
import { ScrollableContent } from '@/components/Boards/MyBoards/styles';
import { boardParticipantsState } from '@/store/board/atoms/board.atom';
import { BoardUserRoles } from '@/utils/enums/board.user.roles';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useSession } from 'next-auth/react';
import { useRecoilValue } from 'recoil';

import Flex from '@/components/Primitives/Flex';
import Separator from '@/components/Primitives/Separator';
import Text from '@/components/Primitives/Text';
import Flex from '@/components/Primitives/Layout/Flex';
import Separator from '@/components/Primitives/Separator/Separator';
import Text from '@/components/Primitives/Text/Text';
import { boardInfoState } from '@/store/board/atoms/board.atom';
import { StyledBoardTitle } from '@/components/CardBoard/CardBody/CardTitle/partials/Title/styles';
import AvatarGroup from '@/components/Primitives/Avatar/AvatarGroup';
import AvatarGroup from '@/components/Primitives/Avatars/AvatarGroup/AvatarGroup';

interface Props {
isParticipantsPage?: boolean;
Expand All @@ -31,13 +31,7 @@ const HeaderParticipants = ({ isParticipantsPage }: Props) => {
<Text size="sm">Participants</Text>
</StyledBoardTitle>
)}
<AvatarGroup
responsible={false}
listUsers={users}
teamAdmins={false}
userId={session?.user.id}
isClickable
/>
<AvatarGroup listUsers={users} userId={session?.user.id} isClickable />
</Flex>
<Flex align="center">
<Separator orientation="vertical" size="lg" />
Expand All @@ -46,13 +40,7 @@ const HeaderParticipants = ({ isParticipantsPage }: Props) => {
<Text color="primary300" size="sm">
Responsibles
</Text>
<AvatarGroup
responsible
listUsers={users}
teamAdmins={false}
userId={session?.user.id}
isClickable
/>
<AvatarGroup responsible listUsers={users} userId={session?.user.id} isClickable />
</Flex>
</Flex>
);
Expand Down
Loading