Skip to content

Commit

Permalink
perf: bump
Browse files Browse the repository at this point in the history
  • Loading branch information
awran5 committed Sep 25, 2021
1 parent 762a8e4 commit cddd4d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function App() {
phoneNumber='123456789'
accountName='awran5'
allowClickAway
// avatar={avatar}
avatar={avatar}
notification
notificationSound
notificationDelay={60000}
Expand Down
9 changes: 4 additions & 5 deletions src/Components/FloatingWhatsapp.tsx
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -105,6 +103,7 @@ export default function FloatingWhatsApp({

const soundRef = useRef<HTMLAudioElement | null>(null)
const notificationInterval = useRef(0)
const time = useMemo(() => new Date().toTimeString().split(`:`).slice(0, 2).join(`:`), [])

const handleOpen = (event: React.MouseEvent<HTMLDivElement>) => {
event.stopPropagation()
Expand Down

0 comments on commit cddd4d0

Please sign in to comment.