Skip to content

Commit 19a29d6

Browse files
committed
[WIP] # 223 Changes to facilitate merge with "Fix dock height #296"
With these changes, the menu no longer appears in Platform.Bible app.
1 parent e46ac56 commit 19a29d6

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

src/renderer/app.component.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ body {
1818
#root {
1919
width: 100%;
2020
height: 100%;
21+
display: flex;
22+
flex-direction: column;
2123
}
2224

2325
li {

src/renderer/app.component.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
import { MemoryRouter as Router, Routes, Route } from 'react-router-dom';
22
import './app.component.css';
3+
import { ScriptureReference } from 'papi-components';
34
import ParanextDockLayout from '@renderer/components/docking/paranext-dock-layout.component';
45
import TestContext from '@renderer/context/papi-context/test.context';
6+
import { useState } from 'react';
7+
import PlatformBibleToolbar from './components/platform-bible-toolbar';
8+
9+
10+
function Main() {
11+
const [scrRef, setScrRef] = useState({ book: 40, chapter: 1, verse: 1 });
12+
13+
const handleReferenceChanged = (newScrRef: ScriptureReference) => {
14+
setScrRef(newScrRef);
15+
};
516

6-
function Hello() {
717
return (
818
<TestContext.Provider value="test">
19+
<PlatformBibleToolbar referenceChanged={handleReferenceChanged} scrRef={scrRef} />
920
<ParanextDockLayout />
1021
</TestContext.Provider>
1122
);
@@ -15,7 +26,7 @@ export default function App() {
1526
return (
1627
<Router>
1728
<Routes>
18-
<Route path="/" element={<Hello />} />
29+
<Route path="/" element={<Main />} />
1930
</Routes>
2031
</Router>
2132
);

src/renderer/components/docking/paranext-dock-layout.component.css

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
.dock-layout {
2-
width: calc(100% - 8px);
3-
height: calc(100% - 8px);
4-
margin-left: 4px;
5-
margin-top: 4px;
2+
flex-grow: 1;
3+
margin: 4px;
64
}
75

86
.dock-layout .dock-panel.dock-style-paranext {

src/renderer/components/docking/paranext-dock-layout.component.tsx

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'rc-dock/dist/rc-dock.css';
22
import './paranext-dock-layout.component.css';
3-
import { useRef, useEffect, useState } from 'react';
3+
import { useRef, useEffect } from 'react';
44
import DockLayout, {
55
BoxData,
66
FloatPosition,
@@ -41,8 +41,6 @@ import {
4141
saveTabInfoBase,
4242
} from '@shared/services/web-view.service';
4343
import { getErrorMessage } from '@shared/utils/util';
44-
import { ScriptureReference } from 'papi-components';
45-
import PlatformBibleToolbar from '../platform-bible-toolbar';
4644

4745
type TabType = string;
4846

@@ -274,8 +272,6 @@ export function addWebViewToDock(webView: WebViewProps, layout: Layout, dockLayo
274272
// #endregion
275273

276274
export default function ParanextDockLayout() {
277-
const [scrRef, setScrRef] = useState({ book: 40, chapter: 1, verse: 1 });
278-
279275
// This ref will always be defined
280276
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
281277
const dockLayoutRef = useRef<DockLayout>(null!);
@@ -303,24 +299,17 @@ export default function ParanextDockLayout() {
303299
// Is there any situation where dockLayoutRef will change? We need to add to dependencies if so
304300
}, []);
305301

306-
const handleReferenceChanged = (newScrRef: ScriptureReference) => {
307-
setScrRef(newScrRef);
308-
};
309-
310302
return (
311-
<>
312-
<PlatformBibleToolbar referenceChanged={handleReferenceChanged} scrRef={scrRef}/>
313-
<DockLayout
314-
ref={dockLayoutRef}
315-
groups={groups}
316-
defaultLayout={{ dockbox: { mode: 'horizontal', children: [] } }}
317-
dropMode="edge"
318-
loadTab={loadTab}
319-
saveTab={saveTab}
320-
onLayoutChange={(...args) => {
321-
if (onLayoutChangeRef.current) onLayoutChangeRef.current(...args);
322-
}}
323-
/>
324-
</>
303+
<DockLayout
304+
ref={dockLayoutRef}
305+
groups={groups}
306+
defaultLayout={{ dockbox: { mode: 'horizontal', children: [] } }}
307+
dropMode="edge"
308+
loadTab={loadTab}
309+
saveTab={saveTab}
310+
onLayoutChange={(...args) => {
311+
if (onLayoutChangeRef.current) onLayoutChangeRef.current(...args);
312+
}}
313+
/>
325314
);
326315
}

0 commit comments

Comments
 (0)