11import React from 'react' ;
22import Navigation from '../../../pages/admin/Navigation' ;
3- import { Button , Divider , Flex , Form , Input , InputNumber , Typography } from 'antd' ;
3+ import { Button , Divider , Flex , Form , Input , InputNumber , Skeleton , Typography } from 'antd' ;
44import { formattedPrice } from '../../../lib/form' ;
55import { CloseCircleOutlined } from '@ant-design/icons' ;
66import { useDashboardStore } from './DashboardStore.hooks' ;
77
88const DashboardStore : React . FC = ( ) => {
9- const { form, items, onAddArticle, deleteArticle } = useDashboardStore ( ) ;
9+ const { form, items, articlesLoading , addArticleLoading , onAddArticle, deleteArticle } = useDashboardStore ( ) ;
1010 return (
1111 < Navigation >
1212 < p className = "text-xl mb-2" > Liste des articles : </ p >
@@ -18,12 +18,12 @@ const DashboardStore: React.FC = () => {
1818 < InputNumber min = { 0 } step = { 0.5 } placeholder = "Prix" />
1919 </ Form . Item >
2020 < Form . Item >
21- < Button type = "primary" htmlType = "submit" className = "button" > Ajouter</ Button >
21+ < Button type = "primary" htmlType = "submit" className = "button" loading = { addArticleLoading } > Ajouter</ Button >
2222 </ Form . Item >
2323 </ Form >
2424 < Divider />
2525 < Flex gap = { 8 } className = "mt-4" >
26- { items . length > 0 ? items . map ( ( article ) => (
26+ { articlesLoading ? < Skeleton . Image active /> : items . length > 0 ? items . map ( ( article ) => (
2727 < div key = { article . id } className = "flex bg-white rounded-md p-2 aspect-[1/1] w-28" >
2828 < Flex vertical justify = "space-between" gap = { 8 } className = "w-full" >
2929 < Flex align = "center" justify = "space-between" className = "w-full" >
0 commit comments