1- import React , { useReducer , useEffect , useCallback , useRef } from 'react'
1+ import React , { useReducer , useEffect , useCallback , useRef , useMemo } from 'react'
22import { WhatsappSVG , CloseSVG , CheckSVG , SendSVG } from './Icons'
33import css from '../styles.module.css'
44
@@ -25,10 +25,6 @@ interface FloatingWhatsAppProps {
2525 notificationSound ?: boolean
2626}
2727
28- const time = new Date ( ) . toTimeString ( ) . split ( `:` ) . slice ( 0 , 2 ) . join ( `:` )
29- // Just to change the ugly arabic font
30- const isArabic = ( string : string ) => / [ \u0591 - \u07FF \uFB1D - \uFDFD \uFE70 - \uFEFC ] / . test ( string )
31-
3228type State = {
3329 isOpen : boolean
3430 isDelay : boolean
@@ -77,6 +73,8 @@ function reducer(state: State, action: Action): State {
7773 }
7874}
7975
76+ const isArabic = ( string : string ) => / [ \u0591 - \u07FF \uFB1D - \uFDFD \uFE70 - \uFEFC ] / . test ( string )
77+
8078export default function FloatingWhatsApp ( {
8179 phoneNumber = '1234567890' ,
8280 accountName = 'Account Name' ,
@@ -105,6 +103,7 @@ export default function FloatingWhatsApp({
105103
106104 const soundRef = useRef < HTMLAudioElement | null > ( null )
107105 const notificationInterval = useRef ( 0 )
106+ const time = useMemo ( ( ) => new Date ( ) . toTimeString ( ) . split ( `:` ) . slice ( 0 , 2 ) . join ( `:` ) , [ ] )
108107
109108 const handleOpen = ( event : React . MouseEvent < HTMLDivElement > ) => {
110109 event . stopPropagation ( )
0 commit comments