@@ -11,7 +11,7 @@ import { ItemFieldContextMenu } from "../components/ItemsList";
11
11
import Tooltip from "../components/Tooltip" ;
12
12
import { ReactComponent as ExclamationIcon } from "../images/exclamation.svg" ;
13
13
import { ReactComponent as WarningIcon } from "../images/exclamation2.svg" ;
14
- import { AllPermissions } from "./PersonalAccessTokens" ;
14
+ import { AllPermissions , isNeverExpired } from "./PersonalAccessTokens" ;
15
15
import { useMemo } from "react" ;
16
16
17
17
interface TokenEntryProps {
@@ -21,7 +21,8 @@ interface TokenEntryProps {
21
21
22
22
function TokenEntry ( props : TokenEntryProps ) {
23
23
const expiredInfo = useMemo ( ( ) => {
24
- if ( ! props . token . expirationTime ) {
24
+ const expiration = props . token . expirationTime ! . toDate ( ) ;
25
+ if ( isNeverExpired ( expiration ) ) {
25
26
return {
26
27
expired : false ,
27
28
content : "Never expires!" ,
@@ -31,7 +32,7 @@ function TokenEntry(props: TokenEntryProps) {
31
32
} ,
32
33
} ;
33
34
}
34
- const expirationTime = dayjs ( props . token . expirationTime . toDate ( ) ) ;
35
+ const expirationTime = dayjs ( expiration ) ;
35
36
const expired = expirationTime . isBefore ( dayjs ( ) ) ;
36
37
return {
37
38
expired,
@@ -67,10 +68,10 @@ function TokenEntry(props: TokenEntryProps) {
67
68
</ div >
68
69
< div className = "flex items-center w-3/12 text-gray-400" >
69
70
< span className = { "flex items-center gap-1 truncate" + ( expiredInfo . expired ? " text-orange-600" : "" ) } >
70
- < span > { expiredInfo . content } </ span >
71
71
{ expiredInfo . tooltip && (
72
72
< Tooltip content = { expiredInfo . tooltip . content } > { expiredInfo . tooltip . icon } </ Tooltip >
73
73
) }
74
+ < span > { expiredInfo . content } </ span >
74
75
</ span >
75
76
</ div >
76
77
< div className = "flex items-center justify-end w-1/12" >
0 commit comments