mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-18 15:26:17 +00:00
fix: first download item progress hidden
This commit is contained in:
@@ -43,6 +43,17 @@ const downloads: React.FC = () => {
|
|||||||
|
|
||||||
const [process, setProcess] = useAtom(runningProcesses);
|
const [process, setProcess] = useAtom(runningProcesses);
|
||||||
|
|
||||||
|
const eta = useMemo(() => {
|
||||||
|
const length = process?.item?.RunTimeTicks || 0;
|
||||||
|
|
||||||
|
if (!process?.speed || !process?.progress) return "";
|
||||||
|
|
||||||
|
const timeLeft =
|
||||||
|
(length - length * (process.progress / 100)) / process.speed;
|
||||||
|
|
||||||
|
return formatNumber(timeLeft / 10000);
|
||||||
|
}, [process]);
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<View className="h-full flex flex-col items-center justify-center -mt-6">
|
<View className="h-full flex flex-col items-center justify-center -mt-6">
|
||||||
@@ -51,16 +62,6 @@ const downloads: React.FC = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downloadedFiles?.length === 0) {
|
|
||||||
return (
|
|
||||||
<View className="h-full flex flex-col items-center justify-center -mt-6">
|
|
||||||
<Text className="text-white text-lg font-bold">
|
|
||||||
No downloaded files
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<View className="px-4 py-4">
|
<View className="px-4 py-4">
|
||||||
@@ -81,13 +82,9 @@ const downloads: React.FC = () => {
|
|||||||
{process.progress.toFixed(0)}%
|
{process.progress.toFixed(0)}%
|
||||||
</Text>
|
</Text>
|
||||||
<Text className="text-xs">{process.speed?.toFixed(2)}x</Text>
|
<Text className="text-xs">{process.speed?.toFixed(2)}x</Text>
|
||||||
{process.startTime && (
|
<View>
|
||||||
<Text className="text-xs">
|
<Text className="text-xs">ETA {eta}</Text>
|
||||||
{formatNumber(
|
</View>
|
||||||
new Date().getTime() - process.startTime.getTime(),
|
|
||||||
)}
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
|||||||
Reference in New Issue
Block a user