25 lines
870 B
TypeScript
25 lines
870 B
TypeScript
"use client"
|
|
|
|
import { usePreferences } from "@/contexts/preferences-context"
|
|
|
|
interface SocialWrapperProps {
|
|
type: "comments" | "ratings" | "reviews"
|
|
children: React.ReactNode
|
|
}
|
|
|
|
export function SocialWrapper({ type, children }: SocialWrapperProps) {
|
|
const { preferences, loading } = usePreferences()
|
|
|
|
// Avoid flash of content or layout shift by checking loading?
|
|
// For now, let's just return null if loading to be safe, or maybe render nothing until we know.
|
|
if (loading) return null
|
|
|
|
if (preferences.wiki_mode) return null
|
|
|
|
if (type === "comments" && !preferences.show_comments) return null
|
|
if (type === "ratings" && !preferences.show_ratings) return null
|
|
// For reviews, we assume they are hidden if wiki_mode is on (handled above)
|
|
// or if we add a specific show_reviews preference later.
|
|
|
|
return <>{children}</>
|
|
}
|