UNPKG

@dynamic-labs/sdk-react-core

Version:

A React SDK for implementing wallet web3 authentication and authorization to your website.

31 lines (26 loc) 2.1 kB
'use client' 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var jsxRuntime = require('react/jsx-runtime'); var DotsMenu = require('../../../components/DotsMenu/DotsMenu.cjs'); var getTimeSince = require('../../../helpers/getTimeSince.cjs'); require('react'); var authenticator = require('../../../../../shared/assets/authenticator.cjs'); require('@dynamic-labs/iconic'); require('../../../../../context/ViewContext/ViewContext.cjs'); var Typography = require('../../../../../components/Typography/Typography.cjs'); const UserDeviceTile = ({ userDevice, deleteDevice, isMfaRequired, }) => { const optionsMenu = [ { Icon: null, callback: () => deleteDevice(userDevice.id), text: 'Delete', }, ]; const timeSinceCreated = userDevice.verifiedAt && getTimeSince.getTimeSince(new Date(userDevice.verifiedAt)); return (jsxRuntime.jsxs("div", { className: 'manage-mfa-widget-view__list-tile', children: [jsxRuntime.jsx(authenticator.ReactComponent, { className: 'manage-mfa-widget-view__list-tile__icon' }), jsxRuntime.jsxs("div", { className: 'manage-mfa-widget-view__list-tile__details', children: [jsxRuntime.jsx("div", { className: 'manage-mfa-widget-view__list-tile__details__title', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: userDevice.alias || 'Authenticator App' }) }), timeSinceCreated && (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'secondary', children: ["Created ", timeSinceCreated.value, " ", timeSinceCreated.unit, " ago"] }))] }), isMfaRequired || (jsxRuntime.jsx("div", { style: { cursor: 'pointer', display: 'flex', }, children: jsxRuntime.jsx(DotsMenu.DotsMenu, { direction: 'left', "data-testid": 'dots-menu', options: optionsMenu, buttonClassName: 'manage-mfa-widget-view__list-tile__dots-menu', buttonClassNameWithOpenMenu: 'manage-mfa-widget-view__list-tile__dots-menu' }) }))] }, userDevice.id)); }; exports.UserDeviceTile = UserDeviceTile;