File tree Expand file tree Collapse file tree 4 files changed +24
-15
lines changed
Expand file tree Collapse file tree 4 files changed +24
-15
lines changed Original file line number Diff line number Diff line change @@ -90,12 +90,10 @@ const dashboardRoutes: Route[] = [
9090 visible : true ,
9191 } ,
9292 {
93- path : '/admin/ user/:id' ,
93+ path : '/user/:id' ,
9494 name : 'User' ,
9595 icon : Person ,
96- component : ( props ) => (
97- < RouteGuard component = { User } fullRoutePath = { `/dashboard/admin/user/:id` } />
98- ) ,
96+ component : ( props ) => < RouteGuard component = { User } fullRoutePath = { `/dashboard/user/:id` } /> ,
9997 layout : '/dashboard' ,
10098 visible : false ,
10199 } ,
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { Link } from 'react-router-dom' ;
3+
4+ interface UserLinkProps {
5+ username : string ;
6+ children ?: React . ReactNode ;
7+ }
8+
9+ const UserLink : React . FC < UserLinkProps > = ( { username, children } ) => {
10+ return < Link to = { `/dashboard/user/${ username } ` } > { children || username } </ Link > ;
11+ } ;
12+
13+ export default UserLink ;
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import Tooltip from '@material-ui/core/Tooltip';
2525import { PushData } from '../../../types/models' ;
2626import { trimPrefixRefsHeads , trimTrailingDotGit } from '../../../db/helper' ;
2727import { generateEmailLink , getGitProvider } from '../../utils' ;
28+ import UserLink from '../../components/UserLink/UserLink' ;
2829
2930const Dashboard : React . FC = ( ) => {
3031 const { id } = useParams < { id : string } > ( ) ;
@@ -198,25 +199,21 @@ const Dashboard: React.FC = () => {
198199 ) : (
199200 < >
200201 { isGitHub && (
201- < a href = { `/dashboard/user/ ${ data . attestation . reviewer . username } ` } >
202+ < UserLink username = { data . attestation . reviewer . username } >
202203 < img
203204 style = { { width : '45px' , borderRadius : '20px' } }
204205 src = { `https://github.com/${ data . attestation . reviewer . gitAccount } .png` }
205206 />
206- </ a >
207+ </ UserLink >
207208 ) }
208209 < div >
209210 < p >
210211 { isGitHub && (
211- < a href = { `/dashboard/user/ ${ data . attestation . reviewer . username } ` } >
212+ < UserLink username = { data . attestation . reviewer . username } >
212213 { data . attestation . reviewer . gitAccount }
213- </ a >
214+ </ UserLink >
214215 ) }
215- { ! isGitHub && (
216- < a href = { `/dashboard/user/${ data . attestation . reviewer . username } ` } >
217- { data . attestation . reviewer . username }
218- </ a >
219- ) } { ' ' }
216+ { ! isGitHub && < UserLink username = { data . attestation . reviewer . username } /> } { ' ' }
220217 approved this contribution
221218 </ p >
222219 </ div >
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import CodeActionButton from '../../components/CustomButtons/CodeActionButton';
2323import { trimTrailingDotGit } from '../../../db/helper' ;
2424import { fetchRemoteRepositoryData } from '../../utils' ;
2525import { SCMRepositoryMetadata } from '../../../types/models' ;
26+ import UserLink from '../../components/UserLink/UserLink' ;
2627
2728interface RepoData {
2829 _id : string ;
@@ -200,7 +201,7 @@ const RepoDetails: React.FC = () => {
200201 { data . users . canAuthorise . map ( ( row ) => (
201202 < TableRow key = { row } >
202203 < TableCell align = 'left' >
203- < a href = { `/dashboard/user/ ${ row } ` } > { row } </ a >
204+ < UserLink username = { row } / >
204205 </ TableCell >
205206 { user . admin && (
206207 < TableCell align = 'right' component = 'th' scope = 'row' >
@@ -243,7 +244,7 @@ const RepoDetails: React.FC = () => {
243244 { data . users . canPush . map ( ( row ) => (
244245 < TableRow key = { row } >
245246 < TableCell align = 'left' >
246- < a href = { `/dashboard/user/ ${ row } ` } > { row } </ a >
247+ < UserLink username = { row } / >
247248 </ TableCell >
248249 { user . admin && (
249250 < TableCell align = 'right' component = 'th' scope = 'row' >
You can’t perform that action at this time.
0 commit comments