Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/app/conf/2026/schedule/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { Button } from "@/app/conf/_design-system/button"
import { SessionTags } from "../../components/session-tags"
import { formatDescription } from "./format-description"
import { formatBlockTime } from "../_components/format-block-time"
import { PdfPreview } from "./pdf-preview"
import DownloadIcon from "@/app/conf/_design-system/pixelarticons/download.svg?svgr"

type SessionProps = { params: { id: string } }
Expand Down Expand Up @@ -127,12 +128,7 @@ export default function SessionPage({ params }: SessionProps) {
<ul className="flex max-w-full flex-col gap-y-2">
{session.files?.map(({ path, name }) => (
<li key={path}>
{path.endsWith(".pdf") && canRenderPdf() ? (
<iframe
src={path}
className="aspect-video size-full"
/>
) : null}
{path.endsWith(".pdf") && <PdfPreview path={path} />}
<div className="flex items-stretch justify-between overflow-hidden">
<a
className="typography-link flex items-center truncate p-3 leading-none text-neu-700 max-xs:hidden sm:px-6"
Expand Down Expand Up @@ -297,9 +293,3 @@ function SessionDescription({ session }: { session: ScheduleSession }) {
</div>
)
}

const isFirefox = navigator.userAgent.toLowerCase().includes("firefox")

function canRenderPdf() {
return !isFirefox && !!navigator?.mimeTypes?.["application/pdf" as any]
}
17 changes: 17 additions & 0 deletions src/app/conf/2026/schedule/[id]/pdf-preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// pdf-preview.tsx
"use client"
import { useEffect, useState } from "react"

export function PdfPreview({ path }: { path: string }) {
const [canRender, setCanRender] = useState(false)

useEffect(() => {
const isFirefox = navigator.userAgent.toLowerCase().includes("firefox")
setCanRender(
!isFirefox && !!navigator?.mimeTypes?.["application/pdf" as any],
)
}, [])

if (!canRender) return null
return <iframe src={path} className="aspect-video size-full" />
}
Loading