File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { useEffect , useState } from 'react'
12import {
23 RiBug2Line ,
34 RiInformationLine ,
@@ -96,6 +97,27 @@ export const UpdateReleaseNotesModal = ({
9697 isOpen,
9798 onClose,
9899} : UpdateReleaseNotesModalProps ) => {
100+ const [ isButtonEnabled , setIsButtonEnabled ] = useState ( false )
101+ const [ countdown , setCountdown ] = useState ( 10 )
102+
103+ useEffect ( ( ) => {
104+ if ( isOpen ) {
105+ setIsButtonEnabled ( false )
106+
107+ const timer = setInterval ( ( ) => {
108+ setCountdown ( ( prev ) => {
109+ if ( prev <= 1 ) {
110+ setIsButtonEnabled ( true )
111+ clearInterval ( timer )
112+ return 0
113+ }
114+ return prev - 1
115+ } )
116+ } , 1000 )
117+
118+ return ( ) => clearInterval ( timer )
119+ }
120+ } , [ isOpen ] )
99121 const getTypeIcon = ( type : 'feature' | 'bugfix' | 'improvement' | 'info' ) => {
100122 switch ( type ) {
101123 case 'feature' :
@@ -269,7 +291,7 @@ export const UpdateReleaseNotesModal = ({
269291
270292 < div className = "flex items-center justify-between p-4 border-t border-content" >
271293 < a
272- href = "https://github.com/ widgetify-app "
294+ href = "https://feedback. widgetify.ir "
273295 target = "_blank"
274296 rel = "noreferrer"
275297 className = "text-xs underline transition-colors duration-300 text-muted hover:text-blue-500"
@@ -278,11 +300,12 @@ export const UpdateReleaseNotesModal = ({
278300 </ a >
279301 < Button
280302 onClick = { onClose }
303+ disabled = { ! isButtonEnabled }
281304 className = "transition-all duration-300 transform hover:scale-[1.03] active:scale-[0.98] px-5 py-2 rounded-md"
282305 size = "md"
283306 isPrimary = { true }
284307 >
285- شروع استفاده
308+ { isButtonEnabled ? ' شروع استفاده' : `شروع استفاده ( ${ countdown } )` }
286309 </ Button >
287310 </ div >
288311 </ Modal >
You can’t perform that action at this time.
0 commit comments