Skip to content

Commit 9dc5f72

Browse files
authored
Feat/service provider role (#1422)
* service provider type defined * a full flow with provider role * lint and format fixes * adding seed to heroku postbuild
1 parent a277a91 commit 9dc5f72

13 files changed

Lines changed: 82 additions & 19 deletions

File tree

frontend/src/components/areas/private/features/roles/user-roles.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react'
22
import PropTypes from 'prop-types'
33
import { FormattedMessage, defineMessages, useIntl } from 'react-intl'
44
import { Box, Button } from '@mui/material'
5-
import funder from 'images/bounty.png'
6-
import contributor from 'images/sharing.png'
7-
import maintainer from 'images/notifications.png'
5+
import funder from 'images/roles/bounty.png'
6+
import contributor from 'images/roles/sharing.png'
7+
import maintainer from 'images/roles/notifications.png'
8+
import serviceProvider from 'images/roles/payment-cycle.png'
89

910
import SelectChoices from 'design-library/molecules/select-choices/select-choices'
1011
import MainTitle from 'design-library/atoms/typography/main-title/main-title'
@@ -23,7 +24,8 @@ const messages = defineMessages({
2324
const imageMap = {
2425
funding: funder,
2526
contributor: contributor,
26-
maintainer: maintainer
27+
maintainer: maintainer,
28+
provider: serviceProvider
2729
}
2830

2931
const Roles = ({ roles, user, fetchRoles, updateUser, onClose, addNotification }) => {

frontend/src/components/design-library/molecules/cards/dashboard-cards/dashboard-card-list/dashboard-card-list.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { CardList, ContentWrapper } from './dashboard-card-list.styles'
1111

1212
const DashboardCardList = ({ user, dashboard }) => {
1313
const { completed } = user || {}
14-
const { isMaintainer, isFunding, isContributor } = useUserTypes({ user })
14+
const { isMaintainer, isFunding, isContributor, isProvider } = useUserTypes({ user })
1515
const { completed: dashboardCompleted, data: dashboardData } = dashboard || {}
1616

1717
return completed && dashboardCompleted ? (
@@ -24,7 +24,7 @@ const DashboardCardList = ({ user, dashboard }) => {
2424
<WalletsDashboardCard wallets={dashboardData.wallets} />
2525
</>
2626
)}
27-
{isContributor && (
27+
{(isContributor || isProvider) && (
2828
<>
2929
<PaymentRequestsDashboardCard paymentRequests={dashboardData.paymentRequests} />
3030
<ClaimsDashboardCard claims={dashboardData.claims} />

frontend/src/components/design-library/molecules/select-choices/select-choices.styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const SelectChoicesCard = styled(Card)(() => ({
3838
export const SelectChoicesMedia = styled('div')(({ theme }) => ({
3939
height: 96,
4040
width: '100%',
41-
backgroundColor: theme.palette.action.hover,
41+
backgroundColor: '#090607',
4242
display: 'flex',
4343
alignItems: 'center',
4444
justifyContent: 'center',

frontend/src/components/design-library/molecules/select-choices/select-choices.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const SelectChoices = <TItem,>({
4848
getDescription,
4949
isSelected,
5050
onToggle,
51-
itemSize = { xs: 12, sm: 6, md: 4 }
51+
itemSize = { xs: 12, sm: 6, md: 3 }
5252
}: SelectChoicesProps<TItem>) => {
5353
const placeholders = Array(placeholderCount).fill(null)
5454

@@ -73,7 +73,7 @@ const SelectChoices = <TItem,>({
7373
</SelectChoicesHeader>
7474
) : null}
7575

76-
<SelectChoicesGrid container spacing={2} alignItems="stretch">
76+
<SelectChoicesGrid container spacing={2} alignItems="stretch" justifyContent="space-around">
7777
{loading ? (
7878
<>
7979
{placeholders.map((_, index) => (

frontend/src/hooks/use-profile-sidebar-menu.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import useUserTypes from './use-user-types'
1616
const useProfileSidebarMenu = ({ user }) => {
1717
const [selected, setSelected] = useState(0)
1818
const history = useHistory()
19-
const { isContributor, isMaintainer, isFunding, completed } = useUserTypes({ user })
19+
const { isContributor, isMaintainer, isFunding, isProvider, completed } = useUserTypes({ user })
2020

2121
useEffect(() => {
2222
const path = history.location.pathname
@@ -63,7 +63,9 @@ const useProfileSidebarMenu = ({ user }) => {
6363
]
6464
},
6565
{
66-
category: <FormattedMessage id="account.profile.sidemenu.issues" defaultMessage="Issues" />,
66+
category: (isFunding || isMaintainer || isContributor) && (
67+
<FormattedMessage id="account.profile.sidemenu.issues" defaultMessage="Issues" />
68+
),
6769
items: [
6870
{
6971
include: isContributor || isMaintainer || isFunding,
@@ -116,15 +118,15 @@ const useProfileSidebarMenu = ({ user }) => {
116118
]
117119
},
118120
{
119-
category: isContributor && (
121+
category: (isContributor || isProvider) && (
120122
<FormattedMessage
121123
id="account.profile.sidemenu.section.paymentrequests"
122124
defaultMessage="Payment Requests"
123125
/>
124126
),
125127
items: [
126128
{
127-
include: isContributor,
129+
include: isContributor || isProvider,
128130
onClick: () => history.push('/profile/payment-requests'),
129131
icon: <PaymentRequestsIcon />,
130132
label: (
@@ -138,15 +140,15 @@ const useProfileSidebarMenu = ({ user }) => {
138140
]
139141
},
140142
{
141-
category: isContributor && (
143+
category: (isContributor || isProvider) && (
142144
<FormattedMessage
143145
id="account.profile.sidemenu.section.receivepayments"
144146
defaultMessage="Receive Payments"
145147
/>
146148
),
147149
items: [
148150
{
149-
include: isContributor,
151+
include: isContributor || isProvider,
150152
onClick: () => history.push('/profile/claims'),
151153
icon: <ClaimIcon />,
152154
label: (
@@ -158,7 +160,7 @@ const useProfileSidebarMenu = ({ user }) => {
158160
selected: selected === 6
159161
},
160162
{
161-
include: isContributor,
163+
include: isContributor || isProvider,
162164
onClick: () => history.push('/profile/payouts'),
163165
icon: <PayoutIcon />,
164166
label: (

frontend/src/hooks/use-user-types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ const useUserTypes = ({ user }) => {
55
const [isContributor, setIsContributor] = useState(false)
66
const [isMaintainer, setIsMaintainer] = useState(false)
77
const [isFunding, setIsFunding] = useState(false)
8+
const [isProvider, setIsProvider] = useState(false)
89

910
useEffect(() => {
1011
const types = data?.Types ?? []
1112
setIsContributor(types.some((type) => type?.name === 'contributor'))
1213
setIsMaintainer(types.some((type) => type?.name === 'maintainer'))
1314
setIsFunding(types.some((type) => type?.name === 'funding'))
15+
setIsProvider(types.some((type) => type?.name === 'provider'))
1416
}, [data])
1517

16-
return { isContributor, isMaintainer, isFunding, completed }
18+
return { isContributor, isMaintainer, isFunding, isProvider, completed }
1719
}
1820

1921
export default useUserTypes
203 KB
Loading
180 KB
Loading
302 KB
Loading
243 KB
Loading

0 commit comments

Comments
 (0)