Skip to content

Commit e0b4b07

Browse files
authored
Merge branch 'main' into adjust-header-md-share
2 parents 645ba9d + 4242af3 commit e0b4b07

File tree

15 files changed

+468
-312
lines changed

15 files changed

+468
-312
lines changed

cypress/integration/pages/how-to-add.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,13 @@ describe('How To Add Page', () => {
1010
it('middle section loads', () => {
1111
cy.contains('After you have finished adding your tags, click Save Changes');
1212
});
13+
14+
it('copies correct URL', () => {
15+
cy.get('[data-cy=copy-link').click();
16+
cy.window().then((win) => {
17+
win.navigator.clipboard.readText().then((text) => {
18+
expect(text).to.eq(win.location.href);
19+
});
20+
});
21+
});
1322
});

src/components/ContributorThumbnail.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const useStyles = makeStyles((theme) => ({
4040
'& a:visited': {
4141
color: theme.palette.secondary.dark,
4242
},
43-
[theme.breakpoints.between('xs','sm')]: {
43+
[theme.breakpoints.between('xs', 'sm')]: {
4444
fontSize: '12px',
4545
},
4646
[theme.breakpoints.up('md')]: {
@@ -56,7 +56,7 @@ const useStyles = makeStyles((theme) => ({
5656
'& a:visited': {
5757
color: theme.palette.text.secondary,
5858
},
59-
[theme.breakpoints.between('xs','sm')]: {
59+
[theme.breakpoints.between('xs', 'sm')]: {
6060
fontSize: '12px',
6161
},
6262
[theme.breakpoints.up('md')]: {
@@ -81,7 +81,7 @@ const useStyles = makeStyles((theme) => ({
8181
},
8282
contributorItem: {
8383
display: 'grid',
84-
position:'absolute',
84+
position: 'absolute',
8585
marginTop: '2px',
8686
right: '0',
8787
[theme.breakpoints.down('sm')]: {
@@ -172,17 +172,11 @@ const Thumbnail = ({
172172
dropdownLength,
173173
isChildThumbnail,
174174
checkboxValue,
175-
inputValue,
176175
filtersActive,
177176
}) => {
178177
const classes = useStyles();
179178
let thumbnailImageStyle, thumbnailWrapperStyle;
180-
if (
181-
thumbnailInfo.imageUrl.includes('undefined') ||
182-
thumbnailInfo.imageUrl.includes('scontent')
183-
) {
184-
thumbnailInfo.imageUrl = '/images/default-github-repo-image.png';
185-
}
179+
186180
if (organization.cti_contributor) {
187181
thumbnailWrapperStyle = classes.thumbnailWrapperContributor;
188182
} else {
@@ -197,7 +191,6 @@ const Thumbnail = ({
197191
}
198192

199193
const showtotalChildCount = () => {
200-
201194
let displayedCount = '';
202195

203196
if (dropdownLength) {

src/components/getOrgId.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/components/getOrganizationLinks.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
/* eslint-disable no-console */
22

3-
import { getOrgId } from "./getOrgId.js";
4-
53
const getGithubInfo = (organization) => {
6-
const githubInfo = { imageUrl: null, organizationUrl: null };
4+
const info = { imageUrl: null, organizationUrl: null };
75
const { links } = organization;
8-
if (links) {
9-
const githubLink = links.find(link => link.link_type === 'GitHub')
6+
if (links && links.length) {
7+
const githubLink = links.find((link) => link.link_type === 'GitHub');
108
if (githubLink) {
11-
const id = getOrgId(githubLink.url);
12-
const imageUrl = `https://avatars1.githubusercontent.com/u/${id}?s=100&v=4`;
13-
githubInfo.imageUrl = imageUrl;
14-
githubInfo.organizationUrl = githubLink.url;
9+
const githubId = organization.github_id;
10+
11+
info.imageUrl = githubId
12+
? `https://avatars1.githubusercontent.com/u/${githubId}?s=100&v=4`
13+
: organization.image_url;
14+
info.organizationUrl = githubLink.url;
1515
}
1616
}
17-
return githubInfo;
18-
}
17+
return info;
18+
};
1919

2020
const getImageFromOrg = (organization) => {
21-
if (organization.image_url) {
21+
if (organization.image_url && !organization.image_url.includes('scontent')) {
2222
return organization.image_url;
2323
} else {
2424
return '/images/default-github-repo-image.png';
2525
}
26-
}
26+
};
2727

2828
const getLinksFromOrg = (organization) => {
2929
if (organization.links && organization.links.length) {
@@ -33,7 +33,7 @@ const getLinksFromOrg = (organization) => {
3333
console.log(`No links available for ${organization.name}`);
3434
return '/images/default-github-repo-image.png';
3535
}
36-
}
36+
};
3737

3838
export const getOrganizationLinks = (organization) => {
3939
const thumbnailInfo = getGithubInfo(organization);

src/pages/Contributors/Affiliated.js

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const useStyles = makeStyles((theme) => ({
3434
'& h4': {
3535
paddingLeft: '10px',
3636
color: theme.palette.secondary.dark,
37-
[theme.breakpoints.between('xs','sm')]: {
37+
[theme.breakpoints.between('xs', 'sm')]: {
3838
fontSize: '15px',
3939
},
4040
[theme.breakpoints.up('md')]: {
@@ -78,7 +78,7 @@ const useStyles = makeStyles((theme) => ({
7878
},
7979
},
8080
codeforallText: {
81-
fontSize:'24px',
81+
fontSize: '24px',
8282
[theme.breakpoints.up('sm')]: {
8383
fontSize: '12px',
8484
},
@@ -114,13 +114,13 @@ const useStyles = makeStyles((theme) => ({
114114
/* eslint complexity: [0, 0]*/
115115
export const Affiliated = (props) => {
116116
const {
117+
affiliatedCount,
117118
classes,
118119
inputValue,
119120
organizations,
120121
organizationData,
121122
filtersActive,
122-
affiliatedCount,
123-
totalaffiliatedCount,
123+
totalAffiliatedCount,
124124
showIndexContrib,
125125
} = props;
126126
const classesLocal = useStyles();
@@ -132,8 +132,8 @@ export const Affiliated = (props) => {
132132
Affiliated Organizations
133133
<span style={{ paddingLeft: '9px' }}>
134134
{filtersActive
135-
? `(${affiliatedCount}/${totalaffiliatedCount})`
136-
: `(${totalaffiliatedCount})`}
135+
? `(${affiliatedCount}/${totalAffiliatedCount})`
136+
: `(${totalAffiliatedCount})`}
137137
</span>
138138
</Typography>
139139
</Grid>
@@ -146,10 +146,18 @@ export const Affiliated = (props) => {
146146
})}
147147
>
148148
<Grid>
149-
<img src='/images/code_for_All.png' alt='code for all logo' className={classesLocal.codeforAllIcon}/>
149+
<img
150+
src='/images/code_for_All.png'
151+
alt='code for all logo'
152+
className={classesLocal.codeforAllIcon}
153+
/>
150154
</Grid>
151155
<Grid>
152-
<Typography variant='h4' noWrap className={classesLocal.codeforallText}>
156+
<Typography
157+
variant='h4'
158+
noWrap
159+
className={classesLocal.codeforallText}
160+
>
153161
<Link
154162
href='/organization/code-for-all'
155163
target='_blank'
@@ -159,8 +167,8 @@ export const Affiliated = (props) => {
159167
</Link>
160168
<span style={{ paddingLeft: '5px' }}>
161169
{filtersActive
162-
? `(${affiliatedCount}/${totalaffiliatedCount})`
163-
: ` (${totalaffiliatedCount})`}
170+
? `(${affiliatedCount}/${totalAffiliatedCount})`
171+
: ` (${totalAffiliatedCount})`}
164172
</span>
165173
</Typography>
166174
</Grid>
@@ -185,12 +193,15 @@ export const Affiliated = (props) => {
185193
data-cy='code-for-all-chevron'
186194
onClick={() => setDropdownOpen(!dropdownOpen)}
187195
>
188-
<DropdownArrow open={dropdownOpen} handleArrow={() => setDropdownOpen(!dropdownOpen)} />
196+
<DropdownArrow
197+
open={dropdownOpen}
198+
handleArrow={() => setDropdownOpen(!dropdownOpen)}
199+
/>
189200
</Grid>
190201
</Grid>
191202
<Grid>
192-
{dropdownOpen && (
193-
!organizations['Code for All'] ? (
203+
{dropdownOpen &&
204+
(!organizations ? (
194205
!inputValue ? (
195206
<h3 className={classes.loaders}>Loading...</h3>
196207
) : (
@@ -206,8 +217,7 @@ export const Affiliated = (props) => {
206217
filtersActive={filtersActive}
207218
/>
208219
</Grid>
209-
)
210-
)}
220+
))}
211221
</Grid>
212222
</Grid>
213223
);

src/pages/Contributors/AffiliatedOrganizations.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const useStyles = makeStyles((theme) => ({
2121
flexWrap: 'wrap',
2222
marginTop: '10px',
2323
justifyContent: 'center',
24-
[theme.breakpoints.between('xs','sm')]: {
24+
[theme.breakpoints.between('xs', 'sm')]: {
2525
marginLeft: '0',
2626
justifyContent: 'center',
2727
alignItems: 'center',
@@ -73,17 +73,14 @@ export const AffiliatedOrganizations = ({
7373
const classes = useStyles();
7474

7575
const isChildThumbnail = true;
76-
let organizationArray;
7776
let parentdata;
7877
let parentChildobj;
7978
let mapsearchedChildParent;
8079

8180
const getParentData = () => {
82-
organizationArray = organizations['Code for All'].filter((item) => item);
83-
8481
parentdata = [];
8582

86-
organizationArray.forEach((org) => {
83+
organizations.forEach((org) => {
8784
if (org.depth === 3) {
8885
org['childNodes'] = [];
8986
org['isOpen'] = false;
@@ -131,7 +128,13 @@ export const AffiliatedOrganizations = ({
131128
useEffect(() => {
132129
setCurrentThumbnails(getParentData);
133130
// eslint-disable-next-line react-hooks/exhaustive-deps
134-
}, [inputValue, organizations, organizationData, showIndexContrib,filtersActive]);
131+
}, [
132+
inputValue,
133+
organizations,
134+
organizationData,
135+
showIndexContrib,
136+
filtersActive,
137+
]);
135138

136139
let childSort;
137140
let childNode;
@@ -155,7 +158,11 @@ export const AffiliatedOrganizations = ({
155158
inputValue={inputValue}
156159
filtersActive={filtersActive}
157160
>
158-
<Grid container style={ { justifyContent:"center" } } alignItems='center'>
161+
<Grid
162+
container
163+
style={{ justifyContent: 'center' }}
164+
alignItems='center'
165+
>
159166
{childNode.length > 0 ? (
160167
<Grid
161168
item
@@ -166,7 +173,10 @@ export const AffiliatedOrganizations = ({
166173
{childNode.map((child, idx) => {
167174
return (
168175
<Grid
169-
item xs={12} sm={5} lg={5}
176+
item
177+
xs={12}
178+
sm={5}
179+
lg={5}
170180
className={classes.afflnThumbnails}
171181
key={`affiliatedThumbnail_child_${i}_${idx}`}
172182
>
@@ -224,7 +234,10 @@ export const AffiliatedOrganizations = ({
224234
inputValue !== ''
225235
) {
226236
return (
227-
<Grid className={classes.thumbnailGrid} data-cy='affiliated-organizations'>
237+
<Grid
238+
className={classes.thumbnailGrid}
239+
data-cy='affiliated-organizations'
240+
>
228241
{currentThumbnails.map((org, i) => {
229242
return (
230243
<Dropdown

src/pages/Contributors/UnaffiliatedOrganizations.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const UnaffiliatedOrganizations = (props) => {
5555
filtersActive,
5656
organization,
5757
showIndexContrib,
58-
totalunaffiliatedCount,
58+
totalUnaffiliatedCount,
5959
unaffiliatedCount,
6060
} = props;
6161
const classes = useStyles();
@@ -69,13 +69,22 @@ export const UnaffiliatedOrganizations = (props) => {
6969
<span style={{ paddingLeft: '1px' }}>
7070
{' '}
7171
{filtersActive
72-
? `(${unaffiliatedCount}/${totalunaffiliatedCount})`
73-
: `(${totalunaffiliatedCount})`}{' '}
72+
? `(${unaffiliatedCount}/${totalUnaffiliatedCount})`
73+
: `(${totalUnaffiliatedCount})`}{' '}
7474
</span>
7575
</Typography>
7676
</Grid>
7777
{showIndexContrib ? (
78-
<Grid item xs={12} sm={12} md={12} container direction="row" justify="center" alignItems="center">
78+
<Grid
79+
item
80+
xs={12}
81+
sm={12}
82+
md={12}
83+
container
84+
direction='row'
85+
justify='center'
86+
alignItems='center'
87+
>
7988
<Typography color='primary' className={classes.noargText}>
8089
{' '}
8190
No organization found{' '}
@@ -98,8 +107,7 @@ export const UnaffiliatedOrganizations = (props) => {
98107
isChildThumbnail={isChildThumbnail}
99108
></ContributorThumbnail>
100109
</Grid>
101-
))
102-
}
110+
))}
103111
</Grid>
104112
</Grid>
105113
)}

0 commit comments

Comments
 (0)