(fix): remove unused dependencies
(fix): remove dead code (fix): remove unused exports
This commit is contained in:
parent
2a8fade420
commit
be56080ba1
29 changed files with 168 additions and 338 deletions
|
|
@ -1,18 +1,14 @@
|
|||
import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@tensamin/ui";
|
||||
import { Button } from "@tensamin/ui";
|
||||
import { toggleDeaf, useCall } from "../../store";
|
||||
import { HeadphoneOff, Headphones } from "lucide-react";
|
||||
import { type CallButtonProps, iconScale, withTooltip } from "./tooltipButton";
|
||||
|
||||
export default function DeafButton({
|
||||
className,
|
||||
iconSize,
|
||||
tooltip,
|
||||
portalContainer,
|
||||
}: {
|
||||
className?: string;
|
||||
iconSize?: number;
|
||||
tooltip?: string;
|
||||
portalContainer?: HTMLElement;
|
||||
}) {
|
||||
}: CallButtonProps) {
|
||||
const deaf = useCall((state) => state.deaf);
|
||||
|
||||
const button = (
|
||||
|
|
@ -22,27 +18,12 @@ export default function DeafButton({
|
|||
className={className}
|
||||
>
|
||||
{deaf ? (
|
||||
<HeadphoneOff
|
||||
style={{ scale: (iconSize ? iconSize + 100 : 100) + "%" }}
|
||||
/>
|
||||
<HeadphoneOff style={iconScale(iconSize)} />
|
||||
) : (
|
||||
<Headphones
|
||||
style={{ scale: (iconSize ? iconSize + 100 : 100) + "%" }}
|
||||
/>
|
||||
<Headphones style={iconScale(iconSize)} />
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
|
||||
if (!tooltip) {
|
||||
return button;
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={button} />
|
||||
<TooltipContent portalProps={{ container: portalContainer }}>
|
||||
{tooltip}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
return withTooltip(button, tooltip, portalContainer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
import { LeaveIcon } from "@livekit/components-react";
|
||||
import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@tensamin/ui";
|
||||
import { Button } from "@tensamin/ui";
|
||||
import { disconnect, useCall } from "../../store";
|
||||
import { type CallButtonProps, iconScale, withTooltip } from "./tooltipButton";
|
||||
|
||||
export default function LeaveButton({
|
||||
className,
|
||||
iconSize,
|
||||
tooltip,
|
||||
portalContainer,
|
||||
}: {
|
||||
className?: string;
|
||||
iconSize?: number;
|
||||
tooltip?: string;
|
||||
portalContainer?: HTMLElement;
|
||||
}) {
|
||||
}: CallButtonProps) {
|
||||
const state = useCall((store) => store.state);
|
||||
|
||||
const button = (
|
||||
|
|
@ -22,20 +18,9 @@ export default function LeaveButton({
|
|||
disabled={state === "closing" || state === "closed"}
|
||||
variant="destructive"
|
||||
>
|
||||
<LeaveIcon style={{ scale: (iconSize ? iconSize + 100 : 100) + "%" }} />
|
||||
<LeaveIcon style={iconScale(iconSize)} />
|
||||
</Button>
|
||||
);
|
||||
|
||||
if (!tooltip) {
|
||||
return button;
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={button} />
|
||||
<TooltipContent portalProps={{ container: portalContainer }}>
|
||||
{tooltip}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
return withTooltip(button, tooltip, portalContainer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@tensamin/ui";
|
||||
import { Button } from "@tensamin/ui";
|
||||
import { toggleMute, useCall } from "../../store";
|
||||
import { Mic, MicOff } from "lucide-react";
|
||||
import { type CallButtonProps, iconScale, withTooltip } from "./tooltipButton";
|
||||
|
||||
export default function MuteButton({
|
||||
className,
|
||||
iconSize,
|
||||
tooltip,
|
||||
portalContainer,
|
||||
}: {
|
||||
className?: string;
|
||||
iconSize?: number;
|
||||
tooltip?: string;
|
||||
portalContainer?: HTMLElement;
|
||||
}) {
|
||||
}: CallButtonProps) {
|
||||
const micEnabled = useCall((state) => state.micEnabled);
|
||||
|
||||
const button = (
|
||||
|
|
@ -22,23 +18,12 @@ export default function MuteButton({
|
|||
onClick={() => void toggleMute()}
|
||||
>
|
||||
{micEnabled ? (
|
||||
<Mic style={{ scale: (iconSize ? iconSize + 100 : 100) + "%" }} />
|
||||
<Mic style={iconScale(iconSize)} />
|
||||
) : (
|
||||
<MicOff style={{ scale: (iconSize ? iconSize + 100 : 100) + "%" }} />
|
||||
<MicOff style={iconScale(iconSize)} />
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
|
||||
if (!tooltip) {
|
||||
return button;
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={button} />
|
||||
<TooltipContent portalProps={{ container: portalContainer }}>
|
||||
{tooltip}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
return withTooltip(button, tooltip, portalContainer);
|
||||
}
|
||||
|
|
|
|||
32
packages/call/src/components/buttons/tooltipButton.tsx
Normal file
32
packages/call/src/components/buttons/tooltipButton.tsx
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { type ReactElement } from "react";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@tensamin/ui";
|
||||
|
||||
export type CallButtonProps = {
|
||||
className?: string;
|
||||
iconSize?: number;
|
||||
tooltip?: string;
|
||||
portalContainer?: HTMLElement;
|
||||
};
|
||||
|
||||
export function iconScale(iconSize?: number) {
|
||||
return { scale: (iconSize ? iconSize + 100 : 100) + "%" };
|
||||
}
|
||||
|
||||
export function withTooltip(
|
||||
button: ReactElement,
|
||||
tooltip?: string,
|
||||
portalContainer?: HTMLElement,
|
||||
) {
|
||||
if (!tooltip) {
|
||||
return button;
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={button} />
|
||||
<TooltipContent portalProps={{ container: portalContainer }}>
|
||||
{tooltip}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ import {
|
|||
import { Track, type Participant } from "livekit-client";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useUser, type User } from "@tensamin/user/context";
|
||||
import { useIsSpeaking } from "../../speakingIndicator";
|
||||
import { useIsSpeaking } from "../../speakingState";
|
||||
import VideoViewer from "../videoViewer";
|
||||
import { HeadphoneOff, MicOff, Monitor, Plus, Shield } from "lucide-react";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue