mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-11 20:00:23 +01:00
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:
@@ -1,4 +1,4 @@
|
|||||||
import { ExternalLink, MapPin, Calendar, Users } from "lucide-react"
|
import { ExternalLink, MapPin, Calendar } from "lucide-react"
|
||||||
|
|
||||||
interface ProfileSidebarProps {
|
interface ProfileSidebarProps {
|
||||||
user: {
|
user: {
|
||||||
@@ -12,11 +12,10 @@ interface ProfileSidebarProps {
|
|||||||
joinedAt?: string | null
|
joinedAt?: string | null
|
||||||
}
|
}
|
||||||
isLive?: boolean
|
isLive?: boolean
|
||||||
viewerCount?: number
|
|
||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ProfileSidebar({ user, isLive, viewerCount, children }: ProfileSidebarProps) {
|
export function ProfileSidebar({ user, isLive, children }: ProfileSidebarProps) {
|
||||||
const displayName = user.name || user.username
|
const displayName = user.name || user.username
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -70,15 +69,6 @@ export function ProfileSidebar({ user, isLive, viewerCount, children }: ProfileS
|
|||||||
)}
|
)}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
{/* Children (Chat, etc.) */}
|
{/* Children (Chat, etc.) */}
|
||||||
|
|||||||
@@ -166,6 +166,23 @@ export const CloudflareStreamConfig = co.map({
|
|||||||
})
|
})
|
||||||
export type CloudflareStreamConfig = co.loaded<typeof CloudflareStreamConfig>
|
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
|
* Viewer account root - stores any viewer-specific data
|
||||||
*/
|
*/
|
||||||
@@ -180,6 +197,8 @@ export const ViewerRoot = co.map({
|
|||||||
streamRecordings: StreamRecordingList,
|
streamRecordings: StreamRecordingList,
|
||||||
/** Cloudflare Stream configuration */
|
/** Cloudflare Stream configuration */
|
||||||
cloudflareConfig: co.optional(CloudflareStreamConfig),
|
cloudflareConfig: co.optional(CloudflareStreamConfig),
|
||||||
|
/** Stream filter configuration (allowed/blocked apps) */
|
||||||
|
streamFilter: co.optional(StreamFilterConfig),
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -265,7 +265,6 @@ function StreamPage() {
|
|||||||
<ProfileSidebar
|
<ProfileSidebar
|
||||||
user={profileUser}
|
user={profileUser}
|
||||||
isLive={isActuallyLive}
|
isLive={isActuallyLive}
|
||||||
viewerCount={stream?.viewer_count ?? 0}
|
|
||||||
>
|
>
|
||||||
<CommentBox username={username} />
|
<CommentBox username={username} />
|
||||||
</ProfileSidebar>
|
</ProfileSidebar>
|
||||||
@@ -336,7 +335,6 @@ function StreamPage() {
|
|||||||
<ProfileSidebar
|
<ProfileSidebar
|
||||||
user={profileUser}
|
user={profileUser}
|
||||||
isLive={isActuallyLive}
|
isLive={isActuallyLive}
|
||||||
viewerCount={stream?.viewer_count ?? 0}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
47
packages/web/src/routes/api/stream-filter.ts
Normal file
47
packages/web/src/routes/api/stream-filter.ts
Normal 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 })
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user