import { default as React } from 'react'; import { GrainGalleryPhoto } from '../renderers/GrainGalleryRenderer'; import { GrainGalleryRecord } from '../types/grain'; /** * Props for rendering a grain.social gallery. */ export interface GrainGalleryProps { /** * Decentralized identifier for the repository that owns the gallery. */ did: string; /** * Record key identifying the specific gallery within the collection. */ rkey: string; /** * Prefetched gallery record. When provided, skips fetching the gallery from the network. */ record?: GrainGalleryRecord; /** * Custom renderer component that receives resolved gallery data and status flags. */ renderer?: React.ComponentType; /** * React node shown while the gallery query has not yet produced data or an error. */ fallback?: React.ReactNode; /** * React node displayed while the gallery fetch is actively loading. */ loadingIndicator?: React.ReactNode; /** * Constellation API base URL for fetching backlinks. */ constellationBaseUrl?: string; } /** * Values injected by `GrainGallery` into a downstream renderer component. */ export type GrainGalleryRendererInjectedProps = { /** * Resolved gallery record */ gallery: GrainGalleryRecord; /** * Array of photos in the gallery with their records and metadata */ photos: GrainGalleryPhoto[]; /** * `true` while network operations are in-flight. */ loading: boolean; /** * Error encountered during loading, if any. */ error?: Error; /** * The author's public handle derived from the DID. */ authorHandle?: string; /** * The author's display name from their profile. */ authorDisplayName?: string; /** * Resolved URL for the author's avatar blob, if available. */ avatarUrl?: string; }; export declare const GRAIN_GALLERY_COLLECTION = "social.grain.gallery"; export declare const GRAIN_GALLERY_ITEM_COLLECTION = "social.grain.gallery.item"; export declare const GRAIN_PHOTO_COLLECTION = "social.grain.photo"; /** * Fetches a grain.social gallery, resolves all photos via constellation backlinks, * and renders them in a grid layout. * * @param did - DID of the repository that stores the gallery. * @param rkey - Record key for the gallery. * @param record - Prefetched gallery record. * @param renderer - Optional renderer component to override the default. * @param fallback - Node rendered before the first fetch attempt resolves. * @param loadingIndicator - Node rendered while the gallery is loading. * @param constellationBaseUrl - Constellation API base URL. * @returns A component that renders loading/fallback states and the resolved gallery. */ export declare const GrainGallery: React.FC; export default GrainGallery;