Skip to content

Implement Adjacent Events Navigation #81

Description

@lucianlavric

Description

Single event pages show "Other Event" placeholders for previous/next navigation (page.tsx:142-153). The adjacentEventsQuery exists but isn't being used.

Current Behavior

<OtherEvent
  title="Other event title"  // Placeholder
  link=""  // Empty
/>

Expected Behavior

  • Show previous/next events chronologically
  • Link to adjacent event pages
  • Handle edge cases (first/last event)

Acceptance Criteria

  • Fetch adjacent events using adjacentEventsQuery
  • Display previous event (earlier date) on left
  • Display next event (later date) on right
  • Hide navigation if no adjacent event exists
  • Link to correct event pages

Technical Details

Files to modify:

  • app/events/[events_template]/page.tsx - Add adjacentEventsQuery

Implementation:

const { previous, next } = await client.fetch(adjacentEventsQuery, {
  currentDate: event.date
});

<OtherEvent
  date={previous?.date}
  order="BEFORE"
  title={previous?.title || "No earlier events"}
  link={previous ? `/events/${previous.slug.current}` : ""}
/>

Reference:

  • Query: sanity/lib/queries.ts:84

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions