@@ -4,7 +4,6 @@ import { Panel } from "./Panel";
44import { PromptHints } from "./PromptHints" ;
55import { Spinner } from "./Spinner" ;
66import { COLOR , ICON } from "../theme" ;
7- import { parseTrackers } from "../../sources/magnet" ;
87import { formatBytes , truncate } from "../../util/format" ;
98
109interface FileSelectionPromptProps {
@@ -32,7 +31,10 @@ export function FileSelectionPrompt({
3231 const [ cursor , setCursor ] = useState ( 0 ) ;
3332
3433 useEffect ( ( ) => {
35- const magnetTrackers = parseTrackers ( magnet ) ;
34+ const magnetTrackers : string [ ] = [ ] ;
35+ try {
36+ new URL ( magnet ) . searchParams . getAll ( "tr" ) . forEach ( ( t ) => magnetTrackers . push ( t ) ) ;
37+ } catch { }
3638 const allTrackers = Array . from ( new Set ( [ ...magnetTrackers , ...trackers ] ) ) ;
3739 const cancel = fetchMetadata (
3840 magnet ,
@@ -103,7 +105,7 @@ export function FileSelectionPrompt({
103105 </ Box >
104106 ) : error ? (
105107 < Box paddingX = { 1 } >
106- < Text color = { COLOR . danger } > { `Error: ${ truncate ( error , width - 12 ) } ` } </ Text >
108+ < Text color = { COLOR . bad } > { `Error: ${ truncate ( error , width - 12 ) } ` } </ Text >
107109 </ Box >
108110 ) : (
109111 < Box flexDirection = "column" width = "100%" >
@@ -112,7 +114,7 @@ export function FileSelectionPrompt({
112114 < Box flexGrow = { 1 } />
113115 < Text color = { COLOR . accent } > { `${ selectedCount } /${ totalCount } files` } </ Text >
114116 </ Box >
115- { viewFiles . map ( ( f , i ) => {
117+ { viewFiles . map ( ( f : { path : string ; length : number } , i : number ) => {
116118 const absIndex = offset + i ;
117119 const isFocused = absIndex === cursor ;
118120 const isSelected = viewSelections [ i ] ;
@@ -121,7 +123,7 @@ export function FileSelectionPrompt({
121123 < Text color = { isFocused ? COLOR . accent : COLOR . text } >
122124 { isFocused ? ICON . pointer : " " }
123125 </ Text >
124- < Text color = { isSelected ? COLOR . success : COLOR . text } >
126+ < Text color = { isSelected ? COLOR . good : COLOR . text } >
125127 { isSelected ? "[x]" : "[ ]" }
126128 </ Text >
127129 < Text > </ Text >
0 commit comments