/** * ScriptInfoSection Component * * Displays script information in a card with header (title, description) * and detail cells (shell type, supported platforms, category, author). * Responsive layout: stacks cells on mobile, shows grid on desktop. */ import React from 'react' import { cn } from '../../utils/cn' import { getOSLabel } from '../../utils/os-utils' import { getShellLabel } from '../../utils/shell-utils' /** * Props for author avatar display */ export interface ScriptAuthor { /** Author name */ name: string /** Author initials (used when no photo) */ initials?: string /** URL to author's photo */ photoUrl?: string } /** * Props for ScriptInfoSection component */ export interface ScriptInfoSectionProps { /** Script title/name */ headline: string /** Script description */ subheadline?: string /** Shell type (POWERSHELL, BASH, CMD, etc.) */ shellType?: string /** Array of supported platform strings (windows, darwin, linux, etc.) */ supportedPlatforms?: string[] /** Script category */ category: string /** Author information */ author?: ScriptAuthor /** Additional CSS classes */ className?: string } /** * Formats supported platforms array into a display string * @param platforms - Array of platform strings (e.g., ['windows', 'darwin', 'linux']) * @returns Formatted string (e.g., 'Windows, macOS, Linux') */ function formatSupportedPlatforms(platforms?: string[]): string { if (!platforms || platforms.length === 0) { return 'All Platforms' } return platforms.map((platform) => getOSLabel(platform)).join(', ') } /** * Gets initials from a name * @param name - Full name * @returns Two-letter initials */ function getInitials(name: string): string { const parts = name.trim().split(/\s+/) if (parts.length >= 2) { return `${parts[0][0]}${parts[1][0]}`.toUpperCase() } return name.slice(0, 2).toUpperCase() } /** * InfoCell - Single info cell with label and value */ interface InfoCellProps { label: string value: string avatar?: ScriptAuthor className?: string } function InfoCell({ label, value, avatar, className }: InfoCellProps) { return (
{subheadline}
)}