From 147558bc20e8616f9aa578bf1d96872e7a3d9a58 Mon Sep 17 00:00:00 2001 From: Rassmagin Alexander Date: Mon, 25 Nov 2024 15:43:45 +0300 Subject: [PATCH] placeholder for empty feed --- public/components/Feed/Feed.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/components/Feed/Feed.js b/public/components/Feed/Feed.js index a845ced..6db87dc 100644 --- a/public/components/Feed/Feed.js +++ b/public/components/Feed/Feed.js @@ -88,6 +88,7 @@ export class Feed { * @param {string} description - The description of the event. * @param {string} image - The image URL of the event. */ + Object.entries(feed.events).forEach( (elem) => { const {id, title, image} = elem[1]; const feedElement = new FeedElement(id, title, `${endpoint}/${image}`).renderTemplate(); @@ -98,6 +99,11 @@ export class Feed { navigate(path); }); }); + if (feed.events.length = 0) { + const emptyDummy = document.createElement('div'); + emptyDummy.innerHTML = 'Тут пока нет постов.'; + feedContent.appendChild(emptyDummy); + } } else { /**