@@ -10,6 +10,7 @@ import {
1010 Trash ,
1111 Download ,
1212 DownloadIcon ,
13+ LoaderPinwheel ,
1314} from "lucide-react" ;
1415import { Alert , AlertTitle , AlertDescription } from "@/components/ui/alert" ;
1516import OscarColors from "@/styles" ;
@@ -44,9 +45,11 @@ export type BucketItem =
4445
4546export default function BucketContent ( ) {
4647 const { name : bucketName , path } = useSelectedBucket ( ) ;
48+ const [ isLoading , setIsLoading ] = useState ( true ) ;
4749
4850 const {
4951 getBucketItems,
52+ refreshBucketItems,
5053 downloadAndZipFolders,
5154 buckets,
5255 uploadFiles,
@@ -64,6 +67,7 @@ export default function BucketContent() {
6467
6568 useEffect ( ( ) => {
6669 if ( bucketName ) {
70+ setIsLoading ( true ) ;
6771 getBucketItems ( bucketName , path ) . then ( ( { items, folders } ) => {
6872 const combinedItems = [
6973 ...( folders ?. map ( ( folder ) => {
@@ -87,10 +91,11 @@ export default function BucketContent() {
8791 return res ;
8892 } ) || [ ] ) ,
8993 ] ;
94+ setIsLoading ( false ) ;
9095 setItems ( combinedItems ) ;
9196 } ) ;
9297 }
93- } , [ bucketName , getBucketItems , buckets , path ] ) ;
98+ } , [ bucketName , getBucketItems , buckets , path , refreshBucketItems ] ) ;
9499
95100 const handleDrop = ( event : React . DragEvent < HTMLDivElement > ) => {
96101 event . preventDefault ( ) ;
@@ -232,6 +237,11 @@ export default function BucketContent() {
232237 } }
233238 itemNames = { itemsToDelete . map ( ( item ) => item . Name ) }
234239 />
240+ { isLoading ?
241+ < div className = "flex items-center justify-center h-full w-full" >
242+ < LoaderPinwheel className = "animate-spin" size = { 60 } color = { OscarColors . Green3 } />
243+ </ div >
244+ :
235245 < GenericTable
236246 data = { items . map ( ( item ) => {
237247 return {
@@ -365,6 +375,7 @@ export default function BucketContent() {
365375 } ,
366376 ] }
367377 />
378+ }
368379 < UploadFileDialog
369380 progress = { uploadProgress }
370381 onClose = { clearUploadProgress }
0 commit comments