addd HPG state
This commit is contained in:
@@ -21,6 +21,8 @@ import { ROOMS } from "_data/livekitRooms";
|
||||
|
||||
export const Audio = () => {
|
||||
const connection = usePilotConnectionStore();
|
||||
const [showSource, setShowSource] = useState(false);
|
||||
|
||||
const {
|
||||
isTalking,
|
||||
toggleTalking,
|
||||
@@ -31,9 +33,16 @@ export const Audio = () => {
|
||||
remoteParticipants,
|
||||
room,
|
||||
message,
|
||||
source,
|
||||
} = useAudioStore();
|
||||
const [selectedRoom, setSelectedRoom] = useState<string>("LST_01");
|
||||
|
||||
useEffect(() => {
|
||||
setShowSource(true);
|
||||
setTimeout(() => {
|
||||
setShowSource(false);
|
||||
}, 2000);
|
||||
}, [source, isTalking]);
|
||||
useEffect(() => {
|
||||
const joinRoom = async () => {
|
||||
if (connection.status != "connected") return;
|
||||
@@ -55,6 +64,9 @@ export const Audio = () => {
|
||||
{state === "error" && (
|
||||
<div className="h-4 flex items-center">{message}</div>
|
||||
)}
|
||||
{showSource && source && (
|
||||
<div className="h-4 flex items-center">{source}</div>
|
||||
)}
|
||||
<button
|
||||
onClick={() => {
|
||||
if (state === "connected") toggleTalking();
|
||||
|
||||
@@ -5,6 +5,7 @@ import { toast } from "react-hot-toast";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { ReactNode, useEffect, useState } from "react";
|
||||
import { dispatchSocket } from "dispatch/socket";
|
||||
import { Mission } from "@repo/db";
|
||||
|
||||
export function QueryProvider({ children }: { children: ReactNode }) {
|
||||
const [queryClient] = useState(
|
||||
@@ -22,7 +23,7 @@ export function QueryProvider({ children }: { children: ReactNode }) {
|
||||
}),
|
||||
);
|
||||
useEffect(() => {
|
||||
const invalidateMission = () => {
|
||||
const invalidateMission = (mission: Mission) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["missions"],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user