summaryrefslogtreecommitdiff
path: root/components/information/information-button.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'components/information/information-button.tsx')
-rw-r--r--components/information/information-button.tsx42
1 files changed, 21 insertions, 21 deletions
diff --git a/components/information/information-button.tsx b/components/information/information-button.tsx
index 015894c1..1c6d4e7a 100644
--- a/components/information/information-button.tsx
+++ b/components/information/information-button.tsx
@@ -16,7 +16,7 @@ import { getPageInformationDirect, getEditPermissionDirect } from "@/lib/informa
import { getPageNotices } from "@/lib/notice/service"
import { UpdateInformationDialog } from "@/lib/information/table/update-information-dialog"
import { NoticeViewDialog } from "@/components/notice/notice-view-dialog"
-import { PDFTronViewerDialog } from "@/components/document-viewer/pdftron-viewer-dialog"
+// import { PDFTronViewerDialog } from "@/components/document-viewer/pdftron-viewer-dialog" // 주석 처리 - 브라우저 내장 뷰어 사용
import type { PageInformation, InformationAttachment } from "@/db/schema/information"
import type { Notice } from "@/db/schema/notice"
import { useSession } from "next-auth/react"
@@ -53,8 +53,8 @@ export function InformationButton({
const [dataLoaded, setDataLoaded] = useState(false)
const [isLoading, setIsLoading] = useState(false)
const [retryCount, setRetryCount] = useState(0)
- const [viewerDialogOpen, setViewerDialogOpen] = useState(false)
- const [selectedFile, setSelectedFile] = useState<InformationAttachment | null>(null)
+ // const [viewerDialogOpen, setViewerDialogOpen] = useState(false) // 주석 처리 - 브라우저 내장 뷰어 사용
+ // const [selectedFile, setSelectedFile] = useState<InformationAttachment | null>(null) // 주석 처리 - 브라우저 내장 뷰어 사용
// 데이터 로드 함수
const loadData = React.useCallback(async () => {
@@ -169,9 +169,10 @@ export function InformationButton({
// 파일 클릭 핸들러 (뷰어 또는 다운로드)
const handleFileClick = async (attachment: InformationAttachment) => {
if (isViewerSupported(attachment.fileName)) {
- // PDF/DOCX 파일은 뷰어로 열기
- setSelectedFile(attachment)
- setViewerDialogOpen(true)
+ // PDF/DOCX 파일은 브라우저 내장 뷰어로 열기
+ // 동적으로 quickPreview 함수 import
+ const { quickPreview } = await import('@/lib/file-download')
+ await quickPreview(attachment.filePath, attachment.fileName)
} else {
// 기타 파일은 다운로드
await handleDownload(attachment)
@@ -335,18 +336,17 @@ export function InformationButton({
)}
</div>
<div className="flex gap-2">
- {isViewerSupported(attachment.fileName) &&
- <Button
- size="sm"
- variant="outline"
- disabled={!isViewerSupported(attachment.fileName)}
- onClick={() => isViewerSupported(attachment.fileName) && handleFileClick(attachment)}
- className="flex items-center gap-1"
- >
- <EyeIcon className="h-3 w-3" />
- 미리보기
- </Button>
- }
+ {isViewerSupported(attachment.fileName) && (
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => handleFileClick(attachment)}
+ className="flex items-center gap-1"
+ >
+ <EyeIcon className="h-3 w-3" />
+ 미리보기
+ </Button>
+ )}
<Button
size="sm"
variant="outline"
@@ -391,13 +391,13 @@ export function InformationButton({
/>
)}
- {/* PDFTron 뷰어 다이얼로그 */}
- <PDFTronViewerDialog
+ {/* PDFTron 뷰어 다이얼로그 - 주석 처리 (브라우저 내장 뷰어 사용) */}
+ {/* <PDFTronViewerDialog
open={viewerDialogOpen}
onOpenChange={setViewerDialogOpen}
fileUrl={selectedFile?.filePath}
fileName={selectedFile?.fileName}
- />
+ /> */}
</>
)
} \ No newline at end of file