"use client";
import Link from "next/link";
import { Mic } from "lucide-react";
import { useAuth } from "@/lib/auth/auth-context";
import { offersRecording, useVoiceRecordingSwitch } from "@/lib/voice/use-voice-recording-switch";
import { Button } from "@/components/ui/button";
interface VoiceEntryLinkProps {
colonyId: string;
/** The stand round the note belongs to; keeps the round going afterwards. */
roundApiaryId?: string | null;
}
/**
* „Sprachnotiz aufnehmen“ next to „Durchsicht erfassen“. Not there without the
* rights or while the operator has recording switched off - no dead button.
*/
export function VoiceEntryLink({ colonyId, roundApiaryId }: VoiceEntryLinkProps) {
const { hasPermission } = useAuth();
const allowed = hasPermission("voice-captures:use") && hasPermission("inspections:create");
const recordingSwitch = useVoiceRecordingSwitch(allowed);
if (!allowed || !offersRecording(recordingSwitch)) {
return null;
}
const params = new URLSearchParams({ colonyId });
if (roundApiaryId) {
params.set("round", roundApiaryId);
}
return (
}
>
Sprachnotiz aufnehmen
);
}