Skip to content

Commit 9b52b41

Browse files
viewing pdf in player moduel dashboard
1 parent e6d3fc5 commit 9b52b41

2 files changed

Lines changed: 95 additions & 1 deletion

File tree

app/player-management/page.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default function PlayerManagement() {
6565
const [editingReport, setEditingReport] = useState(null)
6666
const [showEditReportModal, setShowEditReportModal] = useState(false)
6767
const [editReportPdfFile, setEditReportPdfFile] = useState(null)
68+
const [showPdfViewer, setShowPdfViewer] = useState(false)
6869
const [newReport, setNewReport] = useState({
6970
firstName: '',
7071
lastName: '',
@@ -1602,11 +1603,40 @@ export default function PlayerManagement() {
16021603
</div>
16031604
)}
16041605

1605-
<button className={styles.assignButton}>
1606+
<button
1607+
className={styles.assignButton}
1608+
onClick={() => setShowPdfViewer(true)}
1609+
disabled={!selectedReport.pdfUrl}
1610+
>
16061611
View Scouting Report
16071612
</button>
16081613
</div>
16091614
)}
1615+
1616+
{/* PDF Viewer Overlay */}
1617+
{showPdfViewer && selectedReport?.pdfUrl && (
1618+
<div className={styles.pdfOverlay}>
1619+
<div className={styles.pdfViewerContainer}>
1620+
<div className={styles.pdfViewerHeader}>
1621+
<span className={styles.pdfViewerTitle}>
1622+
{selectedReport.firstName} {selectedReport.lastName}{' '}
1623+
{selectedReport.date}
1624+
</span>
1625+
<button
1626+
className={styles.pdfViewerClose}
1627+
onClick={() => setShowPdfViewer(false)}
1628+
>
1629+
&times;
1630+
</button>
1631+
</div>
1632+
<iframe
1633+
src={selectedReport.pdfUrl}
1634+
className={styles.pdfViewerFrame}
1635+
title="Scouting Report PDF"
1636+
/>
1637+
</div>
1638+
</div>
1639+
)}
16101640
</div>
16111641
</div>
16121642
)

app/styles/PlayerManagement.module.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,67 @@
396396
background-color: #ccc;
397397
cursor: not-allowed;
398398
}
399+
400+
/* PDF Viewer Overlay */
401+
.pdfOverlay {
402+
position: fixed;
403+
z-index: 2000;
404+
left: 0;
405+
top: 0;
406+
width: 100%;
407+
height: 100%;
408+
background-color: rgba(0, 0, 0, 0.7);
409+
display: flex;
410+
align-items: center;
411+
justify-content: center;
412+
}
413+
414+
.pdfViewerContainer {
415+
width: 90%;
416+
height: 90%;
417+
max-width: 1200px;
418+
display: flex;
419+
flex-direction: column;
420+
border-radius: 8px;
421+
overflow: hidden;
422+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
423+
}
424+
425+
.pdfViewerHeader {
426+
display: flex;
427+
align-items: center;
428+
justify-content: space-between;
429+
background-color: #2c3e50;
430+
color: white;
431+
padding: 10px 16px;
432+
flex-shrink: 0;
433+
}
434+
435+
.pdfViewerTitle {
436+
font-size: 14px;
437+
font-weight: 600;
438+
white-space: nowrap;
439+
overflow: hidden;
440+
text-overflow: ellipsis;
441+
}
442+
443+
.pdfViewerClose {
444+
background: none;
445+
border: none;
446+
color: white;
447+
font-size: 24px;
448+
cursor: pointer;
449+
padding: 0 4px;
450+
line-height: 1;
451+
}
452+
453+
.pdfViewerClose:hover {
454+
color: #e74c3c;
455+
}
456+
457+
.pdfViewerFrame {
458+
flex: 1;
459+
width: 100%;
460+
border: none;
461+
background: white;
462+
}

0 commit comments

Comments
 (0)