Improve stream sidebar experience and avatar affordance #284

Merged
talksik merged 5 commits from experience-nits into main 2026-06-13 18:39:29 +00:00
2 changed files with 5 additions and 21 deletions
Showing only changes of commit 3175b04d3c - Show all commits
@@ -213,10 +213,7 @@ function StreamViewInner({ path, streamParticle }: StreamViewProps) {
});
const userId = useAuthStore((s) => s.user?.id);
const { mode, toggle: toggleViewMode } = useStreamViewMode(
streamParticle,
userId,
);
const { mode, toggle: toggleViewMode } = useStreamViewMode();
const {
children,
+4 -17
View File
@@ -1,24 +1,11 @@
import { useCallback, useState } from 'react';
import type { Particle } from '@/api/types';
export type StreamViewMode = 'player' | 'list';
// Deprecated: now we always start with player mode
function decideMode(
streamParticle: Particle & { type: 'stream' },
userId: string | undefined,
): StreamViewMode {
const marker = userId ? streamParticle.playback_markers?.[userId] : undefined;
const lastChildAt = streamParticle.last_child_created_at;
const caughtUp =
!!marker && !!lastChildAt && lastChildAt.getTime() <= marker.getTime();
return caughtUp ? 'list' : 'player';
}
export function useStreamViewMode(
streamParticle: Particle & { type: 'stream' },
userId: string | undefined,
): { mode: StreamViewMode; toggle: () => void } {
export function useStreamViewMode(): {
mode: StreamViewMode;
toggle: () => void;
} {
const [mode, setMode] = useState<StreamViewMode>('player');
const toggle = useCallback(() => {
setMode((prev) => (prev === 'player' ? 'list' : 'player'));