Fix: Remove unused viewerCount prop from ProfileSidebar and update related code

- Removed viewerCount from ProfileSidebarProps and component parameters
- Commented out viewerCount usage in ProfileSidebar component
- Updated import statement to exclude unused icons
- Removed viewerCount prop from StreamPage component instances in $username.tsx
This commit is contained in:
Nikita
2025-12-25 10:10:42 -08:00
parent 95f4270f9a
commit 9aecbab8a9
4 changed files with 68 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
import { ExternalLink, MapPin, Calendar, Users } from "lucide-react"
import { ExternalLink, MapPin, Calendar } from "lucide-react"
interface ProfileSidebarProps {
user: {
@@ -12,11 +12,10 @@ interface ProfileSidebarProps {
joinedAt?: string | null
}
isLive?: boolean
viewerCount?: number
children?: React.ReactNode
}
export function ProfileSidebar({ user, isLive, viewerCount, children }: ProfileSidebarProps) {
export function ProfileSidebar({ user, isLive, children }: ProfileSidebarProps) {
const displayName = user.name || user.username
return (
@@ -70,15 +69,6 @@ export function ProfileSidebar({ user, isLive, viewerCount, children }: ProfileS
)}
</div>
{/* Stats */}
{isLive && viewerCount !== undefined && (
<div className="mt-3 flex items-center gap-2 text-sm">
<span className="flex items-center gap-1.5 text-white/70">
<Users className="w-4 h-4 text-red-400" />
<span className="font-medium text-white">{viewerCount}</span> watching
</span>
</div>
)}
</div>
{/* Children (Chat, etc.) */}

View File

@@ -166,6 +166,23 @@ export const CloudflareStreamConfig = co.map({
})
export type CloudflareStreamConfig = co.loaded<typeof CloudflareStreamConfig>
/**
* Stream filter configuration - dynamically controls what apps are captured
*/
export const StreamFilterConfig = co.map({
/** Apps allowed to appear in stream (empty = all allowed) */
allowedApps: z.array(z.string()),
/** Apps blocked from stream (takes precedence over allowed) */
blockedApps: z.array(z.string()),
/** Apps to capture audio from */
audioApps: z.array(z.string()),
/** Last updated timestamp */
updatedAt: z.number(),
/** Version number for change tracking */
version: z.number(),
})
export type StreamFilterConfig = co.loaded<typeof StreamFilterConfig>
/**
* Viewer account root - stores any viewer-specific data
*/
@@ -180,6 +197,8 @@ export const ViewerRoot = co.map({
streamRecordings: StreamRecordingList,
/** Cloudflare Stream configuration */
cloudflareConfig: co.optional(CloudflareStreamConfig),
/** Stream filter configuration (allowed/blocked apps) */
streamFilter: co.optional(StreamFilterConfig),
})
/**

View File

@@ -265,7 +265,6 @@ function StreamPage() {
<ProfileSidebar
user={profileUser}
isLive={isActuallyLive}
viewerCount={stream?.viewer_count ?? 0}
>
<CommentBox username={username} />
</ProfileSidebar>
@@ -336,7 +335,6 @@ function StreamPage() {
<ProfileSidebar
user={profileUser}
isLive={isActuallyLive}
viewerCount={stream?.viewer_count ?? 0}
/>
</div>
</div>

View File

@@ -0,0 +1,47 @@
import { json } from "@tanstack/react-start"
import type { APIContext } from "@tanstack/react-router"
/**
* Get or update stream filter configuration (allowed/blocked apps)
*
* GET: Returns current filter config from Jazz (or hardcoded default)
* PUT: Updates filter config in Jazz
*/
// Hardcoded default for nikiv (will be in Jazz later)
const DEFAULT_FILTER = {
allowedApps: ["zed", "cursor", "xcode", "safari", "warp", "warpPreview"],
blockedApps: ["1password", "keychain", "telegram"],
audioApps: ["spotify", "arc"],
version: 1,
updatedAt: Date.now(),
}
export async function GET({ request }: APIContext) {
try {
// TODO: Read from Jazz when worker is set up
return json(DEFAULT_FILTER)
} catch (error) {
return json({ error: "Failed to fetch filter config" }, { status: 500 })
}
}
export async function PUT({ request }: APIContext) {
try {
const body = await request.json()
const { allowedApps, blockedApps, audioApps } = body
// TODO: Write to Jazz when worker is set up
// For now, return the updated config
return json({
success: true,
allowedApps: allowedApps || [],
blockedApps: blockedApps || [],
audioApps: audioApps || [],
version: DEFAULT_FILTER.version + 1,
updatedAt: Date.now(),
})
} catch (error) {
return json({ error: "Failed to update filter config" }, { status: 500 })
}
}