Skip to content

Commit 81feecd

Browse files
committed
progressive disclosure for papers on the right of the projects view
1 parent 224a712 commit 81feecd

File tree

1 file changed

+9
-1
lines changed
  • client/src/app/(main)/projects/[projectId]

1 file changed

+9
-1
lines changed

client/src/app/(main)/projects/[projectId]/page.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export default function ProjectPage() {
7979
const [isAddPapersSheetOpen, setIsAddPapersSheetOpen] = useState(false);
8080
const [addPapersView, setAddPapersView] = useState<'initial' | 'upload' | 'library'>('initial');
8181
const [isUploadDialogOpen, setIsUploadDialogOpen] = useState(false);
82+
const [showAllPapers, setShowAllPapers] = useState(false);
8283
const { subscription } = useSubscription();
8384

8485
const chatDisabled = isChatCreditAtLimit(subscription);
@@ -647,11 +648,18 @@ export default function ProjectPage() {
647648

648649
{papers && papers.length > 0 ? (
649650
<div className="grid grid-cols-1 gap-4">
650-
{papers.map((paper, index) => (
651+
{papers.slice(0, showAllPapers ? papers.length : 7).map((paper, index) => (
651652
<div key={paper.id} className="animate-fade-in" style={{ animationDelay: `${index * 100}ms` }}>
652653
<PaperCard paper={paper} minimalist={true} projectId={projectId} onUnlink={getProjectPapers} />
653654
</div>
654655
))}
656+
{papers.length > 7 && !showAllPapers && (
657+
<div className="mt-4 text-center">
658+
<Button variant="outline" onClick={() => setShowAllPapers(true)}>
659+
Show More
660+
</Button>
661+
</div>
662+
)}
655663
</div>
656664
) : (
657665
<div className="text-center p-8 border-dashed border-2 border-gray-300 rounded-xl bg-gray-50">

0 commit comments

Comments
 (0)