-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
92 lines (84 loc) · 2.93 KB
/
App.tsx
File metadata and controls
92 lines (84 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import React from 'react';
import { pdfjs } from 'react-pdf';
// Hooks
import { useAppController } from './hooks/useAppController';
// Components
import { Header } from './components/Header';
import { Sidebar } from './components/Sidebar';
import { DocumentPreview } from './components/DocumentPreview';
import { ExportOverlay } from './components/ExportOverlay';
import { DebugModal } from './components/DebugModal';
import { MobileWorkspaceShell } from './components/MobileWorkspaceShell';
import { useMobileLayout } from './hooks/useMobileLayout';
import { useViewportHeight } from './hooks/useViewportHeight';
// Worker setup: GH-Pages でもローカルのワーカーを利用する
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
'pdfjs-dist/build/pdf.worker.min.mjs',
import.meta.url
).toString();
export default function App() {
useViewportHeight();
const mobileLayout = useMobileLayout();
const {
headerProps,
leftProjectPanel,
documentPreviewProps,
sidebarProps,
debugModalProps,
exportOverlayProps,
} = useAppController();
return (
<div
className="flex min-h-0 flex-col overflow-hidden bg-gray-100 text-gray-800 font-sans"
style={{ height: 'var(--app-height)' }}
>
<Header
{...headerProps}
isMobileUi={mobileLayout.isMobileUi}
isMobileCompact={mobileLayout.isMobileCompact}
isMobileTight={mobileLayout.isMobileTight}
/>
<div className="relative flex min-h-0 flex-1 overflow-hidden">
<ExportOverlay {...exportOverlayProps} />
{mobileLayout.isMobileUi ? (
<MobileWorkspaceShell
mode={headerProps.mode}
isCompact={mobileLayout.isMobileCompact}
isTight={mobileLayout.isMobileTight}
leftProjectPanel={leftProjectPanel}
documentPreview={
<DocumentPreview
{...documentPreviewProps}
layoutMode="mobile"
/>
}
sidebar={
<Sidebar
{...sidebarProps}
layout="mobile"
mobileAutoUiScale={mobileLayout.autoUiScale}
mobileUserUiScale={mobileLayout.userUiScale}
mobileEffectiveUiScale={mobileLayout.uiScale}
onMobileUiScaleChange={mobileLayout.setUserUiScale}
onResetMobileUiScale={mobileLayout.resetUserUiScale}
/>
}
/>
) : (
<>
{leftProjectPanel && (
<aside className="w-96 shrink-0 border-r border-gray-200 bg-white shadow-xl z-20">
<div className="h-full p-4">
{leftProjectPanel}
</div>
</aside>
)}
<DocumentPreview {...documentPreviewProps} layoutMode="desktop" />
<Sidebar {...sidebarProps} layout="desktop" />
</>
)}
</div>
<DebugModal {...debugModalProps} />
</div>
);
}