forked from OpenClassrooms-Student-Center/Front-End-Fisheye
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
143 changed files
with
229 additions
and
51 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-1.06 MB
assets/images/Sample Photos/Ellie Rose/Architecture_Connected_Curves.jpg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-4.42 MB
assets/images/Sample Photos/Ellie Rose/Architecture_Water_on_Modern.jpg
Binary file not shown.
Binary file removed
BIN
-1.67 MB
assets/images/Sample Photos/Ellie Rose/Architecture_White_Light.jpg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file not shown.
Binary file removed
BIN
-2.48 MB
assets/images/Sample Photos/Photographers ID Photos/EllieRoseWilkens.jpg
Diff not rendered.
Binary file removed
BIN
-3.56 MB
assets/images/Sample Photos/Photographers ID Photos/MarcelNikolic.jpg
Diff not rendered.
Diff not rendered.
Binary file removed
BIN
-4.75 MB
assets/images/Sample Photos/Photographers ID Photos/NabeelBradford.jpg
Diff not rendered.
Binary file removed
BIN
-2.15 MB
assets/images/Sample Photos/Photographers ID Photos/RhodeDubois.jpg
Diff not rendered.
Binary file removed
BIN
-1.73 MB
assets/images/Sample Photos/Photographers ID Photos/TracyGalindo.jpg
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed
BIN
-1.98 MB
assets/images/Sample Photos/Rhode/Fashion_Melody_Red_on_Stripes.jpg
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,80 @@ | ||
// Allows to retrieve the photographer's ID. | ||
let params = new URL(document.location).searchParams; | ||
let id = parseInt(params.get("id")); | ||
|
||
// Allows to retrieve all photographers from the JSON file. | ||
async function getPhotographers() { | ||
try { | ||
const response = await fetch('data/photographers.json'); | ||
if (!response.ok) { | ||
throw new Error('Unable to retrieve photographer data.'); | ||
let params = new URL(document.location).searchParams; | ||
let id = parseInt(params.get("id")); | ||
|
||
/**************************************** Photographers ****************************************/ | ||
// Allows to retrieve all photographers from the JSON file. | ||
async function getPhotographers() { | ||
try { | ||
const response = await fetch('data/photographers.json'); | ||
if (!response.ok) { | ||
throw new Error('Unable to retrieve photographer data.'); | ||
} | ||
const data = await response.json(); | ||
return data.photographers; | ||
} catch (error) { | ||
console.error(error); | ||
return []; | ||
} | ||
} | ||
|
||
// Allows to retrieve a photographer from his ID. | ||
async function getPhotographersById(id) { | ||
const photographers = await getPhotographers(); | ||
|
||
const photographer = photographers.find(function (photographer) { | ||
return photographer.id === id; | ||
}); | ||
|
||
if (photographer) { | ||
console.log("Photographer found :", photographer); | ||
return photographer; | ||
} else { | ||
console.log("No photographer found with the ID", id); | ||
return null; | ||
} | ||
} | ||
const data = await response.json(); | ||
return data.photographers; | ||
} catch (error) { | ||
console.error(error); | ||
return []; | ||
|
||
async function displayPhotographer() { | ||
const photographer = await getPhotographersById(id) // Photographer object retrieved. | ||
photographerHeader(photographer) | ||
} | ||
} | ||
|
||
// Allows to retrieve a photographer from his ID. | ||
async function getPhotographersById(id) { | ||
const photographers = await getPhotographers(); | ||
|
||
const photographer = photographers.find(function (photographer) { | ||
return photographer.id === id; | ||
}); | ||
|
||
if (photographer) { | ||
console.log("Photographer found :", photographer); | ||
return photographer; | ||
} else { | ||
console.log("No photographer found with the ID", id); | ||
return null; | ||
} | ||
} | ||
/**************************************** Medias ****************************************/ | ||
// Allows to retrieve all photographers from the JSON file. | ||
async function getMedias() { | ||
try { | ||
const response = await fetch('data/photographers.json'); | ||
if (!response.ok) { | ||
throw new Error('Unable to retrieve medias data.'); | ||
} | ||
const data = await response.json(); | ||
return data.media; | ||
} catch (error) { | ||
console.error(error); | ||
return []; | ||
} | ||
} | ||
|
||
// Allows the use of the photographer's ID to retrieve the associated media. | ||
async function getMediasByPhotographerId(id) { | ||
const medias = await getMedias(); | ||
return medias.filter(media => media.photographerId === id); | ||
} | ||
|
||
getMediasByPhotographerId(id) | ||
|
||
async function displayMedias() { | ||
const medias = await getMediasByPhotographerId(id) // Photographer object retrieved. | ||
medias.forEach(media => { | ||
createMedias(media) | ||
}); | ||
|
||
async function displayPhotographer() { | ||
const photographer = await getPhotographersById(id) // Photographer object retrieved. | ||
photographerHeader(photographer) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
displayPhotographer() | ||
displayMedias() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters