reduce image size of hub and disptach container
This commit is contained in:
@@ -2,7 +2,6 @@ import { MissionSdsLog, Station } from "@repo/db";
|
||||
import { fmsStatusDescription } from "_data/fmsStatusDescription";
|
||||
import { DisplayLineProps } from "(app)/pilot/_components/mrt/Mrt";
|
||||
import { create } from "zustand";
|
||||
import { syncTabs } from "zustand-sync-tabs";
|
||||
|
||||
interface SetSdsPageParams {
|
||||
page: "sds";
|
||||
@@ -41,133 +40,126 @@ interface MrtStore {
|
||||
setLines: (lines: MrtStore["lines"]) => void;
|
||||
}
|
||||
|
||||
export const useMrtStore = create<MrtStore>(
|
||||
syncTabs(
|
||||
(set) => ({
|
||||
page: "home",
|
||||
pageData: {
|
||||
message: "",
|
||||
},
|
||||
lines: [
|
||||
{
|
||||
textLeft: "VAR.#",
|
||||
textSize: "2",
|
||||
},
|
||||
{
|
||||
textLeft: "No Data",
|
||||
textSize: "3",
|
||||
},
|
||||
],
|
||||
setLines: (lines) => set({ lines }),
|
||||
setPage: (pageData) => {
|
||||
switch (pageData.page) {
|
||||
case "home": {
|
||||
const { station, fmsStatus } = pageData as SetHomePageParams;
|
||||
set({
|
||||
page: "home",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `${station?.bosCallsign}`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{ textLeft: "ILS VAR#", textSize: "3" },
|
||||
{
|
||||
textLeft: fmsStatus,
|
||||
style: { fontWeight: "extrabold" },
|
||||
textSize: "4",
|
||||
},
|
||||
{
|
||||
textLeft: fmsStatusDescription[fmsStatus],
|
||||
textSize: "1",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case "sending-status": {
|
||||
const { station } = pageData as SetSendingStatusPageParams;
|
||||
set({
|
||||
page: "sending-status",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `${station?.bosCallsign}`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{ textLeft: "ILS VAR#", textSize: "3" },
|
||||
{
|
||||
textMid: "sending...",
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "4",
|
||||
},
|
||||
{
|
||||
textLeft: "Status wird gesendet...",
|
||||
textSize: "1",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "new-status": {
|
||||
const { station } = pageData as SetNewStatusPageParams;
|
||||
set({
|
||||
page: "new-status",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `${station?.bosCallsign}`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{ textLeft: "ILS VAR#", textSize: "3" },
|
||||
{
|
||||
textLeft: "empfangen",
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "4",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "sds": {
|
||||
const { sdsMessage } = pageData as SetSdsPageParams;
|
||||
const msg = sdsMessage.data.message;
|
||||
set({
|
||||
page: "sds",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `SDS-Nachricht`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{
|
||||
textLeft: msg,
|
||||
style: {
|
||||
whiteSpace: "normal",
|
||||
overflowWrap: "break-word",
|
||||
wordBreak: "break-word",
|
||||
display: "block",
|
||||
maxWidth: "100%",
|
||||
maxHeight: "100%",
|
||||
overflow: "auto",
|
||||
textOverflow: "ellipsis",
|
||||
lineHeight: "1.2em",
|
||||
},
|
||||
textSize: "2",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
set({ page: "home" });
|
||||
break;
|
||||
}
|
||||
},
|
||||
}),
|
||||
export const useMrtStore = create<MrtStore>((set) => ({
|
||||
page: "home",
|
||||
pageData: {
|
||||
message: "",
|
||||
},
|
||||
lines: [
|
||||
{
|
||||
name: "mrt-store", // unique name
|
||||
textLeft: "VAR.#",
|
||||
textSize: "2",
|
||||
},
|
||||
),
|
||||
);
|
||||
{
|
||||
textLeft: "No Data",
|
||||
textSize: "3",
|
||||
},
|
||||
],
|
||||
setLines: (lines) => set({ lines }),
|
||||
setPage: (pageData) => {
|
||||
switch (pageData.page) {
|
||||
case "home": {
|
||||
const { station, fmsStatus } = pageData as SetHomePageParams;
|
||||
set({
|
||||
page: "home",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `${station?.bosCallsign}`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{ textLeft: "ILS VAR#", textSize: "3" },
|
||||
{
|
||||
textLeft: fmsStatus,
|
||||
style: { fontWeight: "extrabold" },
|
||||
textSize: "4",
|
||||
},
|
||||
{
|
||||
textLeft: fmsStatusDescription[fmsStatus],
|
||||
textSize: "1",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case "sending-status": {
|
||||
const { station } = pageData as SetSendingStatusPageParams;
|
||||
set({
|
||||
page: "sending-status",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `${station?.bosCallsign}`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{ textLeft: "ILS VAR#", textSize: "3" },
|
||||
{
|
||||
textMid: "sending...",
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "4",
|
||||
},
|
||||
{
|
||||
textLeft: "Status wird gesendet...",
|
||||
textSize: "1",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "new-status": {
|
||||
const { station } = pageData as SetNewStatusPageParams;
|
||||
set({
|
||||
page: "new-status",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `${station?.bosCallsign}`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{ textLeft: "ILS VAR#", textSize: "3" },
|
||||
{
|
||||
textLeft: "empfangen",
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "4",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "sds": {
|
||||
const { sdsMessage } = pageData as SetSdsPageParams;
|
||||
const msg = sdsMessage.data.message;
|
||||
set({
|
||||
page: "sds",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `SDS-Nachricht`,
|
||||
style: { fontWeight: "bold" },
|
||||
textSize: "2",
|
||||
},
|
||||
{
|
||||
textLeft: msg,
|
||||
style: {
|
||||
whiteSpace: "normal",
|
||||
overflowWrap: "break-word",
|
||||
wordBreak: "break-word",
|
||||
display: "block",
|
||||
maxWidth: "100%",
|
||||
maxHeight: "100%",
|
||||
overflow: "auto",
|
||||
textOverflow: "ellipsis",
|
||||
lineHeight: "1.2em",
|
||||
},
|
||||
textSize: "2",
|
||||
},
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
set({ page: "home" });
|
||||
break;
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Mission, Station, User } from "@repo/db";
|
||||
import { DisplayLineProps } from "(app)/pilot/_components/dme/Dme";
|
||||
import { create } from "zustand";
|
||||
import { syncTabs } from "zustand-sync-tabs";
|
||||
|
||||
interface SetHomePageParams {
|
||||
page: "home";
|
||||
@@ -45,197 +44,190 @@ interface MrtStore {
|
||||
|
||||
let interval: NodeJS.Timeout | null = null;
|
||||
|
||||
export const useDmeStore = create<MrtStore>(
|
||||
syncTabs(
|
||||
(set) => ({
|
||||
page: "home",
|
||||
pageData: {
|
||||
message: "",
|
||||
},
|
||||
lines: [
|
||||
{
|
||||
textLeft: "",
|
||||
},
|
||||
{
|
||||
textMid: "VAR . DME# No Data",
|
||||
textSize: "2",
|
||||
},
|
||||
{
|
||||
textLeft: "",
|
||||
},
|
||||
],
|
||||
setLines: (lines) => set({ lines }),
|
||||
latestMission: null,
|
||||
setPage: (pageData) => {
|
||||
if (interval) clearInterval(interval);
|
||||
switch (pageData.page) {
|
||||
case "home": {
|
||||
const setHomePage = () =>
|
||||
set({
|
||||
page: "home",
|
||||
lines: [
|
||||
{
|
||||
textMid: pageData.station.bosCallsign
|
||||
? `${pageData.station.bosCallsign}`
|
||||
: "no Data",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
{
|
||||
textMid: new Date().toLocaleDateString("de-DE", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
}),
|
||||
},
|
||||
{
|
||||
textMid: new Date().toLocaleTimeString(),
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
{
|
||||
textMid: `${pageData.user.lastname} ${pageData.user.firstname}`,
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
setHomePage();
|
||||
|
||||
interval = setInterval(() => {
|
||||
setHomePage();
|
||||
}, 1000);
|
||||
break;
|
||||
}
|
||||
|
||||
case "new-mission": {
|
||||
set({
|
||||
page: "new-mission",
|
||||
lines: [
|
||||
{ textMid: "⠀" },
|
||||
{
|
||||
textMid: "new mission received",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "mission": {
|
||||
set({
|
||||
latestMission: pageData.mission,
|
||||
page: "mission",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `${pageData.mission.missionKeywordAbbreviation}`,
|
||||
textRight: pageData.mission.Stations.map((s) => s.bosCallsignShort).join(","),
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
...(pageData.mission.type == "primär"
|
||||
? [
|
||||
{
|
||||
textMid: `${pageData.mission.missionKeywordName}`,
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
]
|
||||
: []),
|
||||
|
||||
{ textLeft: `${pageData.mission.addressStreet}` },
|
||||
{
|
||||
textLeft: `${pageData.mission.addressZip} ${pageData.mission.addressCity}`,
|
||||
},
|
||||
{
|
||||
textMid: "Weitere Standortinformationen:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.addressAdditionalInfo || "keine Daten",
|
||||
},
|
||||
...(pageData.mission.type === "sekundär"
|
||||
? [
|
||||
{
|
||||
textMid: "Zielort:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.addressMissionDestination || "keine Daten",
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(pageData.mission.missionPatientInfo &&
|
||||
pageData.mission.missionPatientInfo.length > 0
|
||||
? [
|
||||
{
|
||||
textMid: "Patienteninfos:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.missionPatientInfo,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(pageData.mission.missionAdditionalInfo &&
|
||||
pageData.mission.missionAdditionalInfo.length > 0
|
||||
? [
|
||||
{
|
||||
textMid: "Weitere Infos:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.missionAdditionalInfo,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "error": {
|
||||
set({
|
||||
page: "error",
|
||||
lines: [
|
||||
{ textMid: "Fehler:" },
|
||||
{
|
||||
textMid: pageData.error,
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "acknowledge": {
|
||||
set({
|
||||
page: "acknowledge",
|
||||
lines: [
|
||||
{ textMid: "⠀" },
|
||||
{
|
||||
textMid: "Einsatz angenommen",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
set({
|
||||
page: "error",
|
||||
lines: [
|
||||
{ textMid: "Fehler:" },
|
||||
{
|
||||
textMid: `Unbekannte Seite`,
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
}),
|
||||
export const useDmeStore = create<MrtStore>((set) => ({
|
||||
page: "home",
|
||||
pageData: {
|
||||
message: "",
|
||||
},
|
||||
lines: [
|
||||
{
|
||||
name: "dme-store", // unique name
|
||||
textLeft: "",
|
||||
},
|
||||
),
|
||||
);
|
||||
{
|
||||
textMid: "VAR . DME# No Data",
|
||||
textSize: "2",
|
||||
},
|
||||
{
|
||||
textLeft: "",
|
||||
},
|
||||
],
|
||||
setLines: (lines) => set({ lines }),
|
||||
latestMission: null,
|
||||
setPage: (pageData) => {
|
||||
if (interval) clearInterval(interval);
|
||||
switch (pageData.page) {
|
||||
case "home": {
|
||||
const setHomePage = () =>
|
||||
set({
|
||||
page: "home",
|
||||
lines: [
|
||||
{
|
||||
textMid: pageData.station.bosCallsign
|
||||
? `${pageData.station.bosCallsign}`
|
||||
: "no Data",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
{
|
||||
textMid: new Date().toLocaleDateString("de-DE", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
}),
|
||||
},
|
||||
{
|
||||
textMid: new Date().toLocaleTimeString(),
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
{
|
||||
textMid: `${pageData.user.lastname} ${pageData.user.firstname}`,
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
setHomePage();
|
||||
|
||||
interval = setInterval(() => {
|
||||
setHomePage();
|
||||
}, 1000);
|
||||
break;
|
||||
}
|
||||
|
||||
case "new-mission": {
|
||||
set({
|
||||
page: "new-mission",
|
||||
lines: [
|
||||
{ textMid: "⠀" },
|
||||
{
|
||||
textMid: "new mission received",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "mission": {
|
||||
set({
|
||||
latestMission: pageData.mission,
|
||||
page: "mission",
|
||||
lines: [
|
||||
{
|
||||
textLeft: `${pageData.mission.missionKeywordAbbreviation}`,
|
||||
textRight: pageData.mission.Stations.map((s) => s.bosCallsignShort).join(","),
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
...(pageData.mission.type == "primär"
|
||||
? [
|
||||
{
|
||||
textMid: `${pageData.mission.missionKeywordName}`,
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
]
|
||||
: []),
|
||||
|
||||
{ textLeft: `${pageData.mission.addressStreet}` },
|
||||
{
|
||||
textLeft: `${pageData.mission.addressZip} ${pageData.mission.addressCity}`,
|
||||
},
|
||||
{
|
||||
textMid: "Weitere Standortinformationen:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.addressAdditionalInfo || "keine Daten",
|
||||
},
|
||||
...(pageData.mission.type === "sekundär"
|
||||
? [
|
||||
{
|
||||
textMid: "Zielort:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.addressMissionDestination || "keine Daten",
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(pageData.mission.missionPatientInfo &&
|
||||
pageData.mission.missionPatientInfo.length > 0
|
||||
? [
|
||||
{
|
||||
textMid: "Patienteninfos:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.missionPatientInfo,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(pageData.mission.missionAdditionalInfo &&
|
||||
pageData.mission.missionAdditionalInfo.length > 0
|
||||
? [
|
||||
{
|
||||
textMid: "Weitere Infos:",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{
|
||||
textLeft: pageData.mission.missionAdditionalInfo,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "error": {
|
||||
set({
|
||||
page: "error",
|
||||
lines: [
|
||||
{ textMid: "Fehler:" },
|
||||
{
|
||||
textMid: pageData.error,
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "acknowledge": {
|
||||
set({
|
||||
page: "acknowledge",
|
||||
lines: [
|
||||
{ textMid: "⠀" },
|
||||
{
|
||||
textMid: "Einsatz angenommen",
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
set({
|
||||
page: "error",
|
||||
lines: [
|
||||
{ textMid: "Fehler:" },
|
||||
{
|
||||
textMid: `Unbekannte Seite`,
|
||||
style: { fontWeight: "bold" },
|
||||
},
|
||||
{ textMid: "⠀" },
|
||||
],
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user