Merge branch 'main' of https://github.com/VAR-Virtual-Air-Rescue/var-monorepo
This commit is contained in:
@@ -13,16 +13,6 @@ import { handleConnectDesktop } from "socket-events/connect-desktop";
|
||||
import cookieParser from "cookie-parser";
|
||||
import cors from "cors";
|
||||
import { authMiddleware } from "modules/expressMiddleware";
|
||||
import { prisma, User } from "@repo/db";
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
|
||||
declare global {
|
||||
namespace Express {
|
||||
interface Request {
|
||||
user?: User | null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const app = express();
|
||||
const server = createServer(app);
|
||||
|
||||
0
apps/dispatch-server/modules/chron.ts
Normal file
0
apps/dispatch-server/modules/chron.ts
Normal file
@@ -16,27 +16,37 @@ export const SettingsBtn = () => {
|
||||
queryKey: ["user", session.data?.user.id],
|
||||
queryFn: () => getUserAPI(session.data!.user.id),
|
||||
});
|
||||
const testSoundRef = useRef<HTMLAudioElement | null>(null);
|
||||
|
||||
const editUserMutation = useMutation({
|
||||
mutationFn: ({ user }: { user: Prisma.UserUpdateInput }) =>
|
||||
editUserAPI(session.data!.user.id, user),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
testSoundRef.current = new Audio("/sounds/Melder3.wav");
|
||||
}
|
||||
}, []);
|
||||
|
||||
const modalRef = useRef<HTMLDialogElement>(null);
|
||||
|
||||
const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]);
|
||||
const [selectedDevice, setSelectedDevice] = useState<string | null>(
|
||||
user?.settingsMicDevice || null,
|
||||
);
|
||||
const [showIndication, setShowInducation] = useState<boolean>(false);
|
||||
const [showIndication, setShowIndication] = useState<boolean>(false);
|
||||
const [micVol, setMicVol] = useState<number>(1);
|
||||
const [dmeVolume, setDmeVol] = useState<number>(0.8);
|
||||
|
||||
const setMic = useAudioStore((state) => state.setMic);
|
||||
|
||||
useEffect(() => {
|
||||
if (user?.settingsMicDevice) {
|
||||
if (user) {
|
||||
setSelectedDevice(user.settingsMicDevice);
|
||||
setMic(user.settingsMicDevice, user.settingsMicVolume || 1);
|
||||
setMicVol(user.settingsMicVolume || 1);
|
||||
setDmeVol(user.settingsDmeVolume || 0.8);
|
||||
}
|
||||
}, [user, setMic]);
|
||||
|
||||
@@ -72,7 +82,7 @@ export const SettingsBtn = () => {
|
||||
value={selectedDevice ? selectedDevice : ""}
|
||||
onChange={(e) => {
|
||||
setSelectedDevice(e.target.value);
|
||||
setShowInducation(true);
|
||||
setShowIndication(true);
|
||||
}}
|
||||
>
|
||||
<option key={0} value={0} disabled>
|
||||
@@ -98,9 +108,7 @@ export const SettingsBtn = () => {
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value);
|
||||
setMicVol(value);
|
||||
// Hier kannst du den Lautstärkewert verwenden
|
||||
setShowInducation(true);
|
||||
console.log("Lautstärke:", value);
|
||||
setShowIndication(true);
|
||||
}}
|
||||
value={micVol}
|
||||
className="range range-xs range-accent w-full"
|
||||
@@ -115,28 +123,29 @@ export const SettingsBtn = () => {
|
||||
{showIndication && (
|
||||
<MicVolumeBar deviceId={selectedDevice ? selectedDevice : ""} volumeInput={micVol} />
|
||||
)}
|
||||
{/* <MicVolumeIndication deviceId={selectedDevice ? selectedDevice : ""} volumeInput={40} /> */}
|
||||
{/* <MicVolumeIndication deviceId={selectedDevice ? selectedDevice : ""} volumeInput={40
|
||||
} />
|
||||
{/* FÜGE HIER BITTE DEN MIKROFONAUSSCHLAG EIN WIE IN DER V1 */}
|
||||
<div className="divider w-full" />
|
||||
</div>
|
||||
<p className="flex items-center gap-2 text-base mb-2">
|
||||
<Volume2 size={20} /> Ausgabelautstärke
|
||||
<Volume2 size={20} /> Melder Lautstärke
|
||||
</p>
|
||||
<div className="w-full">
|
||||
<input
|
||||
type="range"
|
||||
min={0}
|
||||
max={100}
|
||||
defaultValue={40}
|
||||
max={1}
|
||||
step={0.01}
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value);
|
||||
setDmeVol(value);
|
||||
if (!testSoundRef.current) return;
|
||||
testSoundRef.current.volume = value;
|
||||
testSoundRef.current.play();
|
||||
}}
|
||||
value={dmeVolume}
|
||||
className="range range-xs range-accent w-full"
|
||||
/>
|
||||
<div className="flex justify-between px-2.5 mt-2 text-xs">
|
||||
<span>0</span>
|
||||
<span>25</span>
|
||||
<span>50</span>
|
||||
<span>75</span>
|
||||
<span>100</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -148,6 +157,7 @@ export const SettingsBtn = () => {
|
||||
onSubmit={() => false}
|
||||
onClick={() => {
|
||||
modalRef.current?.close();
|
||||
testSoundRef.current?.pause();
|
||||
}}
|
||||
>
|
||||
Schließen
|
||||
@@ -157,10 +167,12 @@ export const SettingsBtn = () => {
|
||||
type="submit"
|
||||
onSubmit={() => false}
|
||||
onClick={async () => {
|
||||
await editUserMutation.mutateAsync({
|
||||
testSoundRef.current?.pause();
|
||||
const res = await editUserMutation.mutateAsync({
|
||||
user: {
|
||||
settingsMicDevice: selectedDevice,
|
||||
settingsMicVolume: micVol,
|
||||
settingsDmeVolume: dmeVolume,
|
||||
},
|
||||
});
|
||||
setMic(selectedDevice, micVol);
|
||||
|
||||
@@ -108,8 +108,6 @@ export const MissionForm = () => {
|
||||
});
|
||||
const { missionFormValues, setOpen } = usePannelStore((state) => state);
|
||||
|
||||
console.log("MissionForm rendered", form.formState.errors);
|
||||
|
||||
const validationRequired = HPGValidationRequired(
|
||||
form.watch("missionStationIds"),
|
||||
aircrafts,
|
||||
@@ -276,7 +274,7 @@ export const MissionForm = () => {
|
||||
<>
|
||||
<select
|
||||
{...form.register("missionKeywordCategory")}
|
||||
className="select select-primary select-bordered w-full mb-4"
|
||||
className="select select-primary select-bordered w-full"
|
||||
onChange={(e) => {
|
||||
const firstKeyword = keywords?.find(
|
||||
(k) => k.category === form.watch("missionKeywordCategory"),
|
||||
@@ -300,9 +298,12 @@ export const MissionForm = () => {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{form.formState.errors.missionKeywordCategory && (
|
||||
<p className="text-error text-sm mb-4">Bitte wähle eine Kategorie aus.</p>
|
||||
)}
|
||||
<select
|
||||
{...form.register("missionKeywordAbbreviation")}
|
||||
className="select select-primary select-bordered w-full mb-4"
|
||||
className="select select-primary select-bordered w-full"
|
||||
onChange={(e) => {
|
||||
const keyword = keywords?.find((k) => k.abreviation === e.target.value);
|
||||
form.setValue("missionKeywordName", keyword?.name || (null as any));
|
||||
@@ -323,7 +324,9 @@ export const MissionForm = () => {
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
{form.formState.errors.missionKeywordAbbreviation && (
|
||||
<p className="text-error text-sm mb-4">Bitte wähle ein Stichwort aus.</p>
|
||||
)}
|
||||
<div className="mb-4">
|
||||
<select
|
||||
{...form.register("hpgMissionString")}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"use client";
|
||||
import { io, Socket } from "socket.io-client";
|
||||
|
||||
console.log("ENV:", process.env.NEXT_PUBLIC_DISPATCH_SERVER_URL);
|
||||
|
||||
export const dispatchSocket: Socket = io(process.env.NEXT_PUBLIC_DISPATCH_SERVER_URL, {
|
||||
autoConnect: false,
|
||||
transports: ["websocket"],
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
"use client";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { getUserAPI } from "_querys/user";
|
||||
import { usePilotConnectionStore } from "_store/pilot/connectionStore";
|
||||
import { useDmeStore } from "_store/pilot/dmeStore";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
export const useSounds = () => {
|
||||
const session = useSession();
|
||||
const { data: user } = useQuery({
|
||||
queryKey: ["user", session.data?.user.id],
|
||||
queryFn: () => getUserAPI(session.data!.user.id),
|
||||
});
|
||||
|
||||
const { page, setPage } = useDmeStore((state) => state);
|
||||
const mission = usePilotConnectionStore((state) => state.activeMission);
|
||||
|
||||
@@ -15,6 +24,16 @@ export const useSounds = () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (user?.settingsDmeVolume) {
|
||||
if (newMissionSound.current) {
|
||||
newMissionSound.current.volume = user.settingsDmeVolume;
|
||||
}
|
||||
} else if (newMissionSound.current) {
|
||||
newMissionSound.current.volume = 0.8; // Default volume
|
||||
}
|
||||
}, [user?.settingsDmeVolume]);
|
||||
|
||||
useEffect(() => {
|
||||
const timeouts: NodeJS.Timeout[] = [];
|
||||
|
||||
@@ -24,22 +43,15 @@ export const useSounds = () => {
|
||||
newMissionSound.current.volume = 0.3;
|
||||
newMissionSound.current.play();
|
||||
if (mission) {
|
||||
timeouts.push(
|
||||
setTimeout(() => setPage({ page: "mission", mission }), 500),
|
||||
);
|
||||
timeouts.push(setTimeout(() => setPage({ page: "mission", mission }), 500));
|
||||
}
|
||||
} else if (page === "acknowledge") {
|
||||
newMissionSound.current?.pause();
|
||||
if (mission) {
|
||||
timeouts.push(
|
||||
setTimeout(() => setPage({ page: "mission", mission }), 500),
|
||||
);
|
||||
timeouts.push(setTimeout(() => setPage({ page: "mission", mission }), 500));
|
||||
} else {
|
||||
timeouts.push(
|
||||
setTimeout(
|
||||
() => setPage({ page: "error", error: "Einsatz nicht gebunden" }),
|
||||
500,
|
||||
),
|
||||
setTimeout(() => setPage({ page: "error", error: "Einsatz nicht gebunden" }), 500),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18",
|
||||
"pnpm": ">=10"
|
||||
"pnpm": ">=10"
|
||||
},
|
||||
"packageManager": "pnpm@10.11.0",
|
||||
"packageManager": "pnpm@10.11.1",
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
"packages/*"
|
||||
|
||||
@@ -33,7 +33,8 @@ model User {
|
||||
// Settings:
|
||||
settingsNtfyRoom String? @map(name: "settings_ntfy_room")
|
||||
settingsMicDevice String? @map(name: "settings_mic_device")
|
||||
settingsMicVolume Int? @map(name: "settings_mic_volume")
|
||||
settingsMicVolume Float? @map(name: "settings_mic_volume")
|
||||
settingsDmeVolume Float? @map(name: "settings_dme_volume")
|
||||
settingsHideLastname Boolean @default(false) @map(name: "settings_hide_lastname")
|
||||
|
||||
// email Verification:
|
||||
|
||||
31
turbo.json
31
turbo.json
@@ -10,7 +10,36 @@
|
||||
"LIVEKIT_API_KEY",
|
||||
"LIVEKIT_API_SECRET",
|
||||
"AUTH_HUB_SECRET",
|
||||
"AUTH_DISPATCH_COOKIE_PREFIX"
|
||||
"AUTH_DISPATCH_COOKIE_PREFIX",
|
||||
"AUTH_HUB_COOKIE_PREFIX",
|
||||
"AUTH_DISPATCH_URL",
|
||||
"AUTH_HUB_URL",
|
||||
"NEXT_PUBLIC_DISPATCH_SERVICE_ID",
|
||||
"NEXT_PUBLIC_HUB_URL",
|
||||
"NEXT_PUBLIC_HUB_SERVER_URL",
|
||||
"NEXT_PUBLIC_DISPATCH_URL",
|
||||
"NEXT_PUBLIC_DISPATCH_SERVER_URL",
|
||||
"NEXT_PUBLIC_ESRI_ACCESS_TOKEN",
|
||||
"NEXT_PUBLIC_OPENAIP_ACCESS",
|
||||
"NEXT_PUBLIC_LIVEKIT_URL",
|
||||
"DISPATCH_SERVER_PORT",
|
||||
"DISPATCH_APP_TOKEN",
|
||||
"REDIS_HOST",
|
||||
"REDIS_PORT",
|
||||
"HUB_SERVER_PORT",
|
||||
"MOODLE_URL",
|
||||
"MOODLE_API_TOKEN",
|
||||
"MOODLE_USER_PASSWORD",
|
||||
"NEXT_PUBLIC_MOODLE_URL",
|
||||
"MAIL_SERVER",
|
||||
"MAIL_PORT",
|
||||
"MAIL_USER",
|
||||
"MAIL_PASSWORD",
|
||||
"DISCORD_OAUTH_CLIENT_ID",
|
||||
"DISCORD_OAUTH_SECRET",
|
||||
"DISCORD_BOT_TOKEN",
|
||||
"DISCORD_REDIRECT_URL",
|
||||
"NEXT_PUBLIC_DISCORD_URL"
|
||||
],
|
||||
"ui": "tui",
|
||||
"tasks": {
|
||||
|
||||
Reference in New Issue
Block a user