Skip to content

Commit 28080b7

Browse files
nersohHoussein Djirdeh
authored andcommitted
feat(repository): add topics to repositories (#638)
* feat(repository): add topics to repository screen * refactor(api): move new accept type to a const variable * feat(locales): add topics title translations * style(repository-topics): change items color * style(repository-topics): migrate to styled component * style(repository-topics): fix style properties * style(repo-topics): add gradient to topics list * fix(repo-topics): add missing locale keys * style(repo-topics): add padding to topics list
1 parent 15d4dd4 commit 28080b7

33 files changed

+220
-44
lines changed

src/api/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ export const CLIENT_ID = '87c7f05700c052937cfb';
55
export const CLIENT_SECRET = '3a70aee4d5e26c457720a31c3efe2f9062a4997a';
66

77
const ACCEPT = {
8-
JSON: 'application/vnd.github.v3+json',
9-
HTML: 'application/vnd.github.v3.html+json',
108
DIFF: 'application/vnd.github.v3.diff+json',
11-
RAW: 'application/vnd.github.v3.raw+json',
129
FULL: 'application/vnd.github.v3.full+json',
10+
HTML: 'application/vnd.github.v3.html+json',
11+
JSON: 'application/vnd.github.v3+json',
12+
MERCY_PREVIEW: 'application/vnd.github.mercy-preview+json',
13+
RAW: 'application/vnd.github.v3.raw+json',
1314
};
1415

1516
const METHOD = {
@@ -380,6 +381,15 @@ export const fetchNotificationsCount = accessToken =>
380381
export const fetchRepoNotificationsCount = (owner, repoName, accessToken) =>
381382
v3.count(`/repos/${owner}/${repoName}/notifications?per_page=1`, accessToken);
382383

384+
export const fetchRepoTopics = async (owner, repoName, accessToken) => {
385+
const response = await v3.call(
386+
`/repos/${owner}/${repoName}/topics`,
387+
v3.parameters(accessToken, METHOD.GET, ACCEPT.MERCY_PREVIEW)
388+
);
389+
390+
return response.json();
391+
};
392+
383393
export const fetchIssueEvents = (
384394
owner: string,
385395
repoName: string,

src/auth/screens/auth-profile.screen.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ class AuthProfile extends Component {
133133
menuAction={() =>
134134
navigation.navigate('UserOptions', {
135135
title: translate('auth.userOptions.title', locale),
136-
})
137-
}
136+
})}
138137
>
139138
{isPending && (
140139
<ActivityIndicator
@@ -184,8 +183,7 @@ class AuthProfile extends Component {
184183
{'\n'}
185184
<NoteLink
186185
onPress={() =>
187-
openURLInView('https://github.com/settings/applications')
188-
}
186+
openURLInView('https://github.com/settings/applications')}
189187
>
190188
{translate(
191189
'auth.profile.orgsRequestApprovalBottom',

src/auth/screens/privacy-policy.screen.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ export class PrivacyPolicyScreen extends Component {
123123
onPress={() =>
124124
navigation.navigate('Repository', {
125125
repositoryUrl: `${v3.root}/repos/gitpoint/git-point`,
126-
})
127-
}
126+
})}
128127
>
129128
{translate('auth.privacyPolicy.contactLink', locale)}
130129
</Link>

src/auth/screens/user-options.screen.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ class UserOptions extends Component {
142142
navigation.navigate('LanguageSettings', {
143143
title: translate('auth.userOptions.language', locale),
144144
locale,
145-
})
146-
}
145+
})}
147146
/>
148147
<StyledListItem
149148
title={translate('common.openInBrowser', locale)}
@@ -156,14 +155,12 @@ class UserOptions extends Component {
156155
navigation.navigate('PrivacyPolicy', {
157156
title: translate('auth.privacyPolicy.title', locale),
158157
locale,
159-
})
160-
}
158+
})}
161159
/>
162160
<StyledListItem
163161
title={translate('auth.userOptions.donate', locale)}
164162
onPress={() =>
165-
openURLInView('https://opencollective.com/git-point')
166-
}
163+
openURLInView('https://opencollective.com/git-point')}
167164
/>
168165
<StyledListItem
169166
title={translate('auth.userOptions.signOut', locale)}

src/components/comment-input.component.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,9 @@ export class CommentInput extends Component {
107107
blurOnSubmit={false}
108108
onChangeText={text => this.setState({ text })}
109109
onContentSizeChange={event =>
110-
this.setState({ height: event.nativeEvent.contentSize.height })
111-
}
110+
this.setState({ height: event.nativeEvent.contentSize.height })}
112111
onSubmitEditing={event =>
113-
this.handleSubmitEditing(event.nativeEvent.text)
114-
}
112+
this.handleSubmitEditing(event.nativeEvent.text)}
115113
placeholderTextColor={colors.grey}
116114
style={{
117115
height: Math.max(inputMinHeight, this.state.height),

src/components/entity-info.component.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ export const EntityInfo = ({ entity, orgs, locale, navigation }: Props) => {
111111
}}
112112
subtitle={entity.email}
113113
onPress={() =>
114-
Communications.email([entity.email], null, null, null, null)
115-
}
114+
Communications.email([entity.email], null, null, null, null)}
116115
/>
117116
)}
118117

src/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ export * from './image-zoom.component';
3030
export * from './button.component';
3131
export * from './notification-icon.component';
3232
export * from './badge.component';
33+
export * from './topics-list.component';
3334
export * from './toggle-view.component';

src/components/issue-description.component.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ export class IssueDescription extends Component {
189189
title: translate('repository.pullDiff.title', locale),
190190
locale,
191191
diff,
192-
})
193-
}
192+
})}
194193
/>
195194
)}
196195
</DiffBlocksContainer>
@@ -227,8 +226,7 @@ export class IssueDescription extends Component {
227226
onPress={() =>
228227
navigation.navigate('PullMerge', {
229228
title: translate('issue.pullMerge.title', locale),
230-
})
231-
}
229+
})}
232230
title={translate('issue.main.mergeButton', locale)}
233231
/>
234232
</MergeButtonContainer>

src/components/issue-event-list-item.component.js

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ export class IssueEventListItem extends Component {
145145
iconBackgroundColor={colors.darkerRed}
146146
text={
147147
<Text>
148-
<ActorLink actor={event.actor} onPress={this.onPressUser} />{' '}
148+
<ActorLink
149+
actor={event.actor}
150+
onPress={this.onPressUser}
151+
/>{' '}
149152
closed this
150153
</Text>
151154
}
@@ -160,7 +163,10 @@ export class IssueEventListItem extends Component {
160163
iconColor={colors.white}
161164
text={
162165
<Text>
163-
<ActorLink actor={event.actor} onPress={this.onPressUser} />{' '}
166+
<ActorLink
167+
actor={event.actor}
168+
onPress={this.onPressUser}
169+
/>{' '}
164170
reopened this
165171
</Text>
166172
}
@@ -175,7 +181,10 @@ export class IssueEventListItem extends Component {
175181
iconBackgroundColor={colors.purple}
176182
text={
177183
<Text>
178-
<ActorLink actor={event.actor} onPress={this.onPressUser} />{' '}
184+
<ActorLink
185+
actor={event.actor}
186+
onPress={this.onPressUser}
187+
/>{' '}
179188
merged <Bold>{event.commit_id.slice(0, 7)}</Bold>
180189
</Text>
181190
}
@@ -189,7 +198,10 @@ export class IssueEventListItem extends Component {
189198
iconName="pencil"
190199
text={
191200
<Text>
192-
<ActorLink actor={event.actor} onPress={this.onPressUser} />{' '}
201+
<ActorLink
202+
actor={event.actor}
203+
onPress={this.onPressUser}
204+
/>{' '}
193205
changed the title from <Bold>{event.rename.from.trim()}</Bold>{' '}
194206
to <Bold>{event.rename.to.trim()}</Bold>
195207
</Text>
@@ -204,7 +216,10 @@ export class IssueEventListItem extends Component {
204216
iconName="person"
205217
text={
206218
<Text>
207-
<ActorLink actor={event.assigner} onPress={this.onPressUser} />{' '}
219+
<ActorLink
220+
actor={event.assigner}
221+
onPress={this.onPressUser}
222+
/>{' '}
208223
{event.event}{' '}
209224
<ActorLink actor={event.assignee} onPress={this.onPressUser} />
210225
</Text>
@@ -226,7 +241,10 @@ export class IssueEventListItem extends Component {
226241
iconName="milestone"
227242
text={
228243
<Text>
229-
<ActorLink actor={event.actor} onPress={this.onPressUser} />{' '}
244+
<ActorLink
245+
actor={event.actor}
246+
onPress={this.onPressUser}
247+
/>{' '}
230248
{milestoneAction} the <Bold>{event.milestone.title}</Bold>{' '}
231249
milestone
232250
</Text>
@@ -244,7 +262,10 @@ export class IssueEventListItem extends Component {
244262
iconBackgroundColor="black"
245263
text={
246264
<Text>
247-
<ActorLink actor={event.actor} onPress={this.onPressUser} />{' '}
265+
<ActorLink
266+
actor={event.actor}
267+
onPress={this.onPressUser}
268+
/>{' '}
248269
{event.event} this conversation
249270
</Text>
250271
}
@@ -263,7 +284,10 @@ export class IssueEventListItem extends Component {
263284
iconBackgroundColor={isRestored ? undefined : colors.greyBlue}
264285
text={
265286
<Text>
266-
<ActorLink actor={event.actor} onPress={this.onPressUser} />{' '}
287+
<ActorLink
288+
actor={event.actor}
289+
onPress={this.onPressUser}
290+
/>{' '}
267291
{headRefAction} this branch
268292
</Text>
269293
}
@@ -280,7 +304,10 @@ export class IssueEventListItem extends Component {
280304
iconBackgroundColor={colors.greyBlue}
281305
text={
282306
<Text>
283-
<ActorLink actor={event.actor} onPress={this.onPressUser} />{' '}
307+
<ActorLink
308+
actor={event.actor}
309+
onPress={this.onPressUser}
310+
/>{' '}
284311
marked this as{' '}
285312
{event.event === 'unmarked_as_duplicate' ? 'not ' : ''}a
286313
duplicate

src/components/repository-profile.component.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ export const RepositoryProfile = ({
179179
onPress={() =>
180180
navigation.navigate('Repository', {
181181
repository: repository.parent,
182-
})
183-
}
182+
})}
184183
>
185184
{' '}
186185
{repository.parent.full_name}

0 commit comments

Comments
 (0)