check this code import { comments } from "./voting/votes.data.js";
import { voteCard } from "./voting/voteCard.js";
import { createVote } from "./voting/createVote.js";
const commentsContainer = document.getElementById("comments-container");
const modal = document.getElementById("modal");
const closeModal = document.getElementById("close-modal");
const modalText = document.getElementById("modal-text");

const publicTab = document.getElementById("public-tab");
const privateTab = document.getElementById("private-tab");
const paginationContainer = document.querySelector(".pagination-container");

const commentsPerPage = 4;
let currentPage = 1;
let currentTab = "public";

// TEST if there is not votes
// const comments = [];

function displayComments() {
  const startIndex = (currentPage - 1) * commentsPerPage;
  const endIndex = startIndex + commentsPerPage;

  commentsContainer.innerHTML = ""; // Clear previous comments
  let filteredVotes = comments.filter(
    (comment) =>
      (currentTab === "public" && !comment.private) ||
      (currentTab === "private" && comment.private)
  );
  if (filteredVotes.length === 0) {
    const noDataElement = document.createElement("div");
    noDataElement.innerHTML = /*html*/ `<div class='no-data'>
      <img src="./images/voting/no-data.svg" alt="no-data" />
      <span>Voting has not commenced yet</span>
      <button>Create Vote</button>
    </div>`;
    commentsContainer.appendChild(noDataElement);
    displayPagination(); // Update pagination
    return; // Exit the fun