loader bar stopping model

This commit is contained in:
Faisal Amir 2024-01-22 10:55:24 +07:00
parent a50ea4a634
commit 858ec68d60

View File

@ -8,7 +8,7 @@ export default function ModelStart() {
// This is fake loader please fix this when we have realtime percentage when load model
useEffect(() => {
if (stateModel.loading && stateModel.state === 'start') {
if (stateModel.loading) {
if (loader === 24) {
setTimeout(() => {
setLoader(loader + 1)
@ -29,6 +29,7 @@ export default function ModelStart() {
} else {
setLoader(0)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [stateModel.loading, loader])
if (!stateModel.loading) return null
@ -40,7 +41,11 @@ export default function ModelStart() {
className="absolute left-0 top-0 h-full bg-blue-200"
style={{ width: `${loader}%` }}
/>
<span className="relative z-10">Starting model {stateModel.model}</span>
<span className="relative z-10">
{stateModel.state === 'start' ? 'Starting' : 'Stopping'}
&nbsp;model&nbsp;
{stateModel.model}
</span>
</div>
</div>
)