Skip to content

Commit e5ee103

Browse files
authored
Merge pull request #13 from PFConnect/FixACARSSettings
FixAcars
2 parents 4fea0e7 + 8b1e990 commit e5ee103

2 files changed

Lines changed: 64 additions & 14 deletions

File tree

src/components/Settings/AcarsSettings.tsx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ export default function AcarsSettings({
8383
const percentage = (x / rect.width) * 100;
8484

8585
if (isDragging === 'terminal') {
86-
const newTerminalWidth = Math.max(30, Math.min(70, percentage));
86+
const newTerminalWidth = Math.max(20, Math.min(80, percentage));
8787
handleTerminalWidthChange(Math.round(newTerminalWidth / 5) * 5);
8888
} else if (isDragging === 'notes') {
89-
const newNotesWidth = Math.max(15, Math.min(35, percentage - settings.acars.terminalWidth));
89+
const newNotesWidth = Math.max(10, Math.min(50, percentage - settings.acars.terminalWidth));
9090
handleNotesWidthChange(Math.round(newNotesWidth / 5) * 5);
9191
}
9292
};
@@ -279,8 +279,8 @@ export default function AcarsSettings({
279279
{/* Notes Panel */}
280280
{settings.acars.notesEnabled && (
281281
<div
282-
style={{ width: `${settings.acars.notesWidth}%` }}
283-
className="bg-gradient-to-br from-blue-900 to-blue-950 border-r border-gray-700 flex flex-col"
282+
style={settings.acars.chartsEnabled ? { width: `${settings.acars.notesWidth}%` } : undefined}
283+
className={`bg-gradient-to-br from-blue-900 to-blue-950 border-r border-gray-700 flex flex-col ${!settings.acars.chartsEnabled ? 'flex-1' : ''}`}
284284
>
285285
<div className="bg-blue-900/50 px-3 py-2 border-b border-gray-700 flex items-center gap-2">
286286
<StickyNote className="w-3 h-3 text-blue-400" />
@@ -304,6 +304,16 @@ export default function AcarsSettings({
304304
</div>
305305
)}
306306

307+
{/* Terminal-to-Charts Divider (when notes is disabled) */}
308+
{!settings.acars.notesEnabled && settings.acars.chartsEnabled && (
309+
<div
310+
className="w-1 bg-purple-500 hover:bg-purple-400 cursor-col-resize flex-shrink-0 relative group"
311+
onMouseDown={() => handleMouseDown('terminal')}
312+
>
313+
<div className="absolute inset-y-0 -left-1 -right-1" />
314+
</div>
315+
)}
316+
307317
{/* Charts Panel */}
308318
{settings.acars.chartsEnabled && (
309319
<div className="flex-1 bg-gradient-to-br from-purple-900 to-purple-950 flex flex-col">
@@ -320,7 +330,15 @@ export default function AcarsSettings({
320330
</div>
321331

322332
<p className="text-xs text-zinc-500 mt-2 text-center">
323-
Terminal: {settings.acars.terminalWidth}% • Notes: {settings.acars.notesWidth}% • Charts: {100 - settings.acars.terminalWidth - settings.acars.notesWidth}%
333+
{settings.acars.notesEnabled && settings.acars.chartsEnabled ? (
334+
<>Terminal: {settings.acars.terminalWidth}% • Notes: {settings.acars.notesWidth}% • Charts: {100 - settings.acars.terminalWidth - settings.acars.notesWidth}%</>
335+
) : settings.acars.notesEnabled ? (
336+
<>Terminal: {settings.acars.terminalWidth}% • Notes: {100 - settings.acars.terminalWidth}%</>
337+
) : settings.acars.chartsEnabled ? (
338+
<>Terminal: {settings.acars.terminalWidth}% • Charts: {100 - settings.acars.terminalWidth}%</>
339+
) : (
340+
<>Terminal: 100%</>
341+
)}
324342
</p>
325343
</div>
326344
</div>

src/pages/ACARS.tsx

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,10 @@ NOTES:
188188
const percentage = (x / rect.width) * 100;
189189

190190
if (isDragging === 'terminal') {
191-
const newTerminalWidth = Math.max(30, Math.min(70, percentage));
191+
const newTerminalWidth = Math.max(20, Math.min(80, percentage));
192192
setTerminalWidth(newTerminalWidth);
193193
} else if (isDragging === 'notes') {
194-
const newNotesWidth = Math.max(
195-
15,
196-
Math.min(35, percentage - terminalWidth)
197-
);
194+
const newNotesWidth = Math.max(10, Math.min(50, percentage - terminalWidth));
198195
setNotesWidth(newNotesWidth);
199196
}
200197
};
@@ -205,7 +202,7 @@ NOTES:
205202
const chartContainer = e.currentTarget as HTMLElement;
206203
const rect = chartContainer.getBoundingClientRect();
207204
const x = e.clientX - rect.left;
208-
const newWidth = Math.max(200, Math.min(500, x));
205+
const newWidth = Math.max(150, Math.min(600, x));
209206
setChartListWidth(newWidth);
210207
};
211208

@@ -1243,7 +1240,7 @@ NOTES:
12431240
</div>
12441241
</div>
12451242

1246-
{settings?.acars?.notesEnabled && (
1243+
{settings?.acars?.notesEnabled && settings?.acars?.chartsEnabled && (
12471244
<>
12481245
<div
12491246
className="w-1 bg-gray-800 hover:bg-blue-500 cursor-col-resize transition-colors mx-2"
@@ -1276,14 +1273,49 @@ NOTES:
12761273
</div>
12771274
</div>
12781275
</div>
1276+
1277+
<div
1278+
className="w-1 bg-gray-800 hover:bg-blue-500 cursor-col-resize transition-colors mx-2"
1279+
onMouseDown={() => handleMouseDown('notes')}
1280+
/>
12791281
</>
12801282
)}
12811283

1282-
{settings?.acars?.chartsEnabled && (
1284+
{settings?.acars?.notesEnabled && !settings?.acars?.chartsEnabled && (
12831285
<>
12841286
<div
12851287
className="w-1 bg-gray-800 hover:bg-blue-500 cursor-col-resize transition-colors mx-2"
1286-
onMouseDown={() => handleMouseDown('notes')}
1288+
onMouseDown={() => handleMouseDown('terminal')}
1289+
/>
1290+
1291+
<div className="flex-1 min-w-0">
1292+
<div className="bg-gray-900 rounded-2xl shadow-2xl border border-gray-800 overflow-hidden">
1293+
<div className="bg-gradient-to-r from-gray-800 to-gray-900 px-4 py-3 border-b border-gray-700">
1294+
<div className="flex items-center gap-2">
1295+
<StickyNote className="w-4 h-4 text-blue-500" />
1296+
<span className="text-sm font-mono text-gray-300">
1297+
Flight Notes
1298+
</span>
1299+
</div>
1300+
</div>
1301+
<div className="p-4" style={{ height: 'calc(100vh - 200px)' }}>
1302+
<textarea
1303+
value={notes}
1304+
onChange={handleNotesChange}
1305+
placeholder="Loading flight plan details..."
1306+
className="w-full h-full bg-gray-950 border border-gray-800 rounded-lg p-3 text-xs text-gray-300 font-mono resize-none focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent placeholder-gray-600"
1307+
/>
1308+
</div>
1309+
</div>
1310+
</div>
1311+
</>
1312+
)}
1313+
1314+
{!settings?.acars?.notesEnabled && settings?.acars?.chartsEnabled && (
1315+
<>
1316+
<div
1317+
className="w-1 bg-gray-800 hover:bg-purple-500 cursor-col-resize transition-colors mx-2"
1318+
onMouseDown={() => handleMouseDown('terminal')}
12871319
/>
12881320

12891321
<div className="flex-1 min-w-0">

0 commit comments

Comments
 (0)