onCopy: (message: string) => void;
}
-type SharingURLsComponentProps = SharingURLsComponentDataProps & SharingURLsComponentActionProps;
+export type SharingURLsComponentProps = SharingURLsComponentDataProps & SharingURLsComponentActionProps;
export const SharingURLsComponent = withStyles(styles)((props: SharingURLsComponentProps & WithStyles<CssRules>) => <Grid container direction='column' spacing={24} className={props.classes.sharingUrlList}>
{ props.sharingTokens.length > 0
? `${props.sharingURLsPrefix.replace('*', props.collectionUuid)}/t=${token.apiToken}/_/`
: `${props.sharingURLsPrefix}/c=${props.collectionUuid}/t=${token.apiToken}/_/`;
const expDate = new Date(token.expiresAt);
- const urlLabel = `Token ${token.apiToken.slice(0, 8)}... expiring at: ${expDate.toLocaleString()} (${moment(expDate).fromNow()})`;
+ const urlLabel = !!token.expiresAt
+ ? `Token ${token.apiToken.slice(0, 8)}... expiring at: ${expDate.toLocaleString()} (${moment(expDate).fromNow()})`
+ : `Token ${token.apiToken.slice(0, 8)}... with no expiration date`;
return <Grid container alignItems='center' key={token.uuid} className={props.classes.sharingUrlRow}>
<Grid item>
<CopyIcon />
</CopyToClipboard>
</Tooltip></span>
- <span className={props.classes.sharingUrlButton}><Tooltip title='Remove'>
+ <span data-cy='remove-url-btn' className={props.classes.sharingUrlButton}><Tooltip title='Remove'>
<IconButton onClick={() => props.onDeleteSharingToken(token.uuid)}>
<RemoveIcon />
</IconButton>