diff --git a/apps/radio/src/components/radio/dj/dj-radio-list.tsx b/apps/radio/src/components/radio/dj/dj-radio-list.tsx index 1173884f..2a6eb2ef 100644 --- a/apps/radio/src/components/radio/dj/dj-radio-list.tsx +++ b/apps/radio/src/components/radio/dj/dj-radio-list.tsx @@ -8,6 +8,7 @@ import { } from "@avoid.quest/ui/components/tabs"; import { cn } from "@avoid.quest/ui/lib/utils"; import { useState } from "react"; +import { AddStationButton } from "@/components/settings/add-station-button"; import type { Radio } from "@/lib/audio"; import { getDjDeckModule } from "@/lib/dj-deck"; import { @@ -162,7 +163,7 @@ function RowList({ isSearch?: boolean; }) { if (items.length === 0) { - return {emptyLabel}; + return }>{emptyLabel}; } return ( diff --git a/apps/radio/src/components/radio/empty-hint.tsx b/apps/radio/src/components/radio/empty-hint.tsx index 7f70d190..f89c6366 100644 --- a/apps/radio/src/components/radio/empty-hint.tsx +++ b/apps/radio/src/components/radio/empty-hint.tsx @@ -5,12 +5,14 @@ import { } from "@avoid.quest/ui/components/empty"; import { cn } from "@avoid.quest/ui/lib/utils"; -/** The compact empty state: an optional faint icon over one line of direction. */ +/** The compact empty state, with an optional icon and action. */ export function EmptyHint({ + action, icon, children, className, }: { + action?: React.ReactNode; icon?: React.ReactNode; children: React.ReactNode; className?: string; @@ -23,6 +25,7 @@ export function EmptyHint({ ) : null} {children} + {action} ); } diff --git a/apps/radio/src/components/radio/node/canvas-hint.tsx b/apps/radio/src/components/radio/node/canvas-hint.tsx index 1f306f4d..048a2065 100644 --- a/apps/radio/src/components/radio/node/canvas-hint.tsx +++ b/apps/radio/src/components/radio/node/canvas-hint.tsx @@ -1,3 +1,4 @@ +import { AddStationButton } from "@/components/settings/add-station-button"; import { isRadioSourceNode, isStripSource, @@ -50,7 +51,10 @@ export function NodeCanvasHint({ } if (!hasFilledSource(graph)) { return ( - + } + className="pointer-events-none absolute inset-x-0 bottom-0 z-10 py-4 md:py-4" + > {firstStep(graph, isPhone)} ); diff --git a/apps/radio/src/components/radio/node/node-rack.test.tsx b/apps/radio/src/components/radio/node/node-rack.test.tsx index 5633af2a..2c124d0e 100644 --- a/apps/radio/src/components/radio/node/node-rack.test.tsx +++ b/apps/radio/src/components/radio/node/node-rack.test.tsx @@ -615,6 +615,7 @@ describe("NodeRack", () => { ); expect(view.getByText("Search to add a station")).toBeTruthy(); + expect(view.getByRole("button", { name: "Add station" })).toBeTruthy(); }); test("a File to pick again after a reload opens its settings from the Rack", () => { diff --git a/apps/radio/src/components/radio/node/node-rack.tsx b/apps/radio/src/components/radio/node/node-rack.tsx index b8a3e0d0..bed222f3 100644 --- a/apps/radio/src/components/radio/node/node-rack.tsx +++ b/apps/radio/src/components/radio/node/node-rack.tsx @@ -6,6 +6,7 @@ import { cn } from "@avoid.quest/ui/lib/utils"; import { IconKey, IconPlaylist } from "@tabler/icons-react"; import { useStore } from "@tanstack/react-store"; import { useId, useState } from "react"; +import { AddStationButton } from "@/components/settings/add-station-button"; import type { Radio } from "@/lib/audio"; import { isSessionRadio } from "@/lib/hooks/use-session-radios"; import { getNodeDefinition } from "@/lib/node-graph/catalogue"; @@ -355,7 +356,9 @@ export function NodeRack({ {graph.nodes.every( (node) => getNodeDefinition(node.type).category === "output" ) ? ( - Search to add a station + } className="py-10"> + Search to add a station + ) : null} {groups.map((group) => ( { await expect( - within(canvasElement).getByText("Search to add a station") + within(canvasElement).getByText( + "Search or paste a link to play a station. Save it to keep it in My stations." + ) ).toBeVisible(); + await expect( + within(canvasElement).getAllByRole("button", { name: "Add station" }) + ).toHaveLength(2); }, }; diff --git a/apps/radio/src/components/radio/single/single-player-station-list.tsx b/apps/radio/src/components/radio/single/single-player-station-list.tsx index ee664602..a69d0bd4 100644 --- a/apps/radio/src/components/radio/single/single-player-station-list.tsx +++ b/apps/radio/src/components/radio/single/single-player-station-list.tsx @@ -2,6 +2,7 @@ import { ScrollArea } from "@avoid.quest/ui/components/scroll-area"; import { cn } from "@avoid.quest/ui/lib/utils"; import { IconWaveSine } from "@tabler/icons-react"; +import { AddStationButton } from "@/components/settings/add-station-button"; import type { Radio } from "@/lib/audio"; import { useHasEnteredViewport } from "@/lib/hooks/use-has-entered-viewport"; import { useRadioMetadata } from "@/lib/hooks/use-radio-metadata"; @@ -162,7 +163,10 @@ export function StationList({ return (
-
{searchBar}
+
+
{searchBar}
+ +
{allRadios.length > 0 ? ( @@ -183,7 +187,10 @@ export function StationList({ ))}
) : ( - Search to add a station + } className="py-10"> + Search or paste a link to play a station. Save it to keep it in My + stations. + )} diff --git a/apps/radio/src/components/radio/single/single-player.test.tsx b/apps/radio/src/components/radio/single/single-player.test.tsx index 2607c7f8..786e7b8e 100644 --- a/apps/radio/src/components/radio/single/single-player.test.tsx +++ b/apps/radio/src/components/radio/single/single-player.test.tsx @@ -131,8 +131,8 @@ if (process.env.RADIO_SINGLE_LINK_REGRESSION === "1") { fireEvent.click( view.getByRole("button", { name: "Options for stream.example" }) ); - expect(view.getByRole("menuitem", { name: "Save" })).toBeTruthy(); - fireEvent.click(view.getByRole("menuitem", { name: "Remove" })); + expect(view.getByRole("menuitem", { name: "Save station" })).toBeTruthy(); + fireEvent.click(view.getByRole("menuitem", { name: "Remove station" })); await waitFor(() => expect(getSessionRadios()).toEqual([])); } ); diff --git a/apps/radio/src/components/settings/add-station-button.tsx b/apps/radio/src/components/settings/add-station-button.tsx new file mode 100644 index 00000000..92f5dca0 --- /dev/null +++ b/apps/radio/src/components/settings/add-station-button.tsx @@ -0,0 +1,34 @@ +import { Button } from "@avoid.quest/ui/components/button"; +import { cn } from "@avoid.quest/ui/lib/utils"; +import { IconPlus } from "@tabler/icons-react"; +import { SettingsButton } from "./settings-button"; + +/** Open the station page without mounting Settings until it is needed. */ +export function AddStationButton({ + iconOnly = false, + className, +}: { + iconOnly?: boolean; + className?: string; +}) { + return ( + +