From 6fb40a4ab460d5dadbb0239cec00f7b897a98365 Mon Sep 17 00:00:00 2001 From: Emanuels Zaurins Date: Mon, 1 Sep 2025 15:16:30 +0200 Subject: [PATCH 1/3] core completed --- src/App.jsx | 2 +- src/sections/Advice/index.jsx | 16 +++++- src/sections/Art/index.jsx | 95 ++++++++++++++++++++++++++++++++++- src/sections/Users/index.jsx | 51 ++++++++++++++++++- 4 files changed, 159 insertions(+), 5 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 5ef8293f..6944c8a8 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -7,7 +7,7 @@ function App() { return (
- +
) diff --git a/src/sections/Advice/index.jsx b/src/sections/Advice/index.jsx index 0405f11f..f425d3a0 100644 --- a/src/sections/Advice/index.jsx +++ b/src/sections/Advice/index.jsx @@ -2,8 +2,20 @@ function AdviceSection() { return (

Advice Section

-
-
+
+

Some Advice

+

Always the burrito.

+ + +
+
+

Favourite Advice Slips

+
    +
  • Measure twice, cut once.
  • +
  • Don't let the bastards grind you down.
  • +
  • Always the burrito.
  • +
+
) } diff --git a/src/sections/Art/index.jsx b/src/sections/Art/index.jsx index 0c74ffc2..5a1cf5d0 100644 --- a/src/sections/Art/index.jsx +++ b/src/sections/Art/index.jsx @@ -1,10 +1,103 @@ +import { useEffect, useState } from "react" + function ArtsSection() { + + + const [data, setData] = useState([]); + const [loading,setLoading] = useState(true); + + useEffect(() =>{ + fetch('https://boolean-uk-api-server.fly.dev/art') + .then(response => { + return response.json(); + }) + .then (jsonData =>{ + setData(jsonData); + setLoading(false); +/* console.log(data); + console.log(loading); */ + + + }) + .catch(error => { + console.log("EERRORORR"); + console.log(error); + }) + +/* data.map((item, index) => ({ + url = 'https://boolean-uk-api-server.fly.dev/art' + {item.imageURL} + fetch(url) + .then(response => { + + setdata( datas => ({ + ...datas.map(item => + ...item, imageURL: + ), + + + }) + + + + }) + + }) + + + + */ + }, []); + + + + + return ( + <>

Arts Section

-
+
+
    +
  • + {data.map((item) => ( + <> +
    + +
    + +

    {item.title}

    +

    Artist: {item.artist}

    +

    Publication History:

    +
      + + {item.publicationHistory.map((pub) =>( + <> +
    • {pub}
    • + + ))} +
    + + ))} + + +
  • +
+
+ ) } export default ArtsSection + + +/*

Paris Street; Rainy Day

+

Artist: Gustave Caillebotte

+

Publication History:

+ */ \ No newline at end of file diff --git a/src/sections/Users/index.jsx b/src/sections/Users/index.jsx index 77332830..97856a1b 100644 --- a/src/sections/Users/index.jsx +++ b/src/sections/Users/index.jsx @@ -1,8 +1,57 @@ +import { useEffect, useState } from "react" + function UsersSection() { + + + const [data, setData] = useState([]); + const [loading,setLoading] = useState(true); + + useEffect(() =>{ + fetch('https://boolean-uk-api-server.fly.dev/emazau/contact') + .then(response => { + return response.json(); + }) + .then (jsonData =>{ + setData(jsonData); + setLoading(false); + console.log(data); + console.log(loading); + + + }) + .catch(error => { + console.log("EERRORORR"); + console.log(error); + }) + + }, []); + + + + return (

Users Section

-
+
+
    + + + {data.map((item) => ( + <> +
  • + Ritthy Ryan + +

    {item.firstName + " " + item.lastName}

    +

    Email: {item.email}

    +
  • + + ))} + +
+
) } From 3d319bd3a08ce2bab98c67bc2032a9cd03c709de Mon Sep 17 00:00:00 2001 From: Emanuels Zaurins Date: Mon, 1 Sep 2025 16:02:56 +0200 Subject: [PATCH 2/3] extension complete --- src/sections/Advice/index.jsx | 69 +++++++++++++++++++++++++++++++++-- src/sections/Users/index.jsx | 4 +- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/src/sections/Advice/index.jsx b/src/sections/Advice/index.jsx index f425d3a0..2b688541 100644 --- a/src/sections/Advice/index.jsx +++ b/src/sections/Advice/index.jsx @@ -1,16 +1,79 @@ +import { useEffect, useState } from "react" + + function AdviceSection() { + + + const [data, setData] = useState({"slip": { "id": 0, "advice": "Dummy"}}); + const [fav, setFav] = useState(["Dummy", "strings"]); + + + useEffect(() =>{ + fetch('https://api.adviceslip.com/advice') + .then(response => { + return response.json(); + }) + .then (jsonData =>{ + setData(jsonData); + console.log(data); + + + }) + .catch(error => { + console.log("EERRORORR"); + console.log(error); + }) + + + }, []); + + const update = () =>{ + + fetch('https://api.adviceslip.com/advice') + .then(response => { + return response.json(); + }) + .then (jsonData =>{ + setData(jsonData); + console.log(data); + + + }) + .catch(error => { + console.log("EERRORORR"); + console.log(error); + }) + }; + + + + + return (

Advice Section

Some Advice

-

Always the burrito.

- - + + {

{(data.slip.advice) ? data.slip.advice : "loading"}

} + + + +

Favourite Advice Slips

    + {fav.map((item, index) => ( + <> +
  • {item}
  • + + ))}
  • Measure twice, cut once.
  • Don't let the bastards grind you down.
  • Always the burrito.
  • diff --git a/src/sections/Users/index.jsx b/src/sections/Users/index.jsx index 97856a1b..938a0fa2 100644 --- a/src/sections/Users/index.jsx +++ b/src/sections/Users/index.jsx @@ -14,8 +14,6 @@ function UsersSection() { .then (jsonData =>{ setData(jsonData); setLoading(false); - console.log(data); - console.log(loading); }) @@ -41,7 +39,7 @@ function UsersSection() {
  • Ritthy Ryan

    {item.firstName + " " + item.lastName}

    From 8711fa4ba2f233f7413584c2b0c68d49cd2598a7 Mon Sep 17 00:00:00 2001 From: Emanuels Zaurins Date: Mon, 1 Sep 2025 16:03:28 +0200 Subject: [PATCH 3/3] but little problem with button add to fav --- src/sections/Advice/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sections/Advice/index.jsx b/src/sections/Advice/index.jsx index 2b688541..4c89edd8 100644 --- a/src/sections/Advice/index.jsx +++ b/src/sections/Advice/index.jsx @@ -62,7 +62,7 @@ function AdviceSection() { >Get More Advice