From cddd4d0a73efee05e9e4b11a9cb1d68de7c3f249 Mon Sep 17 00:00:00 2001 From: awran5 Date: Sat, 25 Sep 2021 13:07:22 +0200 Subject: [PATCH] perf: bump --- example/src/App.tsx | 2 +- src/Components/FloatingWhatsapp.tsx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/example/src/App.tsx b/example/src/App.tsx index b9fb875..0e0b8fe 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -9,7 +9,7 @@ function App() { phoneNumber='123456789' accountName='awran5' allowClickAway - // avatar={avatar} + avatar={avatar} notification notificationSound notificationDelay={60000} diff --git a/src/Components/FloatingWhatsapp.tsx b/src/Components/FloatingWhatsapp.tsx index 816bcfe..b5318c6 100644 --- a/src/Components/FloatingWhatsapp.tsx +++ b/src/Components/FloatingWhatsapp.tsx @@ -1,4 +1,4 @@ -import React, { useReducer, useEffect, useCallback, useRef } from 'react' +import React, { useReducer, useEffect, useCallback, useRef, useMemo } from 'react' import { WhatsappSVG, CloseSVG, CheckSVG, SendSVG } from './Icons' import css from '../styles.module.css' @@ -25,10 +25,6 @@ interface FloatingWhatsAppProps { notificationSound?: boolean } -const time = new Date().toTimeString().split(`:`).slice(0, 2).join(`:`) -// Just to change the ugly arabic font -const isArabic = (string: string) => /[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/.test(string) - type State = { isOpen: boolean isDelay: boolean @@ -77,6 +73,8 @@ function reducer(state: State, action: Action): State { } } +const isArabic = (string: string) => /[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/.test(string) + export default function FloatingWhatsApp({ phoneNumber = '1234567890', accountName = 'Account Name', @@ -105,6 +103,7 @@ export default function FloatingWhatsApp({ const soundRef = useRef(null) const notificationInterval = useRef(0) + const time = useMemo(() => new Date().toTimeString().split(`:`).slice(0, 2).join(`:`), []) const handleOpen = (event: React.MouseEvent) => { event.stopPropagation()