<%- include('partials/header'); %>

<h1>Results for: <%= query %></h1>

	<% if (results) { %>
	<table class="table table-striped table-hover table-responsive text-center text-bg-dark-shade">
		<thead>
			<tr>
				<th scope="col">Name</th>
				<th scope="col">Category</th>
				<th scope="col">Magnet Link</th>
				<th scope="col">Files</th>
				<th scope="col">Size</th>
				<th scope="col">Date</th>
				<th scope="col">Seeders</th>
				<th scope="col">Leechers</th>
			</tr>
		</thead>
		<tbody class="table-group-divider">
		<% results.forEach(result => { %>
				<tr>
					<td class="text-start text-white limit-text"><%= result.name %></td>
					<td class="text-white"><%= functions.getCategory(parseInt(result.category)) %></td>
					<td class="text-white">
						<a class="link-light" href=<%= functions.makeMagnet(result.info_hash, result.name) %>>
							<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
								<path d="M15 12h-4v3h4v-3ZM5 12H1v3h4v-3ZM0 8a8 8 0 1 1 16 0v8h-6V8a2 2 0 1 0-4 0v8H0V8Z"/>
							</svg>
						</a>
					</td>
					<td class="text-white"><%= result.num_files %></td>
					<td class="text-white"><%= functions.bytesToSize(result.size) %></td>
					<td class="text-white"><%= functions.getDate(result.added) %></td>
					<td class="text-white"><%= result.seeders %></td>
					<td class="text-white"><%= result.leechers %></td>
				</tr>
		<% }); %>
		</tbody>
	</table>
	<% } %>

<%- include('partials/footer'); %>