<tr{{ attributes }} class="hover:bg-gray-200" id="ad_download_{{ download.id }}">
    <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 truncate">
        <a href="{{ path('app_search_result', {imdbId: download.imdbId, mediaType: download.mediaType}) }}"
           class="mr-1 hover:underline rounded-md"
        >
            {{ download.title }}
        </a>

        {% if download.mediaType == "tvshows" %}
            &mdash; <span class="ml-1">(S{{ download.ptn.season }}E{{ download.ptn.episode }})</span>
        {% endif %}
    </td>

    {% if isWidget == false %}
        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 max-w-[60ch] truncate">
            {{ download.filename }}
        </td>
        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-stone-800 truncate">
            {{ download.mediaType }}
        </td>
    {% endif %}

    <td class="px-6 py-4 whitespace-nowrap text-sm align-middle text-gray-800 dark:text-gray-50">
        {% if download.progress < 100 %}
            <div id="download_progress_{{ download.id }}" class="border-2 border-green-600 rounded-md text-center w-full h-6 align-middle overflow-hidden">
                <div class="text-black text-center rounded-sm text-bold bg-green-300 h-5 relative z-10"
                     style="width:{{ download.progress }}%">
                </div>
                <div class="absolute text-black text-center" style="z-index: 400;margin-top: -1.25rem; margin-left: 1.2rem">{{ download.progress }}%</div>
            </div>
        {% else %}
            <twig:StatusBadge color="green" status="Complete" />
        {% endif %}
    </td>
    <td id="action_buttons_{{ download.id }}" class="px-6 py-4 flex flex-row items-center">
        {% if download.status == 'In Progress' and download.progress < 100 %}
            <button id="pause_{{ download.id }}" class="text-orange-500 hover:text-orange-600 mr-1 self-start" {{ stimulus_action('download_list', 'pauseDownload', 'click', {id: download.id}) }}>
                <twig:ux:icon name="icon-park-twotone:pause-one" width="16.75px" height="16.75px" class="rounded-full" />
            </button>
        {% elseif download.status == 'Paused' %}
            <button id="resume_{{ download.id }}" class="text-orange-500 hover:text-orange-600 mr-1 self-start" {{ stimulus_action('download_list', 'resumeDownload', 'click', {id: download.id}) }}>
                <twig:ux:icon name="icon-park-twotone:play" width="16.75px" height="16.75px" class="rounded-full" />
            </button>
        {% endif %}

        {% set delete_button = component('ux:icon', {name: 'ic:twotone-cancel', height: '17.75px', width: '17.75px', class: 'rounded-full align-middle text-red-600 hover:text-red-700' }) %}
        <twig:Modal heading="But wait!" button_text="{{ delete_button }}" submit_action="{{ stimulus_action('download_list', 'deleteDownload', 'click', {id: download.id}) }}" show_cancel show_submit>
            Are you sure you want to delete <span class="font-bold">{{ download.filename }}</span>?
        </twig:Modal>
    </td>
</tr>