Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/www/content/docs/components/response.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ Add Streamdown to your `content` array in your `tailwind.config.js`:

```js title="tailwind.config.js"
module.exports = {
content: [
'./node_modules/streamdown/dist/*.js',
],
content: ["./node_modules/streamdown/dist/*.js"],
// ... rest of your config
}
```
Expand Down
114 changes: 59 additions & 55 deletions apps/www/registry/elevenlabs-ui/examples/mic-selector-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ export default function MicSelectorDemo() {
return (
<div className="flex min-h-[200px] w-full items-center justify-center p-4">
<Card className="m-0 w-full max-w-2xl border p-0 shadow-lg">
<div className="flex items-center justify-between gap-2 p-2">
<div className="h-8 w-[120px] md:h-10 md:w-[200px]">
<div className="flex w-full flex-wrap items-center justify-between gap-2 p-2">
<div className="h-8 w-full min-w-0 flex-1 md:w-[200px] md:flex-none">
<div
className={cn(
"flex h-full items-center gap-2 rounded-md py-1",
"bg-foreground/5 text-foreground/70"
)}
>
<div className="h-full flex-1">
<div className="h-full min-w-0 flex-1">
<div className="relative flex h-full w-full shrink-0 items-center justify-center overflow-hidden rounded-sm">
<LiveWaveform
key={state}
Expand All @@ -149,14 +149,14 @@ export default function MicSelectorDemo() {
/>
{state === "idle" && (
<div className="absolute inset-0 flex items-center justify-center">
<span className="text-foreground/50 text-[10px] font-medium">
<span className="text-foreground/50 text-xs font-medium">
Start Recording
</span>
</div>
)}
{showRecorded && (
<div className="absolute inset-0 flex items-center justify-center">
<span className="text-foreground/50 text-[10px] font-medium">
<span className="text-foreground/50 text-xs font-medium">
Ready to Play
</span>
</div>
Expand All @@ -165,7 +165,7 @@ export default function MicSelectorDemo() {
</div>
</div>
</div>
<div className="flex items-center">
<div className="flex w-full flex-wrap items-center justify-center gap-1 md:w-auto">
<MicSelector
value={selectedDevice}
onValueChange={setSelectedDevice}
Expand All @@ -174,60 +174,64 @@ export default function MicSelectorDemo() {
disabled={state === "recording" || state === "loading"}
/>
<Separator orientation="vertical" className="mx-1 -my-2.5" />
{state === "idle" && (
<Button
variant="ghost"
size="icon"
onClick={startRecording}
disabled={isMuted}
aria-label="Start recording"
>
<Disc className="h-5 w-5" />
</Button>
)}
{(state === "loading" || state === "recording") && (
<Button
variant="ghost"
size="icon"
onClick={stopRecording}
disabled={state === "loading"}
aria-label="Stop recording"
>
<Pause className="h-5 w-5" />
</Button>
)}
{showRecorded && (
<Button
variant="ghost"
size="icon"
onClick={playRecording}
aria-label="Play recording"
>
<Play className="h-5 w-5" />
</Button>
)}
{state === "playing" && (
<div className="flex">
{state === "idle" && (
<Button
variant="ghost"
size="icon"
onClick={startRecording}
disabled={isMuted}
aria-label="Start recording"
>
<Disc className="size-5" />
</Button>
)}
{(state === "loading" || state === "recording") && (
<Button
variant="ghost"
size="icon"
onClick={stopRecording}
disabled={state === "loading"}
aria-label="Stop recording"
>
<Pause className="size-5" />
</Button>
)}
{showRecorded && (
<Button
variant="ghost"
size="icon"
onClick={playRecording}
aria-label="Play recording"
>
<Play className="size-5" />
</Button>
)}
{state === "playing" && (
<Button
variant="ghost"
size="icon"
onClick={pausePlayback}
aria-label="Pause playback"
>
<Pause className="size-5" />
</Button>
)}
<Separator orientation="vertical" className="mx-1 -my-2.5" />
<Button
variant="ghost"
size="icon"
onClick={pausePlayback}
aria-label="Pause playback"
onClick={restart}
disabled={
state === "idle" ||
state === "loading" ||
state === "recording"
}
aria-label="Delete recording"
>
<Pause className="h-5 w-5" />
<Trash2 className="size-5" />
</Button>
)}
<Separator orientation="vertical" className="mx-1 -my-2.5" />
<Button
variant="ghost"
size="icon"
onClick={restart}
disabled={
state === "idle" || state === "loading" || state === "recording"
}
aria-label="Delete recording"
>
<Trash2 className="h-5 w-5" />
</Button>
</div>
</div>
</div>
</Card>
Expand Down
34 changes: 14 additions & 20 deletions apps/www/registry/elevenlabs-ui/ui/bar-visualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,7 @@ export interface BarVisualizerProps extends HTMLAttributes<HTMLDivElement> {
centerAlign?: boolean
}

const BarVisualizerComponent = forwardRef<
HTMLDivElement,
BarVisualizerProps
>(
const BarVisualizerComponent = forwardRef<HTMLDivElement, BarVisualizerProps>(
(
{
state,
Expand Down Expand Up @@ -524,22 +521,19 @@ const Bar = memo<{
Bar.displayName = "Bar"

// Wrap the main component with memo for prop comparison optimization
const BarVisualizer = memo(
BarVisualizerComponent,
(prevProps, nextProps) => {
return (
prevProps.state === nextProps.state &&
prevProps.barCount === nextProps.barCount &&
prevProps.mediaStream === nextProps.mediaStream &&
prevProps.minHeight === nextProps.minHeight &&
prevProps.maxHeight === nextProps.maxHeight &&
prevProps.demo === nextProps.demo &&
prevProps.centerAlign === nextProps.centerAlign &&
prevProps.className === nextProps.className &&
JSON.stringify(prevProps.style) === JSON.stringify(nextProps.style)
)
}
)
const BarVisualizer = memo(BarVisualizerComponent, (prevProps, nextProps) => {
return (
prevProps.state === nextProps.state &&
prevProps.barCount === nextProps.barCount &&
prevProps.mediaStream === nextProps.mediaStream &&
prevProps.minHeight === nextProps.minHeight &&
prevProps.maxHeight === nextProps.maxHeight &&
prevProps.demo === nextProps.demo &&
prevProps.centerAlign === nextProps.centerAlign &&
prevProps.className === nextProps.className &&
JSON.stringify(prevProps.style) === JSON.stringify(nextProps.style)
)
})

BarVisualizerComponent.displayName = "BarVisualizerComponent"
BarVisualizer.displayName = "BarVisualizer"
Expand Down
4 changes: 2 additions & 2 deletions apps/www/registry/elevenlabs-ui/ui/mic-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function MicSelector({
variant="ghost"
size="sm"
className={cn(
"hover:bg-accent flex w-48 cursor-pointer items-center gap-1.5",
"hover:bg-accent flex w-40 min-w-0 shrink cursor-pointer items-center gap-1.5 sm:w-48",
className
)}
disabled={loading || disabled}
Expand All @@ -109,7 +109,7 @@ export function MicSelector({
) : (
<Mic className="h-4 w-4 flex-shrink-0" />
)}
<span className="flex-1 truncate text-left">
<span className="min-w-0 flex-1 truncate text-left text-xs sm:text-sm">
{currentDevice.label}
</span>
<ChevronsUpDown className="h-3 w-3 flex-shrink-0" />
Expand Down
Loading