@@ -8,13 +8,12 @@ import {
8
8
ListItem ,
9
9
ModalBody ,
10
10
ModalHeader ,
11
- SkeletonText ,
12
11
UnorderedList ,
13
12
useBreakpointValue ,
14
13
VStack ,
15
14
} from "@chakra-ui/react"
16
15
17
- import type { Author , Lang } from "@/lib/types"
16
+ import type { GitHubContributor , Lang } from "@/lib/types"
18
17
19
18
import { Button } from "@/components/Buttons"
20
19
import InlineLink from "@/components/Link"
@@ -25,56 +24,36 @@ import Translation from "@/components/Translation"
25
24
import { trackCustomEvent } from "@/lib/utils/matomo"
26
25
import { getLocaleTimestamp } from "@/lib/utils/time"
27
26
28
- // TODO: skeletons are not part of the DS, so these should be replaced once we
29
- // implement the new designs. Thats the reason we haven't define these styles in
30
- // the theme config file
31
- const skeletonColorProps = {
32
- startColor : "lightBorder" ,
33
- endColor : "searchBackgroundEmpty" ,
34
- }
35
-
36
- const Skeleton = ( props ) => < SkeletonText { ...skeletonColorProps } { ...props } />
37
-
38
- const ContributorList = ( { children } : { children : React . ReactNode } ) => {
39
- return (
40
- < UnorderedList maxH = "2xs" m = { 0 } mt = { 6 } overflowY = "scroll" >
41
- { children }
42
- </ UnorderedList >
43
- )
44
- }
45
-
46
- const Contributor = ( { contributor } : { contributor : Author } ) => {
47
- return (
48
- < ListItem p = { 2 } display = "flex" alignItems = "center" >
49
- < Avatar
50
- height = "40px"
51
- width = "40px"
52
- src = { contributor . avatarUrl }
53
- name = { contributor . name }
54
- me = { 2 }
55
- />
56
- { contributor . user && (
57
- < InlineLink href = { contributor . user . url } >
58
- @{ contributor . user . login }
59
- </ InlineLink >
60
- ) }
61
- { ! contributor . user && < span > { contributor . name } </ span > }
62
- </ ListItem >
63
- )
64
- }
27
+ const ContributorList = ( { children } : { children : React . ReactNode } ) => (
28
+ < UnorderedList maxH = "2xs" m = { 0 } mt = { 6 } overflowY = "scroll" >
29
+ { children }
30
+ </ UnorderedList >
31
+ )
32
+
33
+ type ContributorProps = { contributor : GitHubContributor }
34
+ const Contributor = ( { contributor } : ContributorProps ) => (
35
+ < ListItem p = { 2 } display = "flex" alignItems = "center" >
36
+ < Avatar
37
+ height = "40px"
38
+ width = "40px"
39
+ src = { contributor . avatar_url }
40
+ name = { contributor . login }
41
+ me = { 2 }
42
+ />
43
+ < InlineLink href = { "https://github.com/" + contributor . login } >
44
+ @{ contributor . login }
45
+ </ InlineLink >
46
+ </ ListItem >
47
+ )
65
48
66
49
export type FileContributorsProps = FlexProps & {
67
50
editPath ?: string
68
- contributors : Author [ ]
69
- loading : boolean
70
- error ?: boolean
51
+ contributors : GitHubContributor [ ]
71
52
lastEdit : string
72
53
}
73
54
74
55
const FileContributors = ( {
75
56
contributors,
76
- loading,
77
- error,
78
57
lastEdit,
79
58
...props
80
59
} : FileContributorsProps ) => {
@@ -83,18 +62,14 @@ const FileContributors = ({
83
62
84
63
const isDesktop = useBreakpointValue ( { base : false , md : true } )
85
64
86
- if ( error ) return null
87
- const lastContributor : Author = contributors . length
65
+ const lastContributor : GitHubContributor = contributors . length
88
66
? contributors [ 0 ]
89
- : {
90
- name : "" ,
91
- email : "" ,
92
- avatarUrl : "" ,
93
- user : {
94
- login : "" ,
95
- url : "" ,
96
- } ,
97
- }
67
+ : ( {
68
+ avatar_url : "" ,
69
+ login : "" ,
70
+ html_url : "" ,
71
+ date : Date . now ( ) . toString ( ) ,
72
+ } as GitHubContributor )
98
73
99
74
return (
100
75
< >
@@ -107,18 +82,12 @@ const FileContributors = ({
107
82
108
83
< ModalBody >
109
84
< Translation id = "contributors-thanks" />
110
- < Skeleton noOfLines = "4" mt = "4" isLoaded = { ! loading } >
111
- { contributors ? (
112
- < ContributorList >
113
- { contributors . map ( ( contributor ) => (
114
- < Contributor
115
- contributor = { contributor }
116
- key = { contributor . email }
117
- />
118
- ) ) }
119
- </ ContributorList >
120
- ) : null }
121
- </ Skeleton >
85
+
86
+ < ContributorList >
87
+ { contributors . map ( ( contributor ) => (
88
+ < Contributor contributor = { contributor } key = { contributor . login } />
89
+ ) ) }
90
+ </ ContributorList >
122
91
</ ModalBody >
123
92
</ Modal >
124
93
@@ -136,20 +105,19 @@ const FileContributors = ({
136
105
< Avatar
137
106
height = "40px"
138
107
width = "40px"
139
- src = { lastContributor . avatarUrl }
140
- name = { lastContributor . name }
108
+ src = { lastContributor . avatar_url }
109
+ name = { lastContributor . login }
141
110
me = { 2 }
142
111
/>
143
112
144
113
< Text m = { 0 } color = "text200" >
145
114
< Translation id = "last-edit" /> :{ " " }
146
- { lastContributor . user ?. url && (
147
- < InlineLink href = { lastContributor . user . url } >
148
- @{ lastContributor . user . login }
149
- </ InlineLink >
150
- ) }
151
- { ! lastContributor . user && < span > { lastContributor . name } </ span > } ,{ " " }
152
- { getLocaleTimestamp ( locale as Lang , lastEdit ) }
115
+ < InlineLink
116
+ href = { "https://github.com/" + lastContributor . login }
117
+ >
118
+ @{ lastContributor . login }
119
+ </ InlineLink >
120
+ , { getLocaleTimestamp ( locale as Lang , lastEdit ) }
153
121
</ Text >
154
122
</ >
155
123
) }
0 commit comments