.turbo-progress-bar {
height: 4px;
background: linear-gradient(
90deg,
var(--progress-start, #6366f1),
var(--progress-end, #ec4899)
export interface UploadHandle {
promise: Promise<{ status: number; body: string }>;
xhr: XMLHttpRequest;
}
export function uploadFile(
class Import < ApplicationRecord
include ActionView::RecordIdentifier
enum status: { pending: 0, processing: 1, completed: 2, failed: 3 }
has_one_attached :file
class ImportRun < ApplicationRecord
enum status: { pending: 0, running: 1, completed: 2, failed: 3 }
def percent
return 0 if total.to_i.zero?
[(processed.to_f / total * 100).round, 100].min