diff --git a/js/src/features/particles/particle-grid-view.tsx b/js/src/features/particles/particle-grid-view.tsx
index 38e9a8a..5fb569b 100644
--- a/js/src/features/particles/particle-grid-view.tsx
+++ b/js/src/features/particles/particle-grid-view.tsx
@@ -7,9 +7,10 @@ import { StreamCard } from "@/features/particles/stream-card";
interface ParticleGridViewProps {
path: ParticlePath;
+ selectedIndex?: number | null;
}
-export function ParticleGridView({ path }: ParticleGridViewProps) {
+export function ParticleGridView({ path, selectedIndex }: ParticleGridViewProps) {
const { streams, isLoading, networkId } = useStreamParticles(path);
const navigate = useNavigate();
@@ -30,13 +31,16 @@ export function ParticleGridView({ path }: ParticleGridViewProps) {
}
return (
-
- {streams.map((stream) => (
+
+ {streams.map((stream, index) => (
el?.scrollIntoView({ block: "nearest" }) : undefined}
particle={stream}
networkId={networkId}
onClick={() => navigate(`/${networkId}/${stream.id}`)}
+ isSelected={index === selectedIndex}
+ shortcutKey={index < 9 ? index + 1 : undefined}
/>
))}
diff --git a/js/src/features/particles/particle-list-view.tsx b/js/src/features/particles/particle-list-view.tsx
index 86d7a60..8093e5b 100644
--- a/js/src/features/particles/particle-list-view.tsx
+++ b/js/src/features/particles/particle-list-view.tsx
@@ -77,10 +77,14 @@ function StreamRow({
particle,
networkId,
onClick,
+ isSelected,
+ shortcutKey,
}: {
particle: Particle & { type: "stream"; properties: StreamProperties };
networkId: string;
onClick: () => void;
+ isSelected?: boolean;
+ shortcutKey?: number;
}) {
const streamPath = particlePath(networkId, [particle.id]);
const { latestChild } = useLiveLatestChild(streamPath);
@@ -148,8 +152,16 @@ function StreamRow({
tabIndex={0}
onClick={onClick}
onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") onClick(); }}
- className="flex w-full items-center gap-3 px-4 py-3 text-left cursor-pointer transition-colors hover:bg-accent"
+ className={cn(
+ "flex w-full items-center gap-3 px-4 py-3 text-left cursor-pointer transition-colors hover:bg-accent",
+ isSelected && "bg-accent",
+ )}
>
+ {shortcutKey && (
+
+ {shortcutKey}
+
+ )}
@@ -211,12 +223,13 @@ function StreamRow({
interface ParticleListViewProps {
path: ParticlePath;
+ selectedIndex?: number | null;
}
/**
* List of stream particles for a container (network root, folder, etc.).
*/
-export function ParticleListView({ path }: ParticleListViewProps) {
+export function ParticleListView({ path, selectedIndex }: ParticleListViewProps) {
const { streams, isLoading, networkId } = useStreamParticles(path);
const navigate = useNavigate();
@@ -238,13 +251,18 @@ export function ParticleListView({ path }: ParticleListViewProps) {
return (
{streams.map((stream, index) => (
-
+
el?.scrollIntoView({ block: "nearest" }) : undefined}
+ >
navigate(`/${networkId}/${stream.id}`)}
+ isSelected={index === selectedIndex}
+ shortcutKey={index < 9 ? index + 1 : undefined}
/>
- {index < streams.length - 1 && }
+ {index < streams.length - 1 && }
))}
diff --git a/js/src/features/particles/particle-preview.tsx b/js/src/features/particles/particle-preview.tsx
index 733d8e5..7229c15 100644
--- a/js/src/features/particles/particle-preview.tsx
+++ b/js/src/features/particles/particle-preview.tsx
@@ -37,7 +37,7 @@ function TextPreview({ particle }: { particle: Extract
-
+
{truncated}
@@ -100,7 +100,7 @@ function VideoThumbnail({
}
return (
-
+