import PropTypes from 'prop-types' import React, { useState } from 'react' import styled from 'styled-components' import { PColor, SECColor } from '../../../assets/colors' import { IconLogout, IconNotification, IconShopping, IconUser } from '../../../assets/icons' import { Button, Column, Overline, Row, Text } from '../../atoms' import { ButtonOption, FloatingBoxTwo } from './styled' export const Options = ({ userConsent, pushNotificationSupported, onClickSusbribeToPushNotification, userSubscription, countOrders, pushServerSubscriptionId, onClickSendNotification, onClickSendSubscriptionToPushServer, location = { push: () => { return } }, onClickAskUserPermission = () => { return }, setIsOpenOrder = (state) => { return state }, onClickLogout = () => { return } }) => { const [show, setShow] = useState(false) const handleClick = (index) => { setShow(index === show ? false : index) } const handleSignOut = async () => { return await onClickLogout() } const isConsentGranted = userConsent === 'granted' return ( { return setShow(!true) }} show={show} /> { return setIsOpenOrder(true) }} > {countOrders} { return await handleSignOut() }} > { return handleClick(2) }} > {pushNotificationSupported && !isConsentGranted && ( Habilita las notificaciones )} {isConsentGranted && ( Las notificaciones están activas )} {!pushNotificationSupported && ( Las notificaciones {!pushNotificationSupported && 'No'} son compatibles con este dispositivo. )} {' '} Consentimiento del usuario para recibir notificaciones{' '} {userConsent}. {pushServerSubscriptionId && (

The server accepted the push subscrption!

)} {/*

Your notification subscription details

                {JSON.stringify(userSubscription, null, ' ')}
              
*/}
) } Options.propTypes = { error: PropTypes.shape({ code: PropTypes.any, message: PropTypes.any, name: PropTypes.any }), loading: PropTypes.bool, location: PropTypes.shape({ push: PropTypes.func }), onClickAskUserPermission: PropTypes.func, setIsOpenOrder: PropTypes.func, onClickLogout: PropTypes.func, onClickSendNotification: PropTypes.any, onClickSendSubscriptionToPushServer: PropTypes.any, onClickSusbribeToPushNotification: PropTypes.any, pushNotificationSupported: PropTypes.any, pushServerSubscriptionId: PropTypes.any, userConsent: PropTypes.string, countOrders: PropTypes.number, userSubscription: PropTypes.any } const ContainerOption = styled.div` position: relative; width: ${({ width = 'max-content' }) => { return width ?? 'max-content' }}; ` const Option = styled.div` padding: 15px 0px; cursor: pointer; border-radius: 10px; display: flex; justify-content: space-between; &:hover { background-color: #ffffff1a; } `