Skip to content

Commit cddd4d0

Browse files
committed
perf: bump
1 parent 762a8e4 commit cddd4d0

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

example/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function App() {
99
phoneNumber='123456789'
1010
accountName='awran5'
1111
allowClickAway
12-
// avatar={avatar}
12+
avatar={avatar}
1313
notification
1414
notificationSound
1515
notificationDelay={60000}

src/Components/FloatingWhatsapp.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useReducer, useEffect, useCallback, useRef } from 'react'
1+
import React, { useReducer, useEffect, useCallback, useRef, useMemo } from 'react'
22
import { WhatsappSVG, CloseSVG, CheckSVG, SendSVG } from './Icons'
33
import 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-
3228
type 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+
8078
export 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

Comments
 (0)