reformula buscas
Deploy / Deploy (push) Successful in 1m26s Details

This commit is contained in:
JotaChina 2025-12-16 17:08:18 -03:00
parent 24b38ca3ff
commit 2a844bbf0a
1 changed files with 144 additions and 22 deletions

View File

@ -1,6 +1,6 @@
--- ---
layout: default layout: default
title: Busca Avançada de Projetos title: MMPSearch - Projetos
permalink: /projetos/ permalink: /projetos/
--- ---
@ -8,12 +8,22 @@ permalink: /projetos/
{% assign list_plugins = "" %} {% assign list_plugins = "" %}
{% assign list_instruments = "" %} {% assign list_instruments = "" %}
{% assign list_samples = "" %} {% assign list_samples = "" %}
{% assign list_bassline = "" %}
{% assign list_automation = "" %}
{% for p in site.data.all %} {% for p in site.data.all %}
{% if p.bpm %}{% assign list_bpm = list_bpm | append: p.bpm | append: "|||" %}{% endif %} {% 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 item in p.tags.plugin %}{% if item != "" %}{% assign list_plugins = list_plugins | append: item | append: "|||" %}{% endif %}{% endfor %}
{% if p.tags.bassline %}
{% for item in p.tags.bassline %}{% if item != "" %}{% assign list_bassline = list_bassline | append: item | append: "|||" %}{% endif %}{% endfor %}
{% endif %}
{% if p.tags.automation %}
{% for item in p.tags.automation %}{% if item != "" %}{% assign list_automation = list_automation | append: item | append: "|||" %}{% endif %}{% endfor %}
{% endif %}
{% for track in p.tracks %} {% for track in p.tracks %}
{% if track.instruments %} {% if track.instruments %}
{% for inst in track.instruments %}{% assign list_instruments = list_instruments | append: inst.instrument_name | append: "|||" %}{% endfor %} {% for inst in track.instruments %}{% assign list_instruments = list_instruments | append: inst.instrument_name | append: "|||" %}{% endfor %}
@ -32,6 +42,8 @@ permalink: /projetos/
{% assign unique_plugins = list_plugins | split: "|||" | uniq | sort %} {% assign unique_plugins = list_plugins | split: "|||" | uniq | sort %}
{% assign unique_instruments = list_instruments | split: "|||" | uniq | sort %} {% assign unique_instruments = list_instruments | split: "|||" | uniq | sort %}
{% assign unique_samples = list_samples | split: "|||" | uniq | sort %} {% assign unique_samples = list_samples | split: "|||" | uniq | sort %}
{% assign unique_bassline = list_bassline | split: "|||" | uniq | sort %}
{% assign unique_automation = list_automation | split: "|||" | uniq | sort %}
<main class="main-content"> <main class="main-content">
<div class="publication"> <div class="publication">
@ -41,7 +53,7 @@ permalink: /projetos/
<div class="columns mb-5 is-vcentered"> <div class="columns mb-5 is-vcentered">
<div class="column"> <div class="column">
<h1 class="title is-3 has-text-grey-dark">Explorar Projetos</h1> <h1 class="title is-3 has-text-grey-dark">Explorar Projetos</h1>
<p class="subtitle is-6 has-text-grey">Use os filtros laterais para combinar critérios.</p> <p class="subtitle is-6 has-text-grey">Use os filtros laterais para combinar critérios (ex: Bassline Reese + 140 BPM).</p>
</div> </div>
<div class="column is-narrow"> <div class="column is-narrow">
<button id="reset-all-filters" class="button is-danger is-light is-small"> <button id="reset-all-filters" class="button is-danger is-light is-small">
@ -103,6 +115,36 @@ permalink: /projetos/
</details> </details>
<hr class="my-3"> <hr class="my-3">
<details>
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Bassline</summary>
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
{% for item in unique_bassline %}
{% if item != "" %}
<label class="checkbox is-block mb-1 is-size-7">
<input type="checkbox" class="filter-checkbox" data-category="bassline" value="{{ item }}">
{{ item }}
</label>
{% endif %}
{% endfor %}
</div>
</details>
<hr class="my-3">
<details>
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Automação</summary>
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
{% for item in unique_automation %}
{% if item != "" %}
<label class="checkbox is-block mb-1 is-size-7">
<input type="checkbox" class="filter-checkbox" data-category="automation" value="{{ item }}">
{{ item }}
</label>
{% endif %}
{% endfor %}
</div>
</details>
<hr class="my-3">
<details> <details>
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Samples</summary> <summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Samples</summary>
<div class="filter-content" style="max-height: 200px; overflow-y: auto;"> <div class="filter-content" style="max-height: 200px; overflow-y: auto;">
@ -127,7 +169,67 @@ permalink: /projetos/
<div id="project-list" class="columns is-multiline"> <div id="project-list" class="columns is-multiline">
{% for projeto in site.data.all %} {% for projeto in site.data.all %}
{% include project-card.html project=projeto %}
{% assign project_insts = "" %}
{% assign project_samples = "" %}
{% for track in projeto.tracks %}
{% if track.instruments %}
{% for inst in track.instruments %}{% assign project_insts = project_insts | append: inst.instrument_name | append: "," %}{% endfor %}
{% elsif track.instrument_name %}
{% assign project_insts = project_insts | append: track.instrument_name | append: "," %}
{% endif %}
{% if track.sample %}
{% for smp in track.sample %}{% assign project_samples = project_samples | append: smp.sample_name | append: "," %}{% endfor %}
{% elsif track.sample_name %}
{% assign project_samples = project_samples | append: track.sample_name | append: "," %}
{% endif %}
{% endfor %}
<div class="column is-12-mobile is-6-tablet is-4-desktop is-3-widescreen project-item"
data-bpm="{{ projeto.bpm }}"
data-plugins="{{ projeto.tags.plugin | join: ',' }}"
data-bassline="{{ projeto.tags.bassline | join: ',' }}"
data-automation="{{ projeto.tags.automation | join: ',' }}"
data-instruments="{{ project_insts }}"
data-samples="{{ project_samples }}">
<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 | downcase | replace: ' ', '-' | replace: 'ç', 'c' | replace: 'ã', 'a' | replace: 'á', 'a' | replace: 'â', 'a' | replace: 'é', 'e' | replace: 'ê', 'e' | replace: 'í', 'i' | replace: 'ó', 'o' | replace: 'ô', 'o' | replace: 'õ', 'o' | replace: 'ú', 'u' %}
{% 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>
</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>
{% endfor %} {% endfor %}
</div> </div>
@ -173,18 +275,22 @@ document.addEventListener('DOMContentLoaded', function () {
bpm: [], bpm: [],
instruments: [], instruments: [],
plugins: [], plugins: [],
samples: [] samples: [],
bassline: [],
automation: []
}; };
function updateState() { function updateState() {
// Reseta estado // Reseta estado local
activeFilters = { bpm: [], instruments: [], plugins: [], samples: [] }; activeFilters = { bpm: [], instruments: [], plugins: [], samples: [], bassline: [], automation: [] };
// Lê checkboxes marcados // Lê checkboxes marcados
checkboxes.forEach(cb => { checkboxes.forEach(cb => {
if (cb.checked) { if (cb.checked) {
const category = cb.getAttribute('data-category'); const category = cb.getAttribute('data-category');
activeFilters[category].push(cb.value); if (activeFilters[category]) {
activeFilters[category].push(cb.value);
}
// Estilo visual (para as tags de BPM) // Estilo visual (para as tags de BPM)
if(cb.parentElement.classList.contains('tag')) { if(cb.parentElement.classList.contains('tag')) {
@ -204,14 +310,15 @@ document.addEventListener('DOMContentLoaded', function () {
let visibleCount = 0; let visibleCount = 0;
projects.forEach(project => { projects.forEach(project => {
// Pega dados do projeto // Pega dados do projeto (usando strings vazias como fallback)
const pBpm = project.getAttribute('data-bpm'); const pBpm = project.getAttribute('data-bpm') || "";
const pInsts = project.getAttribute('data-instruments').split(','); const pInsts = (project.getAttribute('data-instruments') || "").split(',');
const pPlugins = project.getAttribute('data-plugins').split(','); const pPlugins = (project.getAttribute('data-plugins') || "").split(',');
const pSamples = project.getAttribute('data-samples').split(','); const pSamples = (project.getAttribute('data-samples') || "").split(',');
const pBassline = (project.getAttribute('data-bassline') || "").split(',');
const pAutomation = (project.getAttribute('data-automation') || "").split(',');
// Lógica de Filtragem (AND entre categorias, OR dentro da categoria) // Lógica de Filtragem (AND entre categorias)
// Ex: (Guitar OR Bass) AND (120 BPM)
const matchBpm = activeFilters.bpm.length === 0 || activeFilters.bpm.includes(pBpm); const matchBpm = activeFilters.bpm.length === 0 || activeFilters.bpm.includes(pBpm);
@ -224,7 +331,13 @@ document.addEventListener('DOMContentLoaded', function () {
const matchSample = activeFilters.samples.length === 0 || const matchSample = activeFilters.samples.length === 0 ||
activeFilters.samples.some(f => pSamples.includes(f)); activeFilters.samples.some(f => pSamples.includes(f));
if (matchBpm && matchInst && matchPlugin && matchSample) { const matchBassline = activeFilters.bassline.length === 0 ||
activeFilters.bassline.some(f => pBassline.includes(f));
const matchAutomation = activeFilters.automation.length === 0 ||
activeFilters.automation.some(f => pAutomation.includes(f));
if (matchBpm && matchInst && matchPlugin && matchSample && matchBassline && matchAutomation) {
project.style.display = 'block'; project.style.display = 'block';
visibleCount++; visibleCount++;
} else { } else {
@ -253,7 +366,12 @@ document.addEventListener('DOMContentLoaded', function () {
}); });
resetBtn.addEventListener('click', () => { resetBtn.addEventListener('click', () => {
checkboxes.forEach(cb => cb.checked = false); checkboxes.forEach(cb => {
cb.checked = false;
if(cb.parentElement.classList.contains('tag')) {
cb.parentElement.classList.remove('is-checked');
}
});
updateState(); updateState();
}); });
@ -265,6 +383,7 @@ document.addEventListener('DOMContentLoaded', function () {
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 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;
@ -273,6 +392,7 @@ document.addEventListener('DOMContentLoaded', function () {
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 = "";
@ -283,12 +403,14 @@ document.addEventListener('DOMContentLoaded', function () {
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 { if(iframe) {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; iframe.addEventListener('load', () => { try {
const style = iframeDoc.createElement('style'); const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
style.textContent = `.tabs, .navbar, .sidebar-wrapper, .main-header { display: none !important; } .publication { padding-top: 0 !important; } body { background-color: #fff !important; }`; const style = iframeDoc.createElement('style');
iframeDoc.head.appendChild(style); style.textContent = `.tabs, .navbar, .sidebar-wrapper, .main-header { display: none !important; } .publication { padding-top: 0 !important; } body { background-color: #fff !important; }`;
} catch(e){} }); 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(); });
}); });