extract buildReadablePath

This commit is contained in:
FTCHD
2025-08-05 05:24:22 +03:00
parent 58ca8a92fa
commit b3d6d49975
2 changed files with 15 additions and 15 deletions
+1 -15
View File
@@ -5,7 +5,7 @@ import { ask } from '@tauri-apps/plugin-dialog'
import { Trash2Icon } from 'lucide-react'
import { useCallback, useEffect } from 'react'
import { useState } from 'react'
import { formatBytes } from '../../lib/format'
import { buildReadablePath, formatBytes } from '../../lib/format'
import { listJobs, stopJob } from '../../lib/rclone/api'
export default function Jobs() {
@@ -29,20 +29,6 @@ export default function Jobs() {
setIsInitialLoad(false)
}, [])
const buildReadablePath = useCallback((path: string, type: 'short' | 'long' = 'long') => {
if (!path) {
return ''
}
const lastSegment = path.split('\\').slice(-1).join('').split('/').slice(-1).join('')
if (type === 'short') {
return lastSegment
}
return `${path.split(':')[0]}:/.../${lastSegment}`
}, [])
useEffect(() => {
fetchJobs()