-
Notifications
You must be signed in to change notification settings - Fork 5
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 #43 from decentraland/feat/project-personnel
feat: project personnel view
- Loading branch information
Showing
18 changed files
with
290 additions
and
32 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
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
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
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
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
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
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,35 @@ | ||
.EditableBreakdownContent__Text { | ||
color: var(--black-600); | ||
font-size: 15px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 24px; | ||
padding: 10px 0; | ||
} | ||
|
||
.EditableBreakdownContent__Footer { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: end; | ||
} | ||
|
||
.RelevantLink { | ||
display: flex; | ||
padding: 5px 9px; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 4px; | ||
border-radius: 6px; | ||
background: var(--red-200); | ||
max-width: 120px; | ||
} | ||
|
||
.RelevantLink__Text { | ||
color: var(--primary); | ||
text-align: center; | ||
font-size: 11px; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: 18px; /* 163.636% */ | ||
text-transform: uppercase; | ||
} |
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,38 @@ | ||
import { Button } from 'decentraland-ui/dist/components/Button/Button' | ||
|
||
import useFormatMessage from '../../hooks/useFormatMessage.ts' | ||
import Link from '../Common/Typography/Link.tsx' | ||
import Open from '../Icon/Open.tsx' | ||
|
||
import './EditableBreakdownContent.css' | ||
|
||
interface Props { | ||
about: string | ||
relevantLink?: string | ||
onClick: () => void | ||
} | ||
|
||
function EditableBreakdownContent({ about, relevantLink, onClick }: Props) { | ||
const t = useFormatMessage() | ||
|
||
return ( | ||
<div> | ||
<div className="EditableBreakdownContent__Text">{about}</div> | ||
<div className="EditableBreakdownContent__Footer"> | ||
{relevantLink ? ( | ||
<Link className="RelevantLink" href={relevantLink} target="_blank"> | ||
<div className="RelevantLink__Text">{t('component.expandable_breakdown_item.relevant_link_label')}</div> | ||
<Open size={10} /> | ||
</Link> | ||
) : ( | ||
<div></div> | ||
)} | ||
<Button basic onClick={onClick}> | ||
{t('component.expandable_breakdown_item.edit_action_label')} | ||
</Button> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default EditableBreakdownContent |
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,43 @@ | ||
import { useMemo } from 'react' | ||
|
||
import useFormatMessage from '../../hooks/useFormatMessage.ts' | ||
import { TeamMember } from '../../types/grants.ts' | ||
import Username from '../Common/Username.tsx' | ||
import { BreakdownItem } from '../GrantRequest/BreakdownAccordion.tsx' | ||
|
||
import EditableBreakdownContent from './EditableBreakdownContent.tsx' | ||
import ExpandableBreakdownItem from './ExpandableBreakdownItem.tsx' | ||
import ProjectSidebarSectionTitle from './ProjectSidebarSectionTitle.tsx' | ||
|
||
interface Props { | ||
members: TeamMember[] | ||
} | ||
|
||
function EditablePersonnelView({ members }: Props) { | ||
const t = useFormatMessage() | ||
|
||
function getTitle(name: string, address?: string) { | ||
return address && address.length > 0 ? <Username address={address} size="sm" linked variant="address" /> : name | ||
} | ||
|
||
const items = useMemo( | ||
() => | ||
members.map<BreakdownItem>(({ name, role, about, relevantLink, address }) => ({ | ||
title: getTitle(name, address), | ||
subtitle: role, | ||
content: <EditableBreakdownContent about={about} onClick={() => {}} relevantLink={relevantLink} />, | ||
})), | ||
[members] | ||
) | ||
|
||
return ( | ||
<> | ||
<ProjectSidebarSectionTitle text={t('page.proposal_view.grant.personnel_title')} /> | ||
{items.map((item, key) => { | ||
return <ExpandableBreakdownItem key={key} item={item} /> | ||
})} | ||
</> | ||
) | ||
} | ||
|
||
export default EditablePersonnelView |
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,36 @@ | ||
.ExpandableBreakdownItem { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
background: var(--white-900); | ||
margin-bottom: 16px; | ||
padding: 16px; | ||
min-height: 64px; | ||
border: 1px solid var(--black-300); | ||
box-shadow: 0 1px 4px var(--alpha-black-300); | ||
border-radius: 8px; | ||
} | ||
|
||
.ExpandableBreakdownItem__Header { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
cursor: pointer; | ||
width: 100%; | ||
} | ||
|
||
.ExpandableBreakdownItem__Content { | ||
display: none; | ||
min-height: 64px; | ||
} | ||
|
||
.ExpandableBreakdownItem__Content--expanded { | ||
display: block; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-top: 16px; | ||
background: var(--white-900); | ||
width: 100%; | ||
border-top: 1px solid var(--black-300); | ||
} |
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,51 @@ | ||
import { useState } from 'react' | ||
|
||
import classNames from 'classnames' | ||
|
||
import ChevronRightCircleOutline from '../Icon/ChevronRightCircleOutline.tsx' | ||
|
||
import './ExpandableBreakdownItem.css' | ||
|
||
interface ExpandableBreakdownItemProps { | ||
title: React.ReactNode | ||
subtitle: string | ||
content: React.ReactNode | ||
} | ||
|
||
interface Props { | ||
item: ExpandableBreakdownItemProps | ||
initiallyExpanded?: boolean | ||
} | ||
|
||
function ExpandableBreakdownItem({ item, initiallyExpanded = false }: Props) { | ||
const { title, subtitle, content } = item | ||
const [isActive, setIsActive] = useState(initiallyExpanded) | ||
|
||
return ( | ||
<div className="ExpandableBreakdownItem"> | ||
<div role="button" className="ExpandableBreakdownItem__Header" onClick={() => setIsActive((prev) => !prev)}> | ||
<div> | ||
<div className="BreakdownItem__Title">{title}</div> | ||
<div className="BreakdownItem__Subtitle">{subtitle}</div> | ||
</div> | ||
<div> | ||
<span> | ||
<ChevronRightCircleOutline | ||
className={classNames('BreakdownAccordion__Arrow', isActive && 'BreakdownAccordion__Arrow--selected')} | ||
/> | ||
</span> | ||
</div> | ||
</div> | ||
<div | ||
className={classNames( | ||
'ExpandableBreakdownItem__Content', | ||
isActive && 'ExpandableBreakdownItem__Content--expanded' | ||
)} | ||
> | ||
{content} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default ExpandableBreakdownItem |
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,18 @@ | ||
import { Project } from '../../types/proposals.ts' | ||
|
||
import EditablePersonnelView from './EditablePersonnelView.tsx' | ||
import './ProjectSidebar.css' | ||
|
||
interface Props { | ||
project: Project | ||
} | ||
|
||
function ProjectGeneralInfo({ project }: Props) { | ||
return ( | ||
<div className="ProjectSidebar__ContentContainer"> | ||
<EditablePersonnelView members={project.personnel} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default ProjectGeneralInfo |
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
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,15 @@ | ||
import Text from '../Common/Typography/Text.tsx' | ||
|
||
interface Props { | ||
text: string | ||
} | ||
|
||
function ProjectSidebarSectionTitle({ text }: Props) { | ||
return ( | ||
<Text size="sm" color="default" weight="semi-bold" transform="uppercase"> | ||
{text} | ||
</Text> | ||
) | ||
} | ||
|
||
export default ProjectSidebarSectionTitle |
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.