260907_02_ENH: 웹소켓 연결 여부 신호등 표기
This commit is contained in:
@@ -6,7 +6,9 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { KriHeader } from "@/components/layout/KriHeader";
|
import { KriHeader } from "@/components/layout/KriHeader";
|
||||||
import type { TopMenuItem } from "@/config/menu.types";
|
import type { TopMenuItem } from "@/config/menu.types";
|
||||||
import type { LoginUser } from "@kri/common";
|
import type { LoginUser } from "@kri/common";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
import { useInternalInfoQuery } from "@/query/internal";
|
import { useInternalInfoQuery } from "@/query/internal";
|
||||||
|
import { useCtiConnectionStatus } from "@/hooks/useCtiConnectionStatus";
|
||||||
|
|
||||||
interface AppHeaderProps {
|
interface AppHeaderProps {
|
||||||
isMain: boolean;
|
isMain: boolean;
|
||||||
@@ -43,6 +45,8 @@ export function AppHeader({
|
|||||||
}: AppHeaderProps) {
|
}: AppHeaderProps) {
|
||||||
const internalInfoQuery = useInternalInfoQuery(!!userInfo);
|
const internalInfoQuery = useInternalInfoQuery(!!userInfo);
|
||||||
const seatNo = internalInfoQuery.data?.clientId ?? "";
|
const seatNo = internalInfoQuery.data?.clientId ?? "";
|
||||||
|
const ctiConnectionStatus = useCtiConnectionStatus();
|
||||||
|
const isCtiConnected = ctiConnectionStatus === "open";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<KriHeader
|
<KriHeader
|
||||||
@@ -86,9 +90,20 @@ export function AppHeader({
|
|||||||
<Button variant="ghost" size="icon-lg" onClick={onOpenReserveSearch} title="예약 내역 조회">
|
<Button variant="ghost" size="icon-lg" onClick={onOpenReserveSearch} title="예약 내역 조회">
|
||||||
<CalendarClock className="size-6" />
|
<CalendarClock className="size-6" />
|
||||||
</Button>
|
</Button>
|
||||||
<span className="hidden text-sm text-gray-600 sm:inline">
|
<span className="hidden items-center gap-1.5 text-sm text-gray-600 sm:inline-flex">
|
||||||
{userInfo?.userName || ""}
|
{userInfo?.userName || ""}
|
||||||
{seatNo ? ` (${seatNo})` : ""}
|
{seatNo ? (
|
||||||
|
<span className="inline-flex items-center gap-1">
|
||||||
|
{`(${seatNo})`}
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"inline-block h-2 w-2 rounded-full",
|
||||||
|
isCtiConnected ? "bg-green-500" : "bg-red-500",
|
||||||
|
)}
|
||||||
|
title={isCtiConnected ? "CTI 연결됨" : "CTI 연결 안됨"}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
</span>
|
</span>
|
||||||
<Button variant="ghost" size="sm" className="gap-2" onClick={() => onNavigate("/logout")}>
|
<Button variant="ghost" size="sm" className="gap-2" onClick={() => onNavigate("/logout")}>
|
||||||
<LogOut className="h-4 w-4" />
|
<LogOut className="h-4 w-4" />
|
||||||
|
|||||||
Reference in New Issue
Block a user