@@ -19,12 +19,17 @@ import { chunkArray } from "@/util/utils";
1919import { StoredSubjects } from "@/interface" ;
2020import SkeletonPaperCard from "./SkeletonPaperCard" ;
2121
22+ type PinnedPapersCarouselProps = {
23+ carouselType : "users" | "upcoming" ,
24+ displayPapers : IUpcomingPaper [ ] ,
25+ setDisplayPapers : React . Dispatch < React . SetStateAction < IUpcomingPaper [ ] > >
26+ }
27+
2228function PinnedPapersCarousel ( {
2329 carouselType = "upcoming" ,
24- } : {
25- carouselType : "users" | "upcoming" ;
26- } ) {
27- const [ displayPapers , setDisplayPapers ] = useState < IUpcomingPaper [ ] > ( [ ] ) ;
30+ displayPapers,
31+ setDisplayPapers
32+ } : PinnedPapersCarouselProps ) {
2833 const [ isLoading , setIsLoading ] = useState ( true ) ;
2934 const [ chunkSize , setChunkSize ] = useState < number > ( 4 ) ;
3035
@@ -107,6 +112,7 @@ function PinnedPapersCarousel({
107112 return (
108113 < div className = "px-4" >
109114 < div className = "" >
115+ { displayPapers . length > 0 ?
110116 < Carousel
111117 opts = { {
112118 align : "start" ,
@@ -115,12 +121,13 @@ function PinnedPapersCarousel({
115121 plugins = { plugins }
116122 className = "w-full"
117123 >
124+ { displayPapers . length > 8 &&
118125 < div
119- className = { `relative mt-4 flex justify-end gap-4 ${ displayPapers . length > 0 ? "block" : "hidden" } ` }
126+ className = { `relative mt-4 flex justify-end gap-4` }
120127 >
121128 < CarouselPrevious className = "relative" />
122129 < CarouselNext className = "relative" />
123- </ div >
130+ </ div > }
124131 < CarouselContent >
125132 { isLoading ? (
126133 < CarouselItem
@@ -167,7 +174,11 @@ function PinnedPapersCarousel({
167174 } )
168175 ) }
169176 </ CarouselContent >
170- </ Carousel >
177+ </ Carousel > :
178+ < div className = { `relative flex justify-center gap-4 items-center h-max text-center mt-48 font-bold` }
179+ >
180+ Start pinning subjects for quick and easy access.
181+ </ div > }
171182 </ div >
172183 </ div >
173184 ) ;
0 commit comments