Rename MediaGrid to MediaCollage

The component is a justified collage layout, not a grid. Renames the file,
component, skeleton, and props interface, and updates all imports.
This commit is contained in:
Alex Gleason
2026-03-13 14:58:17 -05:00
parent 487d2d778d
commit d82bdc4613
4 changed files with 13 additions and 13 deletions
@@ -1,5 +1,5 @@
/**
* MediaGrid justified row-based collage for Nostr media events (Google Photos style).
* MediaCollage justified row-based collage for Nostr media events (Google Photos style).
* Supports images, video, and audio. Images respect their aspect ratios from imeta `dim` tags.
* All media across all events is flattened into one array so the Lightbox strip swipe
* just advances through them in order.
@@ -313,7 +313,7 @@ const SKELETON_ROWS_MOBILE = [
[1.5, 0.8],
];
export function MediaGridSkeleton({ count = 15 }: { count?: number }) {
export function MediaCollageSkeleton({ count = 15 }: { count?: number }) {
const isMobile = useIsMobile();
const skeletonRows = isMobile ? SKELETON_ROWS_MOBILE : SKELETON_ROWS_DESKTOP;
const perRow = isMobile ? 2 : 3;
@@ -346,9 +346,9 @@ export function MediaGridSkeleton({ count = 15 }: { count?: number }) {
);
}
// ── MediaGrid ─────────────────────────────────────────────────────────────────
// ── MediaCollage ─────────────────────────────────────────────────────────────────
interface MediaGridProps {
interface MediaCollageProps {
events: NostrEvent[];
className?: string;
/** If set, the lightbox opens at this URL on mount (used by sidebar click). */
@@ -362,7 +362,7 @@ interface MediaGridProps {
isFetchingNextPage?: boolean;
}
export function MediaGrid({ events, className, initialOpenUrl, onInitialOpenConsumed, onNearEnd, hasNextPage }: MediaGridProps) {
export function MediaCollage({ events, className, initialOpenUrl, onInitialOpenConsumed, onNearEnd, hasNextPage }: MediaCollageProps) {
const isMobile = useIsMobile();
const items = useMemo(
+1 -1
View File
@@ -16,7 +16,7 @@ import QRCode from 'qrcode';
import { useAppContext } from '@/hooks/useAppContext';
import { getContentWarning } from '@/lib/contentWarning';
import { MiniAudioPlayer, isAudioUrl } from '@/components/MiniAudioPlayer';
import { parseDimToAspectRatio } from '@/components/MediaGrid';
import { parseDimToAspectRatio } from '@/components/MediaCollage';
/** Simple email regex for display purposes. */
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+4 -4
View File
@@ -3,7 +3,7 @@
*
* - Follows tab: useFeed (relay pool, chronological)
* - Global tab: useInfiniteHotFeed (sort:hot via relay.ditto.pub)
* - Infinite-scroll 3-column grid via the shared MediaGrid component
* - Infinite-scroll justified collage via the shared MediaCollage component
*/
import { useEffect, useMemo } from 'react';
@@ -26,7 +26,7 @@ import { sidebarItemIcon } from '@/lib/sidebarItems';
import { getExtraKindDef } from '@/lib/extraKinds';
import { cn } from '@/lib/utils';
import type { FeedItem } from '@/lib/feedUtils';
import { MediaGrid, MediaGridSkeleton, eventToMediaItem } from '@/components/MediaGrid';
import { MediaCollage, MediaCollageSkeleton, eventToMediaItem } from '@/components/MediaCollage';
const PHOTO_KIND = 20;
const photosDef = getExtraKindDef('photos')!;
@@ -130,7 +130,7 @@ export function PhotosFeedPage() {
{/* Grid */}
{showSkeleton ? (
<MediaGridSkeleton count={15} />
<MediaCollageSkeleton count={15} />
) : photoEvents.length === 0 ? (
<FeedEmptyState
message={
@@ -142,7 +142,7 @@ export function PhotosFeedPage() {
/>
) : (
<>
<MediaGrid
<MediaCollage
events={photoEvents}
hasNextPage={hasNextPage}
isFetchingNextPage={isFetchingNextPage}
+3 -3
View File
@@ -35,7 +35,7 @@ import { isEventMuted } from '@/lib/muteHelpers';
import { useProfileFeed, useProfileLikes as useProfileLikesInfinite, filterByTab } from '@/hooks/useProfileFeed';
import type { ProfileTab as CoreProfileTab } from '@/hooks/useProfileFeed';
import { useProfileMedia } from '@/hooks/useProfileMedia';
import { MediaGrid, MediaGridSkeleton } from '@/components/MediaGrid';
import { MediaCollage, MediaCollageSkeleton } from '@/components/MediaCollage';
import { useProfileSupplementary } from '@/hooks/useProfileData';
import { useWallComments } from '@/hooks/useWallComments';
import { ThreadedReplyList } from '@/components/ThreadedReplyList';
@@ -2188,10 +2188,10 @@ export function ProfilePage() {
{hasTabs && activeTab === 'media' && (
<div>
{mediaPending ? (
<MediaGridSkeleton count={15} />
<MediaCollageSkeleton count={15} />
) : mediaEvents.length > 0 ? (
<>
<MediaGrid
<MediaCollage
events={mediaEvents}
initialOpenUrl={sidebarMediaUrl ?? undefined}
onInitialOpenConsumed={() => setSidebarMediaUrl(null)}