Skip to content

Commit

Permalink
Merge pull request #50 from ICEI-PUC-Minas-PPLCC-TI/develop
Browse files Browse the repository at this point in the history
Corrigindo erros
  • Loading branch information
andreeluis authored Dec 2, 2023
2 parents 922c9a3 + 1869b30 commit 0365716
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/assets/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ function register(event) {
name: name,
username: username,
email: email,
password: password
password: password,
components: []
}

try {
Expand Down
14 changes: 6 additions & 8 deletions src/projetos/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ async function ShowProjects() {
try {
await LoadProjects();

const textoHTML = projectsList.map(generateHTML).join('');
const filteredProjectsList = filter();

const textoHTML = filteredProjectsList.map(generateHTML).join('');

document.querySelector("#projects").innerHTML = textoHTML;

Expand Down Expand Up @@ -184,18 +186,18 @@ async function deleteProject() {


// SEARCH
document.querySelector('.search-bar').addEventListener('input', search, false);
document.querySelector('.search-bar').addEventListener('input', ShowProjects, false);


function normalizeString(str) {
return str.toLowerCase().normalize('NFD').replace(/\p{Diacritic}/gu, '');
}

function search() {
function filter() {
const query = normalizeString(document.querySelector('.search-bar #search').value);
const difficulty = document.querySelector('#difficulty').value;

const filteredProjects = projectsList.filter(project => {
return projectsList.filter(project => {
const { dificuldade, titulo, categoria, conteudo, autor } = project;
return normalizeString(dificuldade).includes(difficulty) && (
normalizeString(titulo).includes(query) ||
Expand All @@ -204,8 +206,4 @@ function search() {
normalizeString(autor).includes(query)
)
});

const textoHTML = filteredProjects.map(generateHTML).join('');

document.querySelector("#projects").innerHTML = textoHTML;
}

0 comments on commit 0365716

Please sign in to comment.