Skip to content

Commit

Permalink
fix::sitemap and sm bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
tejasnasre committed Nov 10, 2024
1 parent 1e82079 commit f60d078
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 45 deletions.
4 changes: 2 additions & 2 deletions public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ User-agent: *
Allow: /

# Host
Host: https://nexmeet-lake.vercel.app
Host: https://www.nexmeet.social/

# Sitemaps
Sitemap: https://nexmeet-lake.vercel.app/sitemap.xml
Sitemap: https://www.nexmeet.social/sitemap.xml
29 changes: 18 additions & 11 deletions public/sitemap-0.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://nexmeet-lake.vercel.app/add-event-space</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/explore-event-space</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/add-event</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/explore-events</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/dashboard</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/contact</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/unauthorized</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/update-event</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/about</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://nexmeet-lake.vercel.app/manage-event</loc><lastmod>2024-10-10T15:56:05.518Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/add-community</loc><lastmod>2024-11-10T08:59:39.236Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/explore-community</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/add-event</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/explore-events</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/manage-event</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/update-event</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/add-event-space</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/explore-event-space/request-booking</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/explore-event-space</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/about</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/admin</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/community-patnership</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/contact</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/contributors</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/dashboard</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/event-calendar</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social/unauthorized</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.nexmeet.social</loc><lastmod>2024-11-10T08:59:39.237Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
</urlset>
2 changes: 1 addition & 1 deletion public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://nexmeet-lake.vercel.app/sitemap-0.xml</loc></sitemap>
<sitemap><loc>https://www.nexmeet.social/sitemap-0.xml</loc></sitemap>
</sitemapindex>
144 changes: 113 additions & 31 deletions src/app/(community)/explore-community/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import Loading from "../../../components/loading";
import { useUserDetails } from "../../../hooks/useUserDetails";
import Link from "next/link";
import { motion } from "framer-motion";
import { SearchIcon, TrashIcon } from '@heroicons/react/solid'; // Import the search icon
import { LocationMarkerIcon } from '@heroicons/react/solid';
import { SearchIcon, TrashIcon } from "@heroicons/react/solid"; // Import the search icon
import { LocationMarkerIcon } from "@heroicons/react/solid";
import Image from "next/image";

const Page: React.FC = () => {
// Define types
Expand All @@ -23,7 +24,7 @@ const Page: React.FC = () => {
community_image: string;
community_creation_date: string;
is_approved: boolean;
}
}

// State hooks
const [loading, setLoading] = useState(true);
Expand All @@ -41,7 +42,9 @@ const Page: React.FC = () => {
community_category: "",
community_image: "",
});
const [editingCommunityId, setEditingCommunityId] = useState<string | null>(null); // To track the community being edited
const [editingCommunityId, setEditingCommunityId] = useState<string | null>(
null
); // To track the community being edited

const [joinFormData, setJoinFormData] = useState({
name: "",
Expand Down Expand Up @@ -75,7 +78,13 @@ const Page: React.FC = () => {
const handleFormSubmit = async (e: React.FormEvent) => {
e.preventDefault();

const { community_name, community_description, community_location, community_category, community_image } = newCommunity;
const {
community_name,
community_description,
community_location,
community_category,
community_image,
} = newCommunity;

if (editingCommunityId) {
// Update the community
Expand Down Expand Up @@ -108,18 +117,18 @@ const Page: React.FC = () => {
}
} else {
// Insert new community (as before)
const { data, error } = await supabase
.from("communities")
.insert([{
const { data, error } = await supabase.from("communities").insert([
{
community_name,
community_description,
community_location,
community_category,
community_image,
community_members_count: 0,
community_creation_date: new Date().toISOString(),
is_approved: false
}]);
is_approved: false,
},
]);

if (error) {
toast.error("Failed to create community.");
Expand Down Expand Up @@ -153,7 +162,9 @@ const Page: React.FC = () => {
};

const handleDeleteCommunity = async (communityId: string) => {
const confirmation = window.confirm("Are you sure you want to delete this community?");
const confirmation = window.confirm(
"Are you sure you want to delete this community?"
);
if (!confirmation) return;

try {
Expand All @@ -180,7 +191,9 @@ const Page: React.FC = () => {
console.error("Error deleting community:", error);
} else {
toast.success("Community deleted successfully!");
setCommunities((prev) => prev.filter((community) => community.id !== communityId));
setCommunities((prev) =>
prev.filter((community) => community.id !== communityId)
);
}
} catch (error) {
toast.error("An unexpected error occurred.");
Expand Down Expand Up @@ -208,10 +221,16 @@ const Page: React.FC = () => {
const filteredAndSortedCommunities = useMemo(() => {
return communities
.filter((community) => {
const matchesCategory = category ? community.community_category === category : true;
const matchesCategory = category
? community.community_category === category
: true;
const matchesSearchTerm =
community.community_name.toLowerCase().includes(searchTerm.toLowerCase()) ||
community.community_location.toLowerCase().includes(searchTerm.toLowerCase());
community.community_name
.toLowerCase()
.includes(searchTerm.toLowerCase()) ||
community.community_location
.toLowerCase()
.includes(searchTerm.toLowerCase());
return matchesCategory && matchesSearchTerm;
})
.sort((a, b) => {
Expand All @@ -226,16 +245,23 @@ const Page: React.FC = () => {

const indexOfLastItem = currentPage * itemsPerPage;
const indexOfFirstItem = indexOfLastItem - itemsPerPage;
const currentCommunities = filteredAndSortedCommunities.slice(indexOfFirstItem, indexOfLastItem);
const currentCommunities = filteredAndSortedCommunities.slice(
indexOfFirstItem,
indexOfLastItem
);

const totalPages = Math.ceil(filteredAndSortedCommunities.length / itemsPerPage);
const totalPages = Math.ceil(
filteredAndSortedCommunities.length / itemsPerPage
);

if (loading) {
return <Loading />;
}

return (
<div className={`w-full h-auto bg-black text-white py-[8rem] ${loading ? `px-0` : `px-4`}`}>
<div
className={`w-full h-auto bg-black text-white py-[8rem] ${loading ? `px-0` : `px-4`}`}
>
<div className="text-5xl md:text-6xl font-bold mb-12 text-center items-center justify-center tracking-tight">
Explore Communities
</div>
Expand Down Expand Up @@ -307,12 +333,16 @@ const Page: React.FC = () => {
>
<TrashIcon className="w-6 h-6" />
</button>
<img
<Image
src={community.community_image}
alt={community.community_name}
className="w-full h-48 object-cover rounded-lg"
width={500}
height={500}
/>
<h3 className="text-xl font-semibold mt-3">{community.community_name}</h3>
<h3 className="text-xl font-semibold mt-3">
{community.community_name}
</h3>
<p className="text-gray-500 mt-2 flex items-center">
<LocationMarkerIcon className="w-5 h-5 text-gray-400 mr-2" />
{community.community_location}
Expand Down Expand Up @@ -342,59 +372,111 @@ const Page: React.FC = () => {
{showAddCommunityForm && (
<div className="fixed inset-0 bg-black bg-opacity-50 flex justify-center items-center z-50">
<div className="bg-black p-6 rounded-lg w-full max-w-lg">
<h2 className="text-2xl font-bold mb-4">{editingCommunityId ? "Edit Community" : "Add New Community"}</h2>
<h2 className="text-2xl font-bold mb-4">
{editingCommunityId ? "Edit Community" : "Add New Community"}
</h2>
<form onSubmit={handleFormSubmit}>
<div className="mb-4">
<label htmlFor="community_name" className="block text-sm font-semibold">Community Name</label>
<label
htmlFor="community_name"
className="block text-sm font-semibold"
>
Community Name
</label>
<input
type="text"
id="community_name"
className="border border-gray-300 rounded-md w-full p-2 mt-2 bg-black"
value={newCommunity.community_name}
onChange={(e) => setNewCommunity({ ...newCommunity, community_name: e.target.value })}
onChange={(e) =>
setNewCommunity({
...newCommunity,
community_name: e.target.value,
})
}
required
/>
</div>
<div className="mb-4">
<label htmlFor="community_description" className="block text-sm font-semibold">Description</label>
<label
htmlFor="community_description"
className="block text-sm font-semibold"
>
Description
</label>
<textarea
id="community_description"
className="border border-gray-300 rounded-md w-full p-2 mt-2 bg-black"
value={newCommunity.community_description}
onChange={(e) => setNewCommunity({ ...newCommunity, community_description: e.target.value })}
onChange={(e) =>
setNewCommunity({
...newCommunity,
community_description: e.target.value,
})
}
required
/>
</div>
<div className="mb-4">
<label htmlFor="community_location" className="block text-sm font-semibold">Location</label>
<label
htmlFor="community_location"
className="block text-sm font-semibold"
>
Location
</label>
<input
type="text"
id="community_location"
className="border border-gray-300 rounded-md w-full p-2 mt-2 bg-black"
value={newCommunity.community_location}
onChange={(e) => setNewCommunity({ ...newCommunity, community_location: e.target.value })}
onChange={(e) =>
setNewCommunity({
...newCommunity,
community_location: e.target.value,
})
}
required
/>
</div>
<div className="mb-4">
<label htmlFor="community_category" className="block text-sm font-semibold">Category</label>
<label
htmlFor="community_category"
className="block text-sm font-semibold"
>
Category
</label>
<input
type="text"
id="community_category"
className="border border-gray-300 rounded-md w-full p-2 mt-2 bg-black"
value={newCommunity.community_category}
onChange={(e) => setNewCommunity({ ...newCommunity, community_category: e.target.value })}
onChange={(e) =>
setNewCommunity({
...newCommunity,
community_category: e.target.value,
})
}
required
/>
</div>
<div className="mb-4">
<label htmlFor="community_image" className="block text-sm font-semibold">Community Image URL</label>
<label
htmlFor="community_image"
className="block text-sm font-semibold"
>
Community Image URL
</label>
<input
type="text"
id="community_image"
className="border border-gray-300 rounded-md w-full p-2 mt-2 bg-black"
value={newCommunity.community_image}
onChange={(e) => setNewCommunity({ ...newCommunity, community_image: e.target.value })}
onChange={(e) =>
setNewCommunity({
...newCommunity,
community_image: e.target.value,
})
}
required
/>
</div>
Expand Down

0 comments on commit f60d078

Please sign in to comment.