atmosphere explorer
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add progress counter to car explorer

Juliet 41ce34a4 012867c8

+13 -1
+7 -1
src/views/car/explore.tsx
··· 23 23 export const ExploreToolView = () => { 24 24 const [archive, setArchive] = createSignal<Archive | null>(null); 25 25 const [loading, setLoading] = createSignal(false); 26 + const [progress, setProgress] = createSignal(0); 26 27 const [error, setError] = createSignal<string>(); 27 28 const [view, setView] = createSignal<View>({ type: "repo" }); 28 29 29 30 const parseCarFile = async (file: File) => { 30 31 setLoading(true); 32 + setProgress(0); 31 33 setError(undefined); 32 34 33 35 try { ··· 83 85 record, 84 86 }); 85 87 86 - if (++count % 10000 === 0) await new Promise((resolve) => setTimeout(resolve, 0)); 88 + if (++count % 10000 === 0) { 89 + setProgress(count); 90 + await new Promise((resolve) => setTimeout(resolve, 0)); 91 + } 87 92 } catch { 88 93 // Skip entries with invalid data 89 94 } ··· 121 126 title="Explore archive" 122 127 subtitle="Upload a CAR file to explore its contents." 123 128 loading={loading()} 129 + progress={progress()} 124 130 error={error()} 125 131 onFileChange={handleFileChange} 126 132 onDrop={handleDrop}
+6
src/views/car/shared.tsx
··· 74 74 title: string; 75 75 subtitle: string; 76 76 loading: boolean; 77 + progress?: number; 77 78 error?: string; 78 79 onFileChange: (e: Event) => void; 79 80 onDrop: (e: DragEvent) => void; ··· 107 108 <span class="text-sm font-medium text-neutral-600 dark:text-neutral-400"> 108 109 Reading CAR file... 109 110 </span> 111 + <Show when={props.progress && props.progress > 0}> 112 + <span class="text-xs text-neutral-500 dark:text-neutral-400"> 113 + {props.progress?.toLocaleString()} records processed 114 + </span> 115 + </Show> 110 116 </div> 111 117 } 112 118 >