reformula buscas
Deploy / Deploy (push) Successful in 1m50s
Details
Deploy / Deploy (push) Successful in 1m50s
Details
This commit is contained in:
parent
4aeb373d60
commit
cbdac2fb2b
|
|
@ -0,0 +1,16 @@
|
||||||
|
<div id="preview-modal" class="modal">
|
||||||
|
<div class="modal-background"></div>
|
||||||
|
<div class="modal-card" style="width: 90%; max-width: 800px;">
|
||||||
|
<header class="modal-card-head" style="background-color: #f0f8ff; border-bottom: 1px solid #cfe8fc;">
|
||||||
|
<p class="modal-card-title" id="modal-title" style="color: #205081; font-weight: bold;">Preview</p>
|
||||||
|
<button class="delete" aria-label="close"></button>
|
||||||
|
</header>
|
||||||
|
<section class="modal-card-body p-0" style="height: 500px; background-color: #fff;">
|
||||||
|
<iframe id="preview-iframe" src="" style="width: 100%; height: 100%; border: none;"></iframe>
|
||||||
|
</section>
|
||||||
|
<footer class="modal-card-foot" style="justify-content: flex-end; background-color: #fff; border-top: 1px solid #cfe8fc;">
|
||||||
|
<button class="button" id="close-modal-btn">Fechar</button>
|
||||||
|
<a href="#" id="full-edit-btn" target="_blank" class="button is-info">Abrir</a>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
{% assign projeto = include.project %}
|
||||||
|
|
||||||
|
{% assign filter_instruments = "" %}
|
||||||
|
{% assign filter_samples = "" %}
|
||||||
|
|
||||||
|
{% for track in projeto.tracks %}
|
||||||
|
{% if track.instruments %}
|
||||||
|
{% for inst in track.instruments %}
|
||||||
|
{% assign filter_instruments = filter_instruments | append: inst.instrument_name | append: "," %}
|
||||||
|
{% endfor %}
|
||||||
|
{% elsif track.instrument_name %}
|
||||||
|
{% assign filter_instruments = filter_instruments | append: track.instrument_name | append: "," %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if track.sample %}
|
||||||
|
{% for smp in track.sample %}
|
||||||
|
{% assign filter_samples = filter_samples | append: smp.sample_name | append: "," %}
|
||||||
|
{% endfor %}
|
||||||
|
{% elsif track.sample_name %}
|
||||||
|
{% assign filter_samples = filter_samples | append: track.sample_name | append: "," %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="column is-12-mobile is-6-tablet is-4-desktop is-4-widescreen project-item"
|
||||||
|
data-bpm="{{ projeto.bpm }}"
|
||||||
|
data-plugins="{{ projeto.tags.plugin | join: ',' }}"
|
||||||
|
data-instruments="{{ filter_instruments }}"
|
||||||
|
data-samples="{{ filter_samples }}"
|
||||||
|
data-basslines="{{ projeto.tags.bassline | join: ',' }}"
|
||||||
|
data-automations="{{ projeto.tags.automation | join: ',' }}">
|
||||||
|
|
||||||
|
<div class="card project-card" style="height: 100%; background-color: #f0f8ff; border: 1px solid #cfe8fc; border-radius: 12px; display: flex; flex-direction: column;">
|
||||||
|
|
||||||
|
{% assign file_url = projeto.file | slugify %}
|
||||||
|
{% assign page_url = '../projetos/' | append: file_url | append: '.html' %}
|
||||||
|
|
||||||
|
<a href="{{ page_url }}" style="text-decoration: none; flex: 1; display: flex; flex-direction: column;">
|
||||||
|
<div class="card-content has-text-centered p-4" style="flex: 1; display: flex; flex-direction: column;">
|
||||||
|
|
||||||
|
<div style="width: 50px; height: 50px; background-color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.5rem auto; box-shadow: 0 2px 5px rgba(0,0,0,0.05);">
|
||||||
|
<span class="icon" style="color: #3273dc;"><i class="fa-solid fa-music fa-lg"></i></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="title is-6 mb-2" style="color: #205081; word-break: break-word; font-weight: 700; line-height: 1.2;">
|
||||||
|
{{ projeto.file }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% if projeto.bpm %}
|
||||||
|
<div class="mb-3">
|
||||||
|
<span class="tag is-dark is-rounded is-light" style="font-size: 0.7rem; font-weight: bold; border: 1px solid #ccc;">
|
||||||
|
🎵 {{ projeto.bpm }} BPM
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="mb-3" style="height: 24px;"></div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div style="flex: 1;"></div>
|
||||||
|
|
||||||
|
<div class="tags is-centered is-gapless mb-0 mt-2" style="gap: 4px; justify-content: center;">
|
||||||
|
{% if projeto.tags.plugin.size > 0 %}
|
||||||
|
<span class="tag is-white" style="font-size: 0.65rem; border: 1px solid #deeaf6; color: #5b7da3;">{{ projeto.tags.plugin.size }} plugins</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if filter_instruments.size > 0 %}
|
||||||
|
<span class="tag is-white" style="font-size: 0.65rem; border: 1px solid #deeaf6; color: #5b7da3;">Insts</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<footer class="card-footer" style="border-top: 1px solid #cfe8fc; background-color: #fff; border-radius: 0 0 12px 12px; overflow: hidden;">
|
||||||
|
<a href="#" class="card-footer-item js-open-modal" data-target-url="{{ page_url }}" data-modal-title="Detalhes: {{ projeto.file }}" data-full-btn-text="Ir para Página" data-full-btn-link="{{ page_url }}" style="color: #5b7da3; font-size: 0.8rem; font-weight: 600; border-right: 1px solid #eee; transition: background 0.2s;">Ver</a>
|
||||||
|
{% assign creation_url = '/mmpSearch/creation.html?project=' | append: projeto.file %}
|
||||||
|
{% assign embed_url = creation_url | append: '&embed=true' %}
|
||||||
|
<a href="#" class="card-footer-item js-open-modal" data-target-url="{{ embed_url }}" data-modal-title="Editor: {{ projeto.file }}" data-full-btn-text="Abrir Editor" data-full-btn-link="{{ creation_url }}" style="color: #3273dc; font-size: 0.8rem; font-weight: 600;">Editar</a>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -1,382 +1,270 @@
|
||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
title: MMPSearch - Projetos
|
title: Busca Avançada de Projetos
|
||||||
permalink: /projetos/
|
permalink: /search/
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{% assign list_bpm = "" %}
|
||||||
|
{% assign list_plugins = "" %}
|
||||||
|
{% assign list_instruments = "" %}
|
||||||
|
{% assign list_samples = "" %}
|
||||||
|
|
||||||
|
{% for p in site.data.all %}
|
||||||
|
{% if p.bpm %}{% assign list_bpm = list_bpm | append: p.bpm | append: "|||" %}{% endif %}
|
||||||
|
|
||||||
|
{% for item in p.tags.plugin %}{% if item != "" %}{% assign list_plugins = list_plugins | append: item | append: "|||" %}{% endif %}{% endfor %}
|
||||||
|
|
||||||
|
{% for track in p.tracks %}
|
||||||
|
{% if track.instruments %}
|
||||||
|
{% for inst in track.instruments %}{% assign list_instruments = list_instruments | append: inst.instrument_name | append: "|||" %}{% endfor %}
|
||||||
|
{% elsif track.instrument_name %}
|
||||||
|
{% assign list_instruments = list_instruments | append: track.instrument_name | append: "|||" %}
|
||||||
|
{% endif %}
|
||||||
|
{% if track.sample %}
|
||||||
|
{% for smp in track.sample %}{% assign list_samples = list_samples | append: smp.sample_name | append: "|||" %}{% endfor %}
|
||||||
|
{% elsif track.sample_name %}
|
||||||
|
{% assign list_samples = list_samples | append: track.sample_name | append: "|||" %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% assign unique_bpm = list_bpm | split: "|||" | uniq | sort %}
|
||||||
|
{% assign unique_plugins = list_plugins | split: "|||" | uniq | sort %}
|
||||||
|
{% assign unique_instruments = list_instruments | split: "|||" | uniq | sort %}
|
||||||
|
{% assign unique_samples = list_samples | split: "|||" | uniq | sort %}
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
<div class="publication">
|
<div class="publication">
|
||||||
<div class="container">
|
<div class="container is-fluid">
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div class="tabs is-centered is-boxed is-medium mb-6">
|
<div class="columns mb-5 is-vcentered">
|
||||||
{% include sidebar.html %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="has-text-centered mb-6">
|
|
||||||
<h1 class="title is-3 has-text-grey-dark">📁 Projetos Disponíveis</h1>
|
|
||||||
<p class="subtitle is-6 has-text-grey">
|
|
||||||
Explore, ouça e reutilize projetos da comunidade LMMS.
|
|
||||||
</p>
|
|
||||||
<div style="width: 60px; height: 4px; background-color: #3273dc; margin: 1rem auto; border-radius: 2px;"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="box has-background-white-ter mb-6 p-0" style="border: 1px solid #dbdbdb; overflow: hidden; height: auto !important; min-height: 0 !important;">
|
|
||||||
|
|
||||||
<div class="p-3 is-clickable" id="filter-toggle-btn" style="cursor: pointer; display: flex; align-items: center; justify-content: space-between; background-color: #f5f5f5;">
|
|
||||||
<div class="icon-text has-text-weight-bold has-text-grey-dark">
|
|
||||||
<span class="icon"><i class="fa-solid fa-sliders"></i></span>
|
|
||||||
<span>Filtros, Gêneros & Ordenação</span>
|
|
||||||
</div>
|
|
||||||
<span class="icon transition-icon">
|
|
||||||
<i class="fa-solid fa-chevron-down" id="filter-chevron"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="filter-content" style="display: none; border-top: 1px solid #e8e8e8;">
|
|
||||||
<div class="p-4">
|
|
||||||
<div class="columns is-vcentered is-multiline">
|
|
||||||
|
|
||||||
<div class="column is-narrow">
|
|
||||||
<span class="tag is-info is-light has-text-weight-bold">
|
|
||||||
<i class="fa-solid fa-robot mr-1"></i> Filtro IA:
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="buttons" id="genre-filters">
|
<h1 class="title is-3 has-text-grey-dark">Explorar Projetos</h1>
|
||||||
<button class="button is-small is-rounded is-active is-info" data-genre="all">Todos</button>
|
<p class="subtitle is-6 has-text-grey">Use os filtros laterais para combinar critérios.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow">
|
||||||
<div class="field has-addons" style="flex-wrap: wrap; gap: 5px;">
|
<button id="reset-all-filters" class="button is-danger is-light is-small">
|
||||||
|
<span class="icon"><i class="fa-solid fa-rotate-left"></i></span>
|
||||||
<div class="control has-icons-left">
|
<span>Limpar Todos os Filtros</span>
|
||||||
<div class="select is-small is-rounded">
|
</button>
|
||||||
<select id="star-filter">
|
|
||||||
<option value="all">Todas Dificuldades</option>
|
|
||||||
<option value="5">🔥 Expert (Nível 5)</option>
|
|
||||||
<option value="4">⚡ Avançado (Nível 4)</option>
|
|
||||||
<option value="3">🔷 Intermediário (Nível 3)</option>
|
|
||||||
<option value="2">🟢 Básico (Nível 2)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="icon is-small is-left has-text-warning">
|
|
||||||
<i class="fa-solid fa-star"></i>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control has-icons-left">
|
<div class="columns">
|
||||||
<div class="select is-small is-rounded">
|
|
||||||
<select id="sort-select">
|
|
||||||
<option value="default">Ordem Padrão</option>
|
|
||||||
<option value="stars_desc">⭐ Mais Complexos</option>
|
|
||||||
<option value="stars_asc">⭐ Mais Simples</option>
|
|
||||||
<option value="intensity_desc">🔥 Mais Intensos</option>
|
|
||||||
<option value="intensity_asc">❄️ Mais Calmos</option>
|
|
||||||
<option value="bpm_desc">⚡ BPM (Rápido)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="icon is-small is-left">
|
|
||||||
<i class="fa-solid fa-sort"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control has-icons-left">
|
<div class="column is-3">
|
||||||
<div class="select is-small is-rounded">
|
<div class="box p-3" style="background: #fcfcfc; border: 1px solid #eee;">
|
||||||
<select id="key-filter">
|
|
||||||
<option value="all">🎹 Todos os Tons</option>
|
|
||||||
<option value="C">C (Dó Maior)</option>
|
|
||||||
<option value="Db">Db (Réb Maior)</option>
|
|
||||||
<option value="D">D (Ré Maior)</option>
|
|
||||||
<option value="Eb">Eb (Mib Maior)</option>
|
|
||||||
<option value="E">E (Mi Maior)</option>
|
|
||||||
<option value="F">F (Fá Maior)</option>
|
|
||||||
<option value="Gb">Gb (Solb Maior)</option>
|
|
||||||
<option value="G">G (Sol Maior)</option>
|
|
||||||
<option value="Ab">Ab (Láb Maior)</option>
|
|
||||||
<option value="A">A (Lá Maior)</option>
|
|
||||||
<option value="Bb">Bb (Sib Maior)</option>
|
|
||||||
<option value="B">B (Si Maior)</option>
|
|
||||||
<option value="Cm">Cm (Dó Menor)</option>
|
|
||||||
<option value="C#m">C#m (Dó# Menor)</option>
|
|
||||||
<option value="Dm">Dm (Ré Menor)</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="icon is-small is-left has-text-info">
|
|
||||||
<i class="fa-solid fa-music"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div class="filter-group mb-4">
|
||||||
|
<p class="menu-label has-text-weight-bold mb-2">BPM</p>
|
||||||
|
<div class="field is-grouped is-grouped-multiline">
|
||||||
|
{% for item in unique_bpm %}
|
||||||
|
{% if item != "" %}
|
||||||
|
<div class="control">
|
||||||
|
<label class="checkbox tag is-white" style="border: 1px solid #dbdbdb; cursor: pointer;">
|
||||||
|
<input type="checkbox" class="filter-checkbox" data-category="bpm" value="{{ item }}">
|
||||||
|
{{ item }}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="columns is-multiline" id="projects-container">
|
|
||||||
{% assign project_pages = site.pages | where_exp: "page", "page.path contains 'projetos/'" | sort: "title" %}
|
|
||||||
{% for page in project_pages %}
|
|
||||||
{% if page.url != '/projetos/' %}
|
|
||||||
<div class="column is-12-mobile is-6-tablet is-4-desktop is-3-widescreen project-column">
|
|
||||||
|
|
||||||
<div class="card project-card"
|
|
||||||
data-title="{{ page.title | escape }}"
|
|
||||||
style="height: 100%; background-color: #f0f8ff; border: 1px solid #cfe8fc; border-radius: 12px; display: flex; flex-direction: column; position: relative;">
|
|
||||||
|
|
||||||
<a href="{{ page.url | relative_url }}" style="text-decoration: none; flex: 1; display: flex; flex-direction: column;">
|
|
||||||
<div class="card-content has-text-centered p-4" style="flex: 1; display: flex; flex-direction: column;">
|
|
||||||
|
|
||||||
<div style="width: 50px; height: 50px; background-color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.5rem auto; box-shadow: 0 2px 5px rgba(0,0,0,0.05);">
|
|
||||||
<span class="icon" style="color: #3273dc;">
|
|
||||||
<i class="fa-solid fa-music fa-lg"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="title is-6 mb-2" style="color: #205081; word-break: break-word; font-weight: 700; line-height: 1.2;">
|
|
||||||
{{ page.title | default: page.name | replace: '.html', '' }}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{% if page.bpm %}
|
|
||||||
<div class="mb-3 bpm-container">
|
|
||||||
<span class="tag is-dark is-rounded is-light" style="font-size: 0.7rem; font-weight: bold; border: 1px solid #ccc;">
|
|
||||||
🎵 {{ page.bpm }} BPM
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="mb-3 bpm-container" style="min-height: 24px;"></div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
<div style="flex: 1;"></div>
|
|
||||||
|
|
||||||
{% if page.tags %}
|
|
||||||
<div class="mt-auto pt-2" style="width: 100%; border-top: 1px dashed #eef6fc;">
|
|
||||||
{% for category in page.tags %}
|
|
||||||
{% assign cat_name = category[0] %}
|
|
||||||
{% assign cat_items = category[1] %}
|
|
||||||
|
|
||||||
{% assign ignore_cat = false %}
|
|
||||||
{% if cat_name == 'TAG' or cat_name == 'tag' %}{% assign ignore_cat = true %}{% endif %}
|
|
||||||
|
|
||||||
{% assign has_items = false %}
|
|
||||||
{% for item in cat_items %}{% if item != "" %}{% assign has_items = true %}{% endif %}{% endfor %}
|
|
||||||
|
|
||||||
{% if ignore_cat == false and has_items %}
|
|
||||||
<details class="category-reveal mb-1" style="width: 100%;">
|
|
||||||
<summary class="tag is-white"
|
|
||||||
style="width: 100%; justify-content: space-between; cursor: pointer; border: 1px solid #deeaf6; color: #5b7da3; padding: 2px 8px; min-height: 22px; margin-bottom: 2px;">
|
|
||||||
|
|
||||||
<div style="display: flex; align-items: center; gap: 6px;">
|
|
||||||
<span style="font-size: 0.7rem;">
|
|
||||||
{% if cat_name == 'plugin' %}🔌
|
|
||||||
{% elsif cat_name == 'sample' %}🎤
|
|
||||||
{% elsif cat_name == 'bassline' %}🎹
|
|
||||||
{% elsif cat_name == 'automation' %}🎚️
|
|
||||||
{% else %}🏷️
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
|
||||||
<span style="font-weight: 700; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px;">
|
|
||||||
{{ cat_name }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr class="my-3">
|
||||||
|
|
||||||
<span class="icon is-small" style="font-size: 0.6rem; opacity: 0.7;">
|
<details open>
|
||||||
<i class="fa-solid fa-chevron-down"></i>
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Instrumentos</summary>
|
||||||
</span>
|
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
||||||
</summary>
|
{% for item in unique_instruments %}
|
||||||
|
{% if item != "" %}
|
||||||
<div class="tags is-centered mt-1 mb-2 px-1" style="gap: 3px;">
|
<label class="checkbox is-block mb-1 is-size-7">
|
||||||
{% for tag in cat_items %}
|
<input type="checkbox" class="filter-checkbox" data-category="instruments" value="{{ item }}">
|
||||||
{% if tag != "" %}
|
{{ item }}
|
||||||
{% assign tag_slug = tag | replace: ' ', '+' %}
|
</label>
|
||||||
{% assign search_url = '/search/?q=' | append: tag_slug | relative_url %}
|
|
||||||
|
|
||||||
{% if cat_name == 'plugin' %}{% assign search_url = '/plugin/?plugin=' | append: tag_slug | relative_url %}{% endif %}
|
|
||||||
{% if cat_name == 'sample' %}{% assign search_url = '/sample/?sample=' | append: tag_slug | relative_url %}{% endif %}
|
|
||||||
{% if cat_name == 'bassline' %}{% assign search_url = '/bassline/?bassline=' | append: tag_slug | relative_url %}{% endif %}
|
|
||||||
{% if cat_name == 'automation' %}{% assign search_url = '/automation/?automation=' | append: tag_slug | relative_url %}{% endif %}
|
|
||||||
|
|
||||||
<a href="{{ search_url }}"
|
|
||||||
class="tag is-light is-info clickable-tag"
|
|
||||||
style="font-size: 0.6rem; height: 1.5em; border: 1px solid #cfe8fc; text-decoration: none; padding: 0 6px;">
|
|
||||||
{{ tag | truncate: 18 }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
<hr class="my-3">
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Plugins</summary>
|
||||||
|
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
||||||
|
{% for item in unique_plugins %}
|
||||||
|
{% if item != "" %}
|
||||||
|
<label class="checkbox is-block mb-1 is-size-7">
|
||||||
|
<input type="checkbox" class="filter-checkbox" data-category="plugins" value="{{ item }}">
|
||||||
|
{{ item }}
|
||||||
|
</label>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
</details>
|
||||||
</div>
|
<hr class="my-3">
|
||||||
</a>
|
|
||||||
|
|
||||||
<footer class="card-footer" style="border-top: 1px solid #cfe8fc; background-color: #fff; border-radius: 0 0 12px 12px; overflow: hidden;">
|
<details>
|
||||||
<a href="#" class="card-footer-item js-open-modal"
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Samples</summary>
|
||||||
data-target-url="{{ page.url | relative_url }}"
|
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
||||||
data-modal-title="Detalhes: {{ page.file }}"
|
{% for item in unique_samples %}
|
||||||
data-full-btn-text="Ir para Página"
|
{% if item != "" %}
|
||||||
data-full-btn-link="{{ page.url | relative_url }}"
|
<label class="checkbox is-block mb-1 is-size-7">
|
||||||
style="color: #5b7da3; font-size: 0.8rem; font-weight: 600; border-right: 1px solid #eee; transition: background 0.2s;">
|
<input type="checkbox" class="filter-checkbox" data-category="samples" value="{{ item }}">
|
||||||
Ver
|
{{ item | truncate: 25 }}
|
||||||
</a>
|
</label>
|
||||||
|
|
||||||
{% assign creation_url = '/mmpSearch/creation.html?project=' | append: page.file %}
|
|
||||||
{% assign embed_url = creation_url | append: '&embed=true' %}
|
|
||||||
|
|
||||||
<a href="#" class="card-footer-item js-open-modal"
|
|
||||||
data-target-url="{{ embed_url }}"
|
|
||||||
data-modal-title="Editor: {{ page.file }}"
|
|
||||||
data-full-btn-text="Abrir Editor"
|
|
||||||
data-full-btn-link="{{ creation_url }}"
|
|
||||||
style="color: #3273dc; font-size: 0.8rem; font-weight: 600; transition: background 0.2s;">
|
|
||||||
Editar
|
|
||||||
</a>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
</details>
|
||||||
<br><br>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="preview-modal" class="modal">
|
<div class="column is-9">
|
||||||
<div class="modal-background"></div>
|
<div class="notification is-info is-light mb-4 is-hidden" id="results-count-bar">
|
||||||
<div class="modal-card" style="width: 90%; max-width: 800px;">
|
Encontrados <span id="visible-count" class="has-text-weight-bold">0</span> projetos.
|
||||||
<header class="modal-card-head" style="background-color: #f0f8ff; border-bottom: 1px solid #cfe8fc;">
|
</div>
|
||||||
<p class="modal-card-title" id="modal-title" style="color: #205081; font-weight: bold;">Preview</p>
|
|
||||||
<button class="delete" aria-label="close"></button>
|
<div id="project-list" class="columns is-multiline">
|
||||||
</header>
|
{% for projeto in site.data.all %}
|
||||||
<section class="modal-card-body p-0" style="height: 500px; background-color: #fff;">
|
{% include project-card.html project=projeto %}
|
||||||
<iframe id="preview-iframe" src="" style="width: 100%; height: 100%; border: none;"></iframe>
|
{% endfor %}
|
||||||
</section>
|
</div>
|
||||||
<footer class="modal-card-foot" style="justify-content: flex-end; background-color: #fff; border-top: 1px solid #cfe8fc;">
|
|
||||||
<button class="button" id="close-modal-btn">Fechar</button>
|
<div id="no-results" class="has-text-centered is-hidden mt-6">
|
||||||
<a href="#" id="full-edit-btn" target="_blank" class="button is-info">
|
<span class="icon is-large has-text-grey-light"><i class="fa-solid fa-face-frown fa-3x"></i></span>
|
||||||
<span>Abrir</span>
|
<p class="subtitle mt-3 has-text-grey">Nenhum projeto encontrado com essa combinação.</p>
|
||||||
<span class="icon is-small ml-1"><i class="fa-solid fa-up-right-from-square"></i></span>
|
<button class="button is-small is-info mt-2" onclick="document.getElementById('reset-all-filters').click()">Limpar Filtros</button>
|
||||||
</a>
|
|
||||||
</footer>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
{% include preview-modal.html %}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.project-card:hover {
|
.clickable-summary { cursor: pointer; user-select: none; }
|
||||||
transform: translateY(-5px);
|
.clickable-summary:hover { color: #3273dc; }
|
||||||
box-shadow: 0 8px 20px rgba(50, 115, 220, 0.15);
|
.tag.is-checked { background-color: #3273dc !important; color: #fff !important; border-color: #3273dc !important; }
|
||||||
border-color: #3273dc !important;
|
|
||||||
background-color: #fff !important;
|
|
||||||
}
|
|
||||||
.project-card:hover .title {
|
|
||||||
color: #3273dc !important;
|
|
||||||
}
|
|
||||||
.category-reveal summary {
|
|
||||||
list-style: none;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
.category-reveal summary::-webkit-details-marker { display: none; }
|
|
||||||
.category-reveal summary:hover {
|
|
||||||
background-color: #f8fbff;
|
|
||||||
border-color: #3273dc;
|
|
||||||
}
|
|
||||||
/* Correção para a barra não esticar */
|
|
||||||
.category-reveal {
|
|
||||||
width: 100%;
|
|
||||||
flex-shrink: 0; /* Impede que encolha demais */
|
|
||||||
flex-grow: 0; /* Impede que cresça para preencher espaço vazio */
|
|
||||||
}
|
|
||||||
|
|
||||||
.category-reveal summary {
|
/* Scrollbar fina para os filtros */
|
||||||
list-style: none;
|
.filter-content::-webkit-scrollbar { width: 6px; }
|
||||||
transition: all 0.2s ease;
|
.filter-content::-webkit-scrollbar-track { background: #f1f1f1; }
|
||||||
height: auto !important; /* Força altura automática */
|
.filter-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
|
||||||
min-height: 22px;
|
|
||||||
white-space: normal; /* Permite que o texto quebre se for longo */
|
/* Efeito de hover no card */
|
||||||
display: flex;
|
.project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(50, 115, 220, 0.15); border-color: #3273dc !important; }
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.category-reveal[open] summary {
|
|
||||||
background-color: #eef6fc !important;
|
|
||||||
border-color: #3273dc !important;
|
|
||||||
color: #3273dc !important;
|
|
||||||
}
|
|
||||||
.category-reveal[open] summary .fa-chevron-down { transform: rotate(180deg); }
|
|
||||||
.category-reveal summary .fa-chevron-down { transition: transform 0.2s ease; }
|
|
||||||
.clickable-tag { transition: all 0.2s ease; }
|
|
||||||
.clickable-tag:hover {
|
|
||||||
background-color: #3273dc !important;
|
|
||||||
color: #fff !important;
|
|
||||||
border-color: #3273dc !important;
|
|
||||||
transform: translateY(-1px);
|
|
||||||
}
|
|
||||||
/* Estilo para os botões de filtro */
|
|
||||||
#genre-filters .button {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
transition: all 0.2s;
|
|
||||||
}
|
|
||||||
#genre-filters .button:not(.is-active) {
|
|
||||||
background-color: white;
|
|
||||||
border-color: #dbdbdb;
|
|
||||||
color: #363636;
|
|
||||||
}
|
|
||||||
#genre-filters .button.is-active {
|
|
||||||
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
// ===============================================
|
const checkboxes = document.querySelectorAll('.filter-checkbox');
|
||||||
// 1. CONFIGURAÇÃO VISUAL (MENU E MODAL)
|
const projects = document.querySelectorAll('.project-item');
|
||||||
// ===============================================
|
const resetBtn = document.getElementById('reset-all-filters');
|
||||||
|
const countBar = document.getElementById('results-count-bar');
|
||||||
|
const countSpan = document.getElementById('visible-count');
|
||||||
|
const noResults = document.getElementById('no-results');
|
||||||
|
|
||||||
// --- Lógica do Menu Expansível ---
|
// Estado do Filtro
|
||||||
const filterBtn = document.getElementById('filter-toggle-btn');
|
let activeFilters = {
|
||||||
const filterContent = document.getElementById('filter-content');
|
bpm: [],
|
||||||
const filterChevron = document.getElementById('filter-chevron');
|
instruments: [],
|
||||||
|
plugins: [],
|
||||||
|
samples: []
|
||||||
|
};
|
||||||
|
|
||||||
let isFilterOpen = window.innerWidth > 1024;
|
function updateState() {
|
||||||
|
// Reseta estado
|
||||||
|
activeFilters = { bpm: [], instruments: [], plugins: [], samples: [] };
|
||||||
|
|
||||||
function updateFilterState() {
|
// Lê checkboxes marcados
|
||||||
if(isFilterOpen) {
|
checkboxes.forEach(cb => {
|
||||||
filterContent.style.display = 'block';
|
if (cb.checked) {
|
||||||
filterChevron.style.transform = 'rotate(180deg)';
|
const category = cb.getAttribute('data-category');
|
||||||
|
activeFilters[category].push(cb.value);
|
||||||
|
|
||||||
|
// Estilo visual (para as tags de BPM)
|
||||||
|
if(cb.parentElement.classList.contains('tag')) {
|
||||||
|
cb.parentElement.classList.add('is-checked');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
filterContent.style.display = 'none';
|
if(cb.parentElement.classList.contains('tag')) {
|
||||||
filterChevron.style.transform = 'rotate(0deg)';
|
cb.parentElement.classList.remove('is-checked');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filterContent && filterChevron) updateFilterState();
|
|
||||||
|
|
||||||
if(filterBtn && filterContent) {
|
|
||||||
filterBtn.addEventListener('click', () => {
|
|
||||||
isFilterOpen = !isFilterOpen;
|
|
||||||
updateFilterState();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
applyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Lógica do Modal (Preview) ---
|
function applyFilters() {
|
||||||
|
let visibleCount = 0;
|
||||||
|
|
||||||
|
projects.forEach(project => {
|
||||||
|
// Pega dados do projeto
|
||||||
|
const pBpm = project.getAttribute('data-bpm');
|
||||||
|
const pInsts = project.getAttribute('data-instruments').split(',');
|
||||||
|
const pPlugins = project.getAttribute('data-plugins').split(',');
|
||||||
|
const pSamples = project.getAttribute('data-samples').split(',');
|
||||||
|
|
||||||
|
// Lógica de Filtragem (AND entre categorias, OR dentro da categoria)
|
||||||
|
// Ex: (Guitar OR Bass) AND (120 BPM)
|
||||||
|
|
||||||
|
const matchBpm = activeFilters.bpm.length === 0 || activeFilters.bpm.includes(pBpm);
|
||||||
|
|
||||||
|
const matchInst = activeFilters.instruments.length === 0 ||
|
||||||
|
activeFilters.instruments.some(f => pInsts.includes(f));
|
||||||
|
|
||||||
|
const matchPlugin = activeFilters.plugins.length === 0 ||
|
||||||
|
activeFilters.plugins.some(f => pPlugins.includes(f));
|
||||||
|
|
||||||
|
const matchSample = activeFilters.samples.length === 0 ||
|
||||||
|
activeFilters.samples.some(f => pSamples.includes(f));
|
||||||
|
|
||||||
|
if (matchBpm && matchInst && matchPlugin && matchSample) {
|
||||||
|
project.style.display = 'block';
|
||||||
|
visibleCount++;
|
||||||
|
} else {
|
||||||
|
project.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Atualiza UI de contagem
|
||||||
|
countSpan.textContent = visibleCount;
|
||||||
|
if (visibleCount < projects.length) {
|
||||||
|
countBar.classList.remove('is-hidden');
|
||||||
|
} else {
|
||||||
|
countBar.classList.add('is-hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visibleCount === 0) {
|
||||||
|
noResults.classList.remove('is-hidden');
|
||||||
|
} else {
|
||||||
|
noResults.classList.add('is-hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Event Listeners
|
||||||
|
checkboxes.forEach(cb => {
|
||||||
|
cb.addEventListener('change', updateState);
|
||||||
|
});
|
||||||
|
|
||||||
|
resetBtn.addEventListener('click', () => {
|
||||||
|
checkboxes.forEach(cb => cb.checked = false);
|
||||||
|
updateState();
|
||||||
|
});
|
||||||
|
|
||||||
|
// --- CÓDIGO DO MODAL (Mantido igual) ---
|
||||||
const modal = document.getElementById('preview-modal');
|
const modal = document.getElementById('preview-modal');
|
||||||
const iframe = document.getElementById('preview-iframe');
|
const iframe = document.getElementById('preview-iframe');
|
||||||
const modalTitle = document.getElementById('modal-title');
|
const modalTitle = document.getElementById('modal-title');
|
||||||
const fullEditBtn = document.getElementById('full-edit-btn');
|
const fullEditBtn = document.getElementById('full-edit-btn');
|
||||||
const closeButtons = document.querySelectorAll('.modal-background, .modal-card-head .delete, #close-modal-btn');
|
const closeButtons = document.querySelectorAll('.modal-background, .modal-card-head .delete, #close-modal-btn');
|
||||||
|
|
||||||
function normalizarChaveJS(str) {
|
|
||||||
if (!str) return "";
|
|
||||||
return str.toString().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
function openModal(url, title, btnText, btnLink) {
|
function openModal(url, title, btnText, btnLink) {
|
||||||
if(!modal) return;
|
|
||||||
modalTitle.textContent = title;
|
modalTitle.textContent = title;
|
||||||
iframe.src = url;
|
iframe.src = url;
|
||||||
fullEditBtn.textContent = btnText;
|
fullEditBtn.textContent = btnText;
|
||||||
|
|
@ -384,322 +272,24 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
modal.classList.add('is-active');
|
modal.classList.add('is-active');
|
||||||
document.documentElement.classList.add('is-clipped');
|
document.documentElement.classList.add('is-clipped');
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
if(!modal) return;
|
|
||||||
modal.classList.remove('is-active');
|
modal.classList.remove('is-active');
|
||||||
document.documentElement.classList.remove('is-clipped');
|
document.documentElement.classList.remove('is-clipped');
|
||||||
iframe.src = "";
|
iframe.src = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelectorAll('.js-open-modal').forEach(btn => {
|
document.querySelectorAll('.js-open-modal').forEach(btn => {
|
||||||
btn.addEventListener('click', (e) => {
|
btn.addEventListener('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
openModal(btn.dataset.targetUrl, btn.dataset.modalTitle, btn.dataset.fullBtnText, btn.dataset.fullBtnLink);
|
openModal(btn.dataset.targetUrl, btn.dataset.modalTitle, btn.dataset.fullBtnText, btn.dataset.fullBtnLink);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
iframe.addEventListener('load', () => { try {
|
||||||
|
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
||||||
|
const style = iframeDoc.createElement('style');
|
||||||
|
style.textContent = `.tabs, .navbar, .sidebar-wrapper, .main-header { display: none !important; } .publication { padding-top: 0 !important; } body { background-color: #fff !important; }`;
|
||||||
|
iframeDoc.head.appendChild(style);
|
||||||
|
} catch(e){} });
|
||||||
closeButtons.forEach(el => el.addEventListener('click', closeModal));
|
closeButtons.forEach(el => el.addEventListener('click', closeModal));
|
||||||
document.addEventListener('keydown', (e) => { if (e.key === "Escape") closeModal(); });
|
document.addEventListener('keydown', (e) => { if (e.key === "Escape") closeModal(); });
|
||||||
|
|
||||||
|
|
||||||
// ===============================================
|
|
||||||
// 2. LÓGICA DE DADOS (IA / FILTROS)
|
|
||||||
// ===============================================
|
|
||||||
|
|
||||||
const JSON_URL = '/mmpSearch/src_mmpSearch/saida_analises/db_final_completo.json';
|
|
||||||
|
|
||||||
const cards = document.querySelectorAll('.project-card');
|
|
||||||
const genreContainer = document.getElementById('genre-filters');
|
|
||||||
const sortSelect = document.getElementById('sort-select');
|
|
||||||
const starFilterSelect = document.getElementById('star-filter');
|
|
||||||
const keyFilterSelect = document.getElementById('key-filter'); // CORREÇÃO 1: Pegar referência
|
|
||||||
const projectsContainer = document.getElementById('projects-container');
|
|
||||||
|
|
||||||
let activeGenres = [];
|
|
||||||
let currentMinStars = 'all';
|
|
||||||
|
|
||||||
fetch(JSON_URL)
|
|
||||||
.then(r => r.ok ? r.json() : Promise.reject("Erro JSON"))
|
|
||||||
.then(data => {
|
|
||||||
enrichCards(data);
|
|
||||||
createGenreButtons(data);
|
|
||||||
})
|
|
||||||
.catch(console.warn);
|
|
||||||
|
|
||||||
function renderizarDificuldade(num) {
|
|
||||||
const n = Math.round(num) || 1;
|
|
||||||
let label = "Básico";
|
|
||||||
let icon = "fa-leaf";
|
|
||||||
let colorClass = "is-success";
|
|
||||||
|
|
||||||
if (n >= 4.5) { label = "Expert"; icon = "fa-fire"; colorClass = "is-danger"; }
|
|
||||||
else if (n >= 3.5) { label = "Avançado"; icon = "fa-bolt"; colorClass = "is-warning"; }
|
|
||||||
else if (n >= 2.5) { label = "Intermediário"; icon = "fa-layer-group"; colorClass = "is-info"; }
|
|
||||||
|
|
||||||
return `<span class="tag ${colorClass} is-light is-rounded" title="Complexidade: ${n}/5" style="border: 1px solid rgba(0,0,0,0.1);"><i class="fa-solid ${icon} mr-1"></i> ${label}</span>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function enrichCards(data) {
|
|
||||||
const mapDados = {};
|
|
||||||
|
|
||||||
data.forEach(item => {
|
|
||||||
const k1 = normalizarChaveJS(item.arquivo.replace('.wav','').replace('.mp3',''));
|
|
||||||
mapDados[k1] = item;
|
|
||||||
if(item.dados_projeto?.titulo) mapDados[normalizarChaveJS(item.dados_projeto.titulo)] = item;
|
|
||||||
});
|
|
||||||
|
|
||||||
cards.forEach(card => {
|
|
||||||
const info = mapDados[normalizarChaveJS(card.dataset.title)];
|
|
||||||
|
|
||||||
let genero = "Unknown";
|
|
||||||
let subgenerosLista = []; // CORREÇÃO 2: Array para guardar subgêneros
|
|
||||||
let estrelas = 0;
|
|
||||||
let intensidade = -100;
|
|
||||||
let bpm = 0;
|
|
||||||
let tomHtml = "";
|
|
||||||
let tomRaw = "all";
|
|
||||||
let subTagsHTML = "";
|
|
||||||
|
|
||||||
if (info) {
|
|
||||||
if (info.analise_ia) {
|
|
||||||
genero = info.analise_ia.genero_macro || "Unknown";
|
|
||||||
|
|
||||||
// Captura subgêneros para o Filtro e Visual
|
|
||||||
if (Array.isArray(info.analise_ia.nuvem_tags)) {
|
|
||||||
// Filtro: Pega todas as tags relevantes
|
|
||||||
info.analise_ia.nuvem_tags.forEach(t => {
|
|
||||||
if(t.tag) subgenerosLista.push(t.tag);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Visual: Pega top 2 para mostrar
|
|
||||||
const topTags = info.analise_ia.nuvem_tags.slice(0, 2);
|
|
||||||
topTags.forEach(t => {
|
|
||||||
const scorePercent = Math.round((t.score || 0) * 100);
|
|
||||||
subTagsHTML += `<span class="tag is-white is-rounded border-tag" title="Confiança IA: ${scorePercent}%" style="font-size: 0.65rem; color: #666; margin-right: 2px;">#${t.tag}</span>`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.analise_tecnica) {
|
|
||||||
intensidade = parseFloat(info.analise_tecnica.intensidade_db || -100);
|
|
||||||
bpm = parseFloat(info.analise_tecnica.bpm || 0);
|
|
||||||
estrelas = Math.round(info.analise_tecnica.complexidade?.estrelas || 0);
|
|
||||||
|
|
||||||
if (info.analise_tecnica.tom) {
|
|
||||||
const t = info.analise_tecnica.tom;
|
|
||||||
const e = info.analise_tecnica.escala === 'minor' ? 'm' : '';
|
|
||||||
tomHtml = `<span class="tag is-white is-rounded border-tag" title="Tom detectado">🎹 ${t}${e}</span>`;
|
|
||||||
tomRaw = t + e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
card.dataset.genre = genero;
|
|
||||||
// CORREÇÃO 3: Salva subgêneros no dataset como string separada por vírgula
|
|
||||||
card.dataset.subgenres = subgenerosLista.join(',').toLowerCase();
|
|
||||||
card.dataset.stars = estrelas;
|
|
||||||
card.dataset.intensity = intensidade;
|
|
||||||
card.dataset.bpm_real = bpm;
|
|
||||||
card.dataset.key = tomRaw;
|
|
||||||
|
|
||||||
const bpmContainer = card.querySelector('.bpm-container');
|
|
||||||
if (bpmContainer) {
|
|
||||||
const iaDiv = document.createElement('div');
|
|
||||||
iaDiv.style.display = "flex";
|
|
||||||
iaDiv.style.flexDirection = "column";
|
|
||||||
iaDiv.style.alignItems = "center";
|
|
||||||
iaDiv.style.gap = "6px";
|
|
||||||
iaDiv.className = "mt-3";
|
|
||||||
|
|
||||||
const diffDiv = document.createElement('div');
|
|
||||||
diffDiv.innerHTML = renderizarDificuldade(estrelas);
|
|
||||||
iaDiv.appendChild(diffDiv);
|
|
||||||
|
|
||||||
const tagsRow = document.createElement('div');
|
|
||||||
tagsRow.className = "tags is-centered mb-1";
|
|
||||||
tagsRow.style.gap = "4px";
|
|
||||||
|
|
||||||
if(genero !== "Unknown") {
|
|
||||||
let color = 'is-primary';
|
|
||||||
if(genero === 'Electronic') color = 'is-info';
|
|
||||||
if(genero === 'Hip Hop') color = 'is-warning';
|
|
||||||
if(genero === 'Rock') color = 'is-danger';
|
|
||||||
tagsRow.innerHTML += `<span class="tag ${color} is-light is-rounded" style="font-size: 0.7rem;">🤖 ${genero}</span>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
tagsRow.innerHTML += tomHtml;
|
|
||||||
iaDiv.appendChild(tagsRow);
|
|
||||||
|
|
||||||
if (subTagsHTML) {
|
|
||||||
const subTagsRow = document.createElement('div');
|
|
||||||
subTagsRow.className = "tags is-centered mb-0";
|
|
||||||
subTagsRow.style.flexWrap = "wrap";
|
|
||||||
subTagsRow.innerHTML = subTagsHTML;
|
|
||||||
iaDiv.appendChild(subTagsRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
bpmContainer.innerHTML = '';
|
|
||||||
if(card.dataset.bpm_real > 0) {
|
|
||||||
bpmContainer.innerHTML = `<span class="tag is-dark is-rounded is-light mb-1" style="font-size: 0.7rem; font-weight: bold; border: 1px solid #ccc;">🎵 ${Math.round(card.dataset.bpm_real)} BPM</span>`;
|
|
||||||
}
|
|
||||||
bpmContainer.appendChild(iaDiv);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createGenreButtons(data) {
|
|
||||||
const genres = new Set();
|
|
||||||
|
|
||||||
// Coleta todos os gêneros e subgêneros disponíveis
|
|
||||||
data.forEach(i => {
|
|
||||||
if(i.analise_ia?.genero_macro && i.analise_ia.genero_macro !== "Unknown")
|
|
||||||
genres.add(i.analise_ia.genero_macro);
|
|
||||||
|
|
||||||
if(Array.isArray(i.analise_ia?.nuvem_tags)) {
|
|
||||||
i.analise_ia.nuvem_tags.forEach(t => {
|
|
||||||
if(t.tag) genres.add(t.tag);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Função auxiliar para resetar tudo para "Todos"
|
|
||||||
const resetToAll = () => {
|
|
||||||
activeGenres = [];
|
|
||||||
document.querySelectorAll('#genre-filters .button').forEach(b => {
|
|
||||||
b.classList.remove('is-active', 'is-info');
|
|
||||||
b.classList.add('is-white');
|
|
||||||
});
|
|
||||||
const allBtn = document.querySelector('[data-genre="all"]');
|
|
||||||
if(allBtn) {
|
|
||||||
allBtn.classList.remove('is-white');
|
|
||||||
allBtn.classList.add('is-active', 'is-info');
|
|
||||||
}
|
|
||||||
applyFilters();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Cria os botões
|
|
||||||
Array.from(genres).sort().forEach(g => {
|
|
||||||
const btn = document.createElement('button');
|
|
||||||
btn.className = 'button is-small is-rounded is-white';
|
|
||||||
btn.textContent = g;
|
|
||||||
|
|
||||||
btn.onclick = () => {
|
|
||||||
// 1. Se clicou em um gênero, o botão "Todos" deixa de ser ativo
|
|
||||||
const allBtn = document.querySelector('[data-genre="all"]');
|
|
||||||
if(allBtn) {
|
|
||||||
allBtn.classList.remove('is-active', 'is-info');
|
|
||||||
allBtn.classList.add('is-white');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Lógica de Alternar (Toggle)
|
|
||||||
if (activeGenres.includes(g)) {
|
|
||||||
// Se já está ativo, remove da lista e tira a cor
|
|
||||||
activeGenres = activeGenres.filter(item => item !== g);
|
|
||||||
btn.classList.remove('is-active', 'is-info');
|
|
||||||
btn.classList.add('is-white');
|
|
||||||
} else {
|
|
||||||
// Se não está, adiciona na lista e coloca cor
|
|
||||||
activeGenres.push(g);
|
|
||||||
btn.classList.remove('is-white');
|
|
||||||
btn.classList.add('is-active', 'is-info');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Se a lista ficou vazia (desmarcou tudo), volta para "Todos"
|
|
||||||
if (activeGenres.length === 0) {
|
|
||||||
resetToAll();
|
|
||||||
} else {
|
|
||||||
applyFilters();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
genreContainer.appendChild(btn);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Configura o botão "Todos" (Reset)
|
|
||||||
const allBtn = genreContainer.querySelector('[data-genre="all"]');
|
|
||||||
allBtn.onclick = resetToAll;
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyFilters() {
|
|
||||||
cards.forEach(c => {
|
|
||||||
const currentKey = document.getElementById('key-filter')?.value || 'all';
|
|
||||||
const col = c.closest('.project-column');
|
|
||||||
|
|
||||||
// Pega todos os dados do projeto (Macro + Subs) em minúsculo para comparar
|
|
||||||
const gMacro = (c.dataset.genre || "").toLowerCase();
|
|
||||||
const gSubs = (c.dataset.subgenres || "").toLowerCase();
|
|
||||||
const tagsDoProjeto = gMacro + "," + gSubs;
|
|
||||||
|
|
||||||
const s = parseInt(c.dataset.stars || 0);
|
|
||||||
const k = c.dataset.key || 'all';
|
|
||||||
|
|
||||||
// --- NOVA LÓGICA DE GÊNERO ---
|
|
||||||
let matchG = false;
|
|
||||||
|
|
||||||
// Se a lista estiver vazia, assume "Todos"
|
|
||||||
if (activeGenres.length === 0) {
|
|
||||||
matchG = true;
|
|
||||||
} else {
|
|
||||||
// Verifica se ALGUM dos gêneros selecionados está presente neste projeto
|
|
||||||
// Ex: Se selecionei ["Rock", "Piano"], mostra projetos que tenham Rock OU Piano
|
|
||||||
matchG = activeGenres.some(generoSelecionado => {
|
|
||||||
return tagsDoProjeto.includes(generoSelecionado.toLowerCase());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// -----------------------------
|
|
||||||
|
|
||||||
const matchS = (currentMinStars === 'all' || s === parseInt(currentMinStars));
|
|
||||||
const matchK = (currentKey === 'all' || k === currentKey);
|
|
||||||
|
|
||||||
col.style.display = (matchG && matchS && matchK) ? 'block' : 'none';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(starFilterSelect) {
|
|
||||||
starFilterSelect.addEventListener('change', (e) => {
|
|
||||||
currentMinStars = e.target.value;
|
|
||||||
applyFilters();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// CORREÇÃO 6: Adicionando o Event Listener para o Tom
|
|
||||||
if(keyFilterSelect) {
|
|
||||||
keyFilterSelect.addEventListener('change', () => {
|
|
||||||
applyFilters();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
sortSelect.addEventListener('change', (e) => {
|
|
||||||
const crit = e.target.value;
|
|
||||||
const cols = Array.from(projectsContainer.children);
|
|
||||||
|
|
||||||
cols.sort((a, b) => {
|
|
||||||
const cA = a.querySelector('.project-card');
|
|
||||||
const cB = b.querySelector('.project-card');
|
|
||||||
|
|
||||||
const getVal = (el, k) => parseFloat(el.dataset[k] || 0);
|
|
||||||
|
|
||||||
if(crit === 'stars_desc') return getVal(cB, 'stars') - getVal(cA, 'stars');
|
|
||||||
if(crit === 'stars_asc') return getVal(cA, 'stars') - getVal(cB, 'stars');
|
|
||||||
if(crit === 'bpm_desc') return getVal(cB, 'bpm_real') - getVal(cA, 'bpm_real');
|
|
||||||
if(crit === 'intensity_desc') return getVal(cB, 'intensity') - getVal(cA, 'intensity');
|
|
||||||
if(crit === 'intensity_asc') return getVal(cA, 'intensity') - getVal(cB, 'intensity');
|
|
||||||
|
|
||||||
return cA.dataset.title.localeCompare(cB.dataset.title);
|
|
||||||
});
|
|
||||||
|
|
||||||
cols.forEach(c => projectsContainer.appendChild(c));
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
.transition-icon i {
|
|
||||||
transition: transform 0.3s ease;
|
|
||||||
}
|
|
||||||
.border-tag {
|
|
||||||
border: 1px solid #dbdbdb;
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue