(source: DesktopSource, index: number)
| 84 | }: Pick<SourceSelectorProps, "screenSources" | "windowSources" | "selectedSource" | "loading" | "onSourceSelect">) => { |
| 85 | const t = useScopedT("launch"); |
| 86 | const renderSourceItem = (source: DesktopSource, index: number) => { |
| 87 | const isSelected = selectedSource === source.name; |
| 88 | return ( |
| 89 | <button |
| 90 | key={`${source.id}-${index}`} |
| 91 | type="button" |
| 92 | className={cn( |
| 93 | "source-selector-item group min-h-[46px] w-full rounded-[11px] px-3 py-2.5 text-left font-medium flex items-center justify-start gap-3", |
| 94 | isSelected && "source-selector-item-selected", |
| 95 | )} |
| 96 | onClick={() => onSourceSelect(source)} |
| 97 | > |
| 98 | <div className="relative flex-shrink-0"> |
| 99 | {source.thumbnail ? ( |
| 100 | <img |
| 101 | src={source.thumbnail} |
| 102 | alt="" |
| 103 | className="w-12 h-8 rounded-[8px] object-cover bg-black/50" |
| 104 | onError={(e) => { |
| 105 | (e.target as HTMLImageElement).style.display = "none"; |
| 106 | }} |
| 107 | /> |
| 108 | ) : ( |
| 109 | <div className="source-selector-thumb-fallback w-12 h-8 rounded-[8px] flex items-center justify-center"> |
| 110 | {source.sourceType === "window" ? ( |
| 111 | <AppWindowIcon className="w-5 h-5 source-selector-muted" /> |
| 112 | ) : ( |
| 113 | <MonitorIcon className="w-5 h-5 source-selector-muted" /> |
| 114 | )} |
| 115 | </div> |
| 116 | )} |
| 117 | </div> |
| 118 | |
| 119 | <div className="flex-1 min-w-0 flex flex-col items-start text-left"> |
| 120 | <div className="text-sm font-medium source-selector-text w-full"> |
| 121 | <MarqueeText text={source.windowTitle || source.name} /> |
| 122 | </div> |
| 123 | <div className="text-xs source-selector-subtle truncate w-full text-left"> |
| 124 | {source.sourceType === "screen" ? t("recording.screen") : t("recording.window")} |
| 125 | </div> |
| 126 | </div> |
| 127 | </button> |
| 128 | ); |
| 129 | }; |
| 130 | |
| 131 | const hasAnySources = screenSources.length > 0 || windowSources.length > 0; |
| 132 |
no test coverage detected