-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93824bb
commit b78da38
Showing
13 changed files
with
362 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 0 additions & 54 deletions
54
apps/meteor/client/views/account/tokens/AccountTokensRow.tsx
This file was deleted.
Oops, something went wrong.
159 changes: 0 additions & 159 deletions
159
apps/meteor/client/views/account/tokens/AccountTokensTable.tsx
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
apps/meteor/client/views/account/tokens/AccountTokensTable/AccountTokensRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { IPersonalAccessToken, Serialized } from '@rocket.chat/core-typings'; | ||
import { ButtonGroup, IconButton, TableRow, TableCell } from '@rocket.chat/fuselage'; | ||
import { useTranslation } from '@rocket.chat/ui-contexts'; | ||
import React, { useCallback, FC } from 'react'; | ||
|
||
import { useFormatDateAndTime } from '../../../../hooks/useFormatDateAndTime'; | ||
|
||
type AccountTokensRowProps = { | ||
isMedium: boolean; | ||
onRegenerate: (name: string) => void; | ||
onRemove: (name: string) => void; | ||
} & Serialized<Pick<IPersonalAccessToken, 'name' | 'createdAt' | 'lastTokenPart' | 'bypassTwoFactor'>>; | ||
|
||
const AccountTokensRow: FC<AccountTokensRowProps> = ({ | ||
bypassTwoFactor, | ||
createdAt, | ||
isMedium, | ||
lastTokenPart, | ||
name, | ||
onRegenerate, | ||
onRemove, | ||
}) => { | ||
const t = useTranslation(); | ||
const formatDateAndTime = useFormatDateAndTime(); | ||
const handleRegenerate = useCallback(() => onRegenerate(name), [name, onRegenerate]); | ||
const handleRemove = useCallback(() => onRemove(name), [name, onRemove]); | ||
|
||
return ( | ||
<TableRow key={name} tabIndex={0} role='link' qa-token-name={name}> | ||
<TableCell withTruncatedText color='default' fontScale='p2m'> | ||
{name} | ||
</TableCell> | ||
{isMedium && <TableCell withTruncatedText>{formatDateAndTime(createdAt)}</TableCell>} | ||
<TableCell withTruncatedText>...{lastTokenPart}</TableCell> | ||
<TableCell withTruncatedText>{bypassTwoFactor ? t('Ignore') : t('Require')}</TableCell> | ||
<TableCell withTruncatedText> | ||
<ButtonGroup> | ||
<IconButton title={t('Refresh')} icon='refresh' small secondary onClick={handleRegenerate} /> | ||
<IconButton title={t('Remove')} icon='trash' small secondary onClick={handleRemove} /> | ||
</ButtonGroup> | ||
</TableCell> | ||
</TableRow> | ||
); | ||
}; | ||
|
||
export default AccountTokensRow; |
Oops, something went wrong.