Feature: Collections
Relevant source files
The following files were used as context for generating this wiki page:
The Collections feature organizes curated Christ-centered talk series within the TREAD Talks platform. Each collection groups related talks covering a specific topic or a book of the Bible, allowing users to consume content in a structured, sequential format.
Sources: src/app/collections/page.tsx:10-12, src/app/collections/page.tsx:43-47
Data Model
The collections table stores metadata for curated series. The schema includes standard fields for identification, descriptive content, and audit trailing.
Schema Definition
| Field | Type | Description |
|---|---|---|
title | string | The display name of the collection. |
slug | string | A URL-friendly identifier for the collection. |
description | string (optional) | Detailed information about the series content. |
url | string (optional) | External reference link if applicable. |
updatedAt | number (optional) | Unix timestamp of the last modification. |
Sources: convex/model/collections/mutations.ts:25-27, convex/model/collections/mutations.ts:133
Entity Relationships
Collections maintain a one-to-many relationship with talks. A talk document optionally references a collectionId.
The diagram shows that a collection can contain multiple talks, while a talk may belong to one collection.
Sources: convex/model/collections/queries.ts:20-25, convex/model/collections/mutations.ts:66-72
Backend Logic
The system utilizes Convex for database operations, implementing specific queries and mutations to manage collection data and its associations.
Data Enrichment and Sorting
When fetching a collection, the system retrieves associated "published" talks and sorts them by the collectionOrder field. The query also enriches talk data with speaker information to facilitate frontend rendering.
Lifecycle Management
The application provides mutations for the full lifecycle of a collection, enforcing strict validation and authorization rules.
- Creation: Generates a unique slug from the title. Requires authentication.
- Deletion: Implements reference checks. The system prevents deletion if a collection has associated talks.
- Updating: Allows updating metadata. If the title changes without an explicit slug update, the system auto-generates a new unique slug.
Sources: convex/model/collections/mutations.ts:18-40, convex/model/collections/mutations.ts:46-77, convex/model/collections/mutations.ts:83-145
Frontend Implementation
The Collections feature is implemented using Next.js App Router with a sidebar-based layout for filtering and browsing.
Browsing Collections
The main collections page fetches data via server-side queries. It supports filtering by speaker and sorting.
- Path:
/collections - Component:
CollectionsPage - Filtering: Uses
speakerSlugas a search parameter to filter collections containing talks by that specific speaker.
Sources: src/app/collections/page.tsx:26-55, convex/model/collections/queries.ts:153-170
Collection Detail View
The detail page displays a specific curated series and its sequential talk list. It generates JSON-LD metadata for SEO, representing the collection as an ItemList.
- Path:
/collections/[collectionSlug] - SEO: The
generateMetadatafunction sets the page title and description based on the collection document. - Components:
CollectionTalkListrenders the talks, whileCollectionSidebarlists unique speakers involved in the series.
Sources: src/app/collections/[collectionSlug]/page.tsx:21-36, src/app/collections/[collectionSlug]/page.tsx:49-65
UI Components
The user interface leverages specific components for presenting collection data:
| Component | Purpose |
|---|---|
CollectionCard | Summarizes collection info, including talk count and participating speakers. |
CollectionMediaCard | Provides a visual card representation for featured grids. |
GridList | Manages the responsive layout of collection cards. |
Sources: src/app/collections/_components/collections-content.tsx:32-49, src/app/talks/[speakerSlug]/[talkSlug]/_components/talk-content-sections.tsx:43-47
Summary
Feature: Collections provides a structured way to navigate complex biblical series. By integrating backend reference checks, automated slug generation, and SEO-optimized frontend routes, the system ensures that curated content remains consistent and discoverable for users seeking in-depth topical study.