admin/home: better animation for errors and warnings
Massimo Melina committed
Sep 7, 2024 at 14:06 UTC
103749bb8aa7b2b33b54fd59fabbf09b254ad5b7
2 files changed
+3
-3
admin/src/HomePage.ts
+1
-1
@@ -180,7 +180,7 @@ function entry(color: Color, ...content: ReactNode[]) {
180
h(({ success: CheckCircle, info: Info, '': Info, warning: Warning, error: Error })[color], {
181
sx: { mr: 1, color: color ? undefined : 'primary.main' }
182
}),
183
- h('span', { style: ['warning', 'error'].includes(color) ? { animation: '1s blink' } : undefined },
183
+ h('span', { style: ['warning', 'error'].includes(color) ? { animation: '.5s blink 2' } : undefined },
184
...content)
185
)
186
}
shared/api.ts
+2
-2
@@ -114,9 +114,9 @@ export function useApi<T=any>(cmd: string | Falsy, params?: object, options: Api
114
reloadingRef.current = pendingPromise()
115
}, [setForcer])
116
const ee = useMemo(() => new BetterEventEmitter, [])
117
- const sub = useCallback((cb: Callback) => ee.on('data', cb), [])
117
+ const sub = useCallback((cb: Callback) => ee.on('data', cb), [ee])
118
useEffect(() => { ee.emit('data') }, [data])
119
- return { data, setData, error, reload, sub, loading: loadingRef.current || reloadingRef.current, getData: () => dataRef.current, }
119
+ return { data, setData, error, reload, sub, loading: loadingRef.current || reloadingRef.current, getData: () => dataRef.current }
120
}
121
122
type EventHandler = (type:string, data?:any) => void