{% from "_macros/deferred_icon.html" import deferred_icon %}
{% from "_macros/feed_app_tile.html" import feed_app_tile %}
{% from "_macros/market_button.html" import market_button %}
{% from "_macros/previews.html" import preview_tray %}
{% from "_macros/stars.html" import stars %}
{% macro app_tile(product, feed_app=None, is_detail=False, tray=False, alt_style=False, src=None) %}
{#
product -- market item (app/website)
feed_app - feed-app specific data
is_detail - whether part of a detail page
tray -- whether or not to attach a preview/screenshot tray
alt_style -- is this an alternate representation of the tile (cat hidden, author shown)
src -- if tile is a link, attach a src param for analytics purposes
#}
{% set product = apps.transform(product) %}
{% set name = product.name if is_detail else product.short_name or product.name %}
{% set tag = 'div' if is_detail else 'a' %}
<{{ tag }} class="mkt-tile{{ ' feed-app c' if feed_app }}"
data-slug="{{ product.slug }}" data-id="{{ product.id }}"
{% if not is_detail %}
href="{{ url(product.contentType, [product.key])|urlparams(src=src) }}"
{% endif %}
data-content-type="{{ product.contentType }}"
{{ 'itemscope itemtype="http://schema.org/SoftwareApplication"' if not is_detail }}>
{{ name|translate(product) }}
{% if product.author and (is_detail or alt_style) %}
{# TODO: When we get user profiles, update to be Person itemprop. #}
{% endif %}
{% if not (is_detail or alt_style) %}
{% for cat in product.categories %}
{% endif %}
{% if product.isApp %}
{{ rating_link(is_detail=is_detail) }}
{% endif %}
{# Move the button below the icon/title on website detail. #}
{% if not product.isWebsite or not is_detail %}
{{ market_button(product, data_attrs={
'manifest_url': product.manifest_url,
'source': src,
'slug': product.slug
}) }}
{% endif %}
{{ deferred_icon(product.icons[is_detail and '128' or '64'] or product.icons['64'], name|translate(product)) }}
{{ feed_app_tile(feed_app) if feed_app }}
{{ tag }}>
{% if is_detail %}
{% if product.isWebsite %}
{{ market_button(product, data_attrs={
'manifest_url': product.manifest_url,
'source': src,
'slug': product.slug
}) }}
{% endif %}
{% set notices = [] if product.loading else app_notices(product) %}
{% if notices.length %}