+
+ {/* button for form */}
+
+ {/* */}
+
+
+ {/* render form */}
+ {showForm && (
+
{
+ handleAddCommunity({
+ name: data.name,
+ description: data.description,
+ visibility: 'public',
+ members: [],
+ moderators: [],
+ owner: user?.username || 'unknown',
+ memberRequests: [],
+ questions: [],
+ });
+ setShowForm(false);
+ }}
+ onCancel={() => setShowForm(false)}
+ errorMessage={errorMessage}
+ setErrorMessage={setErrorMessage}
+ />
+ )}
+ {/* community grid */}
+
+ {communities.length === 0 ? (
+
No communities available.
+ ) : (
+ communities.map(community => (
+
+ ))
+ )}
+
+
+ );
+};
+
+export default AllCommunitiesPage;
diff --git a/client/src/components/main/communities/communityView/index.css b/client/src/components/main/communities/communityView/index.css
new file mode 100644
index 0000000..e8ef4f5
--- /dev/null
+++ b/client/src/components/main/communities/communityView/index.css
@@ -0,0 +1,51 @@
+/* styling for community view page */
+
+.community-card {
+ background: #fff;
+ padding: 20px;
+ border: 1px solid #ddd;
+ border-radius: 10px;
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
+ cursor: pointer;
+ }
+
+ .community-card:hover {
+ transform: translateY(-4px);
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+ }
+
+ .community-name {
+ font-size: 20px;
+ font-weight: bold;
+ margin-bottom: 10px;
+ }
+
+ .community-description {
+ font-size: 14px;
+ color: #555;
+ margin-bottom: 15px;
+ }
+
+ .community-meta {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .community-meta button {
+ padding: 6px 12px;
+ background-color: #007bff;
+ color: #fff;
+ border: none;
+ border-radius: 5px;
+ cursor: pointer;
+ }
+
+ .community-meta button:hover {
+ background-color: #0056b3;
+ }
+
+ .community-meta .icon {
+ font-size: 18px;
+ }
+
\ No newline at end of file
diff --git a/client/src/components/main/communities/communityView/index.tsx b/client/src/components/main/communities/communityView/index.tsx
new file mode 100644
index 0000000..a1988fa
--- /dev/null
+++ b/client/src/components/main/communities/communityView/index.tsx
@@ -0,0 +1,37 @@
+import React, { useEffect, useState } from 'react';
+import { getAllCommunities } from '../../../../services/communityService';
+import { Community } from '../../../../types/types';
+import './index.css';
+
+/**
+ * Props for Community View component
+ *
+ * c - the community object
+ * clickCommunity - Function to handle the community click
+ * handleJoin -
+ */
+interface CommunityProps {
+ c: Community;
+ clickCommunity: (communityName: string) => void;
+ handleJoin: (communityName: string) => void;
+}
+
+const CommunityView = ({ c, clickCommunity, handleJoin }: CommunityProps) => (
+