The Community Gallery atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nayalsaurav/Akari-Art/llms.txt
Use this file to discover all available pages before exploring further.
/community is a shared, living feed of every image that any Akari Art user has chosen to publish. Posts are loaded directly from MongoDB on the server, reversed into newest-first order, and rendered into a responsive grid — no pagination or infinite scroll, just a clean snapshot of the community’s creativity. From any card you can read the original prompt, see who created the piece, and save a copy to your device.
Browsing posts
Posts are displayed in a responsive CSS grid that adapts to the viewer’s screen size:| Breakpoint | Columns |
|---|---|
| Default (mobile) | 1 column |
sm (≥ 640 px) | 3 columns |
lg (≥ 1024 px) | 4 columns |
RenderPosts maps each post document to a <Card> component, passing name, prompt, and photo as props. If the posts array is empty (either no posts exist or a search returned nothing), RenderPosts renders a prominent heading with the title string instead.
Post ordering — all posts are fetched with Post.find({}).lean() and then .reverse() is called on the result array, so the most recently created post always appears in the top-left position of the grid.
Card behavior
Each<Card> shows the Cloudinary-hosted image filling the card area. On top of the image sits an overlay panel that reveals the prompt text, the creator’s name (with an avatar initial badge), and a download button.
Desktop hover
On screens wider than 768 px, the overlay slides into view whenever the cursor enters the card, using the CSS
group-hover:flex utility. No click is needed.Mobile tap
On screens narrower than 768 px, the overlay is toggled by tapping the card. A second tap dismisses it. This is handled by the
toggleOverlay function, which checks window.innerWidth before updating the showOverlay state.showOverlay state (mobile tap) and the CSS group-hover:flex class (desktop hover):
Search
The gallery supports full-text filtering via a native HTML<form> that issues a GET request, appending a search query parameter to the /community URL:
search parameter from searchParams and filters the already-reversed posts array:
name and prompt fields are lowercased before comparison — the search query is compared as-entered. For reliable matching, type your search term in lowercase (e.g. "cat" will match any post whose lowercased name or prompt contains that substring).
When a search is active, a result label appears above the grid:
RenderPosts component renders "No results found" in place of the grid.
Downloading images
Every card overlay includes a download button powered by thefile-saver library. Clicking it saves the Cloudinary-hosted image to the user’s device as downloaded-image.png:
e.stopPropagation() ensures the click does not bubble up to the card’s onClick handler, which would toggle the overlay closed on mobile immediately after the download is initiated.
The Community Gallery requires authentication. Unauthenticated users who visit
/community are redirected to /signin by the server-side session check in the page component. See Authentication for details on how protected routes are enforced.