-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* show employment details on teams * teamlist page redesign * removed client column and some UI fixes * worked on review comments * common component Button added * static salary value removed and empty state added * intervalToDuration func used to calculate duration --------- Co-authored-by: “Apoorv <“tiwari.apoorv1316@gmail.com”> Co-authored-by: Apoorv Tiwari <tiwari.apoorv1316@gmail.com> Co-authored-by: Saeloun <saeloun@Saelouns-MacBook-Pro.local>
- Loading branch information
1 parent
0ae2214
commit 69fe1d8
Showing
9 changed files
with
278 additions
and
245 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
|
||
type Iprops = { | ||
children: any; | ||
position?: string; | ||
}; | ||
|
||
const HoverMoreOptions = ({ children, position }: Iprops) => ( | ||
<div | ||
className={`absolute ${ | ||
position || "bottom-16 right-0" | ||
} hidden items-center justify-between rounded-xl border-2 border-miru-gray-200 bg-white lg:w-28 lg:p-2 lg:group-hover:flex xl:w-40 xl:p-3`} | ||
onClick={e => e.stopPropagation()} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
export default HoverMoreOptions; |
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
93 changes: 93 additions & 0 deletions
93
app/javascript/src/components/Team/List/Table/MoreOptions.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,93 @@ | ||
import React from "react"; | ||
|
||
import { DeleteIcon, EditIcon, ResendInviteIcon } from "miruIcons"; | ||
import { Button, MobileMoreOptions, Tooltip } from "StyledComponents"; | ||
|
||
import teamApi from "apis/team"; | ||
import HoverMoreOptions from "common/HoverMoreOptions"; | ||
import { TeamModalType } from "constants/index"; | ||
import { useList } from "context/TeamContext"; | ||
import { useUserContext } from "context/UserContext"; | ||
|
||
type Iprops = { | ||
item: any; | ||
setShowMoreOptions?: React.Dispatch<React.SetStateAction<boolean>>; | ||
showMoreOptions?: boolean; | ||
}; | ||
|
||
const MoreOptions = ({ item, setShowMoreOptions, showMoreOptions }: Iprops) => { | ||
const { setModalState } = useList(); | ||
const { isDesktop } = useUserContext(); | ||
|
||
const handleResendInvite = async () => { | ||
await teamApi.resendInvite(item.id); | ||
}; | ||
|
||
const handleAction = (e, action) => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
setModalState(action, item); | ||
}; | ||
|
||
return isDesktop ? ( | ||
<HoverMoreOptions position="bottom-10 right-0"> | ||
<Tooltip content="Re-Invite"> | ||
<Button | ||
disabled={!item.status} | ||
style="ternary" | ||
onClick={handleResendInvite} | ||
> | ||
<ResendInviteIcon size={16} weight="bold" /> | ||
</Button> | ||
</Tooltip> | ||
<Tooltip content="Edit"> | ||
<Button | ||
style="ternary" | ||
onClick={e => { | ||
handleAction(e, TeamModalType.ADD_EDIT); | ||
}} | ||
> | ||
<EditIcon size={16} weight="bold" /> | ||
</Button> | ||
</Tooltip> | ||
<Tooltip content="Delete"> | ||
<Button | ||
style="ternary" | ||
onClick={e => { | ||
handleAction(e, TeamModalType.DELETE); | ||
}} | ||
> | ||
<DeleteIcon className="text-miru-red-400" size={16} weight="bold" /> | ||
</Button> | ||
</Tooltip> | ||
</HoverMoreOptions> | ||
) : ( | ||
<MobileMoreOptions | ||
setVisibilty={setShowMoreOptions} | ||
visibilty={showMoreOptions} | ||
> | ||
<li | ||
className="flex items-center px-2 pt-3 text-sm leading-5 text-miru-han-purple-1000" | ||
onClick={e => { | ||
setShowMoreOptions(false); | ||
handleAction(e, TeamModalType.ADD_EDIT); | ||
}} | ||
> | ||
<EditIcon className="mr-4" color="#5B34EA" size={16} /> | ||
Edit | ||
</li> | ||
<li | ||
className="flex items-center px-2 pt-3 text-sm leading-5 text-miru-red-400" | ||
onClick={e => { | ||
setShowMoreOptions(false); | ||
handleAction(e, TeamModalType.DELETE); | ||
}} | ||
> | ||
<DeleteIcon className="mr-4" size={16} /> | ||
Delete | ||
</li> | ||
</MobileMoreOptions> | ||
); | ||
}; | ||
|
||
export default MoreOptions; |
64 changes: 19 additions & 45 deletions
64
app/javascript/src/components/Team/List/Table/TableHead.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 |
---|---|---|
@@ -1,47 +1,21 @@ | ||
import React, { Fragment } from "react"; | ||
|
||
import { useUserContext } from "context/UserContext"; | ||
|
||
const TableHead = () => { | ||
const { isAdminUser, isDesktop } = useUserContext(); | ||
|
||
if (isDesktop) { | ||
return ( | ||
<thead className=" border-miru-gray-200"> | ||
<tr> | ||
<th className="table__header p-6" scope="col"> | ||
NAME | ||
</th> | ||
<th className="table__header p-6" scope="col"> | ||
EMAIL ID | ||
</th> | ||
<th className="table__header p-6" scope="col"> | ||
ROLE | ||
</th> | ||
{isAdminUser && ( | ||
<Fragment> | ||
<th className="table__header p-6" scope="col" /> | ||
<th className="table__header p-6" scope="col" /> | ||
</Fragment> | ||
)} | ||
</tr> | ||
</thead> | ||
); | ||
} | ||
|
||
return ( | ||
<thead className=" border-miru-gray-200"> | ||
<tr> | ||
<th className="table__header w-1/2 p-6" scope="col"> | ||
NAME / EMAIL ID | ||
</th> | ||
<th className="table__header w-1/3 p-6 text-right" scope="col"> | ||
ROLE | ||
</th> | ||
<th className="table__header" scope="col" /> | ||
</tr> | ||
</thead> | ||
); | ||
}; | ||
import React from "react"; | ||
|
||
const TableHead = () => ( | ||
<thead className="border-miru-gray-200 lg:grid"> | ||
<tr className="flex lg:grid lg:grid-cols-10 lg:gap-4"> | ||
<th className="w-3/5 py-2 text-left text-xs font-medium leading-4 tracking-widest text-miru-dark-purple-600 lg:col-span-4 lg:py-5"> | ||
USER | ||
</th> | ||
<th className="col-span-2 hidden py-2 text-left text-xs font-medium leading-4 tracking-widest text-miru-dark-purple-600 lg:table-cell lg:py-5"> | ||
SALARY | ||
</th> | ||
<th className="w-2/5 py-2 text-left text-xs font-medium leading-4 tracking-widest text-miru-dark-purple-600 lg:col-span-2 lg:py-5"> | ||
ROLE | ||
</th> | ||
<th className="col-span-2 hidden py-2 text-left text-xs font-medium leading-4 tracking-widest text-miru-dark-purple-600 lg:table-cell lg:py-5"> | ||
TYPE | ||
</th> | ||
</tr> | ||
</thead> | ||
); | ||
export default TableHead; |
Oops, something went wrong.