71 lines
3.1 KiB
HTML
71 lines
3.1 KiB
HTML
{# Tool card macro #}
|
|
{% macro tool_card(tool=none, owner=none, name=none, description=none, category=none, downloads=none, version=none) %}
|
|
{% if tool is none %}
|
|
{% set tool = {
|
|
"owner": owner,
|
|
"name": name,
|
|
"description": description,
|
|
"category": category,
|
|
"downloads": downloads,
|
|
"version": version
|
|
} %}
|
|
{% endif %}
|
|
<article class="bg-white rounded-lg border border-gray-200 shadow-sm hover:shadow-md transition-shadow p-4 relative">
|
|
<!-- Category badge -->
|
|
{% if tool.category %}
|
|
<span class="absolute top-3 right-3 px-2 py-1 bg-cyan-500 text-white text-xs font-medium rounded">
|
|
{{ tool.category }}
|
|
</span>
|
|
{% endif %}
|
|
|
|
<!-- Tool icon and name -->
|
|
<div class="flex items-start space-x-3">
|
|
<div class="flex-shrink-0 w-10 h-10 bg-indigo-100 rounded-full flex items-center justify-center">
|
|
<span class="text-indigo-600 font-bold text-sm">{{ tool.name[0]|upper }}</span>
|
|
</div>
|
|
<div class="flex-1 min-w-0">
|
|
<h3 class="text-lg font-semibold text-gray-900 truncate">
|
|
<a href="{{ url_for('web.tool_detail', owner=tool.owner, name=tool.name) }}"
|
|
class="hover:text-indigo-600 transition-colors">
|
|
{{ tool.name }}
|
|
</a>
|
|
</h3>
|
|
<p class="text-sm text-gray-500">by {{ tool.owner }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Description -->
|
|
<p class="mt-3 text-sm text-gray-600 line-clamp-2">
|
|
{{ tool.description or 'No description available.' }}
|
|
</p>
|
|
|
|
<!-- Meta info -->
|
|
<div class="mt-4 flex items-center justify-between text-sm text-gray-500">
|
|
<span class="flex items-center">
|
|
<svg class="w-4 h-4 mr-1 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/>
|
|
</svg>
|
|
{{ tool.downloads|default(0) }} downloads
|
|
</span>
|
|
<span class="text-xs text-gray-400">v{{ tool.version }}</span>
|
|
</div>
|
|
|
|
<!-- Install command -->
|
|
<div class="mt-4">
|
|
<div class="flex items-center bg-gray-100 rounded px-3 py-2 group">
|
|
<code class="text-xs text-gray-700 flex-1 truncate font-mono">
|
|
smarttools install {{ tool.owner }}/{{ tool.name }}
|
|
</code>
|
|
<button type="button"
|
|
onclick="copyToClipboard('smarttools install {{ tool.owner }}/{{ tool.name }}')"
|
|
class="ml-2 p-1 text-gray-400 hover:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity"
|
|
aria-label="Copy install command">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
{% endmacro %}
|