<%-include ('./header')%>
    <div class="container">
        <div class="container welcome-header d-flex justify-content-between align-items-center">
            <i class="fa-solid fa-check mr-2 mb-1 fa-2xl"></i><h2>Welcome <%= user %></h2>
        </div>
        <h2 class="mt-4 header">
            <i class="fa-solid fa-clock-rotate-left mr-2 fa-xs"></i>Recent Activities
        </h2>
        <% for(post of newPosts) { %>
            <div class="activity-card">
                <a href="/group/dashboard?groupId=<%= post.groupId %>">
                    <h5>
                        <%= post.postHeading %> <span class="text-muted">posted in <%= post.groupId %> by <%= post.userId %></span>
                    </h5>
                </a>
            </div>
        <% } %>

        <h2 class="header">
            <i class="fa-solid fa-user mr-2 fa-xs"></i>Newly Joined Members</h2>
        <div class="new-members-card">
            <ul>
                <% for(member of newMembers) { %>
                    <li>
                        <a href="/landing/view-profiles">
                            <%= member.userName%>
                        </a> 
                        ( <%= member.userEmail %> )
                    </li>
                <%}%>
            </ul>
        </div>
    </div>
<%-include ('./footer')%>

<script>
    const query=<%- query %>;
    if(query.login=='success')
      Swal.fire({
        title: 'Successfully Logged In!',
        text: 'Welcome to JU Community!',
        icon: 'success',
        confirmButtonText: 'OK'
      })
</script>

<script>
    // Add an event listener to each navigation link
    $(document).ready(function(){
        // Remove 'active' class from all navigation links
        $(".navbar-nav .nav-link").removeClass("active");
        // Add 'active' class to the clicked navigation link
        $('#home').addClass("active");
    });
</script>