From 9abe630c77fac7a34440183abd034186f186b860 Mon Sep 17 00:00:00 2001 From: Killua Zoldyck Date: Mon, 17 Oct 2022 13:23:34 +0100 Subject: [PATCH 1/4] FEAT: lang are stackable now. --- pages/index.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pages/index.js b/pages/index.js index 0d0fe72..249828a 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,7 +1,7 @@ import Head from 'next/head' import Image from 'next/image' import styles from '../styles/Home.module.css' -import { useState, useEffect } from 'react'; +import {useRef, useState, useEffect } from 'react'; import SKILLS from '../utils/skills'; import { ProfileCard } from '../components/ProfileCard'; import profiles from '../utils/profiles'; @@ -13,7 +13,8 @@ import Typewriter from 'typewriter-effect'; export default function Home() { const [display, setDisplay] = useState("absolute"); - const [lang, setLang] = useState(); + const [tags , setTags] = useState([]); + const [lang, setLang] = useState([]); // let languages=new Set(); // let langs=Array.from(languages) @@ -84,8 +85,12 @@ export default function Home() {
-
-
{lang}
+ + {lang.map((item)=>{return ( <> +
+
{item}
+ +
{setLang()}}> @@ -94,7 +99,10 @@ export default function Home() {
-
+
+ + )})} +
@@ -110,13 +118,13 @@ export default function Home() {
-
+
{ SKILLS && SKILLS.map((skill, index) => { return ( -
{ setLang(skill.name) }} key={index}> +
{ setLang([...lang,skill.name]) }} key={index}>
{skill.name}
From f71ad6e7c757e9096fab5feca3a03f98ebf4deee Mon Sep 17 00:00:00 2001 From: Killua Zoldyck Date: Tue, 18 Oct 2022 10:32:27 +0100 Subject: [PATCH 2/4] dont mind this --- pages/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pages/index.js b/pages/index.js index 249828a..4c19208 100644 --- a/pages/index.js +++ b/pages/index.js @@ -86,13 +86,15 @@ export default function Home() { - {lang.map((item)=>{return ( <> + {lang.map((item,index)=>{return ( <>
{item}
-
{setLang()}}> +
{ + lang.splice(index, 1); // 2nd parameter means remove one item only + setLang(lang)}}> From 9b7eb561c5c0c50e8039932e405a369e5f861933 Mon Sep 17 00:00:00 2001 From: Killua Zoldyck Date: Tue, 18 Oct 2022 11:23:05 +0100 Subject: [PATCH 3/4] FIX: fixed delete the lang --- pages/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/index.js b/pages/index.js index 4c19208..feb55ec 100644 --- a/pages/index.js +++ b/pages/index.js @@ -86,15 +86,15 @@ export default function Home() { - {lang.map((item,index)=>{return ( <> + {lang.map((item)=>{return ( <>
{item}
{ - lang.splice(index, 1); // 2nd parameter means remove one item only - setLang(lang)}}> + setLang(lang.filter(temp=>temp!=item)); + }}> From 230a4e612e439b5685c818792e9dd455fccf905c Mon Sep 17 00:00:00 2001 From: AmineArif1 Date: Tue, 18 Oct 2022 20:53:46 +0100 Subject: [PATCH 4/4] FIX: Fixed the error (not loading) --- pages/index.js | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/pages/index.js b/pages/index.js index b76e814..2d73eba 100644 --- a/pages/index.js +++ b/pages/index.js @@ -14,35 +14,48 @@ export default function Home() { const [display, setDisplay] = useState("absolute"); const [tags , setTags] = useState([]); - const [lang, setLang] = useState([]); const [profilesList, setProfiles] = useState(); - let languages=new Set(); + //Used to make sure that the inputs in profile.js are consitent for example html is equal to HTML - function checkLang(skill){ - return skill.toUpperCase() == lang.toUpperCase(); - } useEffect(() => { - setLang(lang) - languages.add(lang) let tmpList=[]; - if(typeof(lang) != "undefined") + console.log(tags) + if(tags.length!=0) { + console.log("1"); + profiles.map((data, index) => { - if(data.skills.find(checkLang)) + + let tempBool = true; + tags.forEach(element => { + if(!data.skills.includes(element)){ + tempBool= false; + } + }); + if(tempBool) { tmpList.push(data); } + }) + if(tmpList.length == 0){ + setProfiles([]); + + } + else{ setProfiles(tmpList); + } } else { + console.log("starting"); + setProfiles(profiles); } - }) + },[tags]) useEffect(() => { AOS.init() @@ -103,14 +116,15 @@ export default function Home() { - {lang.map((item)=>{return ( <> + {tags.map((item)=>{return ( <>
{item}
{ - setLang(lang.filter(temp=>temp!=item)); + console.log("repeat me 1") + setTags(tags.filter(temp=>temp!=item)); }}> @@ -143,7 +157,7 @@ export default function Home() { { SKILLS && SKILLS.map((skill, index) => { return ( -
{ setLang([...lang,skill.name]) }} key={index}> +
{console.log("repeat me two"); setTags([...tags,skill.name]) }} key={index}>
{skill.name}