File tree Expand file tree Collapse file tree 2 files changed +7
-23
lines changed
client/modules/User/components Expand file tree Collapse file tree 2 files changed +7
-23
lines changed Original file line number Diff line number Diff line change 1- import PropTypes from 'prop-types' ;
21import React , { useState } from 'react' ;
32import { useTranslation } from 'react-i18next' ;
43import { useDispatch , useSelector } from 'react-redux' ;
54import { Button , ButtonTypes } from '../../../common/Button' ;
65import { PlusIcon } from '../../../common/icons' ;
76import CopyableInput from '../../IDE/components/CopyableInput' ;
87import { createApiKey , removeApiKey } from '../actions' ;
9-
10- import APIKeyList from './APIKeyList' ;
8+ import { APIKeyList } from './APIKeyList' ;
119import { RootState } from '../../../reducers' ;
1210import { SanitisedApiKey } from '../../../../common/types' ;
1311
14- export const APIKeyPropType = PropTypes . shape ( {
15- id : PropTypes . string . isRequired ,
16- token : PropTypes . string ,
17- label : PropTypes . string . isRequired ,
18- createdAt : PropTypes . string . isRequired ,
19- lastUsedAt : PropTypes . string
20- } ) ;
21-
2212export const APIKeyForm = ( ) => {
2313 const { t } = useTranslation ( ) ;
2414 const apiKeys = useSelector ( ( state : RootState ) => state . user . apiKeys ) ?? [ ] ;
Original file line number Diff line number Diff line change 1- import PropTypes from 'prop-types' ;
21import React from 'react' ;
32import { orderBy } from 'lodash' ;
43import { useTranslation } from 'react-i18next' ;
5-
6- import { APIKeyPropType } from './APIKeyForm' ;
7-
4+ import type { SanitisedApiKey } from '../../../../common/types' ;
85import {
96 distanceInWordsToNow ,
107 formatDateToString
118} from '../../../utils/formatDate' ;
129import TrashCanIcon from '../../../images/trash-can.svg' ;
1310
14- function APIKeyList ( { apiKeys, onRemove } ) {
11+ export interface APIKeyListProps {
12+ apiKeys : SanitisedApiKey [ ] ;
13+ onRemove : ( key : SanitisedApiKey ) => void ;
14+ }
15+ export function APIKeyList ( { apiKeys, onRemove } : APIKeyListProps ) {
1516 const { t } = useTranslation ( ) ;
1617 return (
1718 < table className = "api-key-list" >
@@ -50,10 +51,3 @@ function APIKeyList({ apiKeys, onRemove }) {
5051 </ table >
5152 ) ;
5253}
53-
54- APIKeyList . propTypes = {
55- apiKeys : PropTypes . arrayOf ( PropTypes . shape ( APIKeyPropType ) ) . isRequired ,
56- onRemove : PropTypes . func . isRequired
57- } ;
58-
59- export default APIKeyList ;
You can’t perform that action at this time.
0 commit comments