Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Document Views for Source Explorer #150

Merged

Conversation

kouloumos
Copy link
Contributor

This PR introduces new ways to view documents within our source explorer (/sources), making it easier to navigate through different types of content.

Key Changes

  • Added new view modes for sources:
    • Thread View: Groups related documents by their thread URL (only shown for sources with threaded content)
    • Combined Summaries: Dedicated view for summary documents (only shown for sources that have them)
    • Default View: Now excludes combined summaries for cleaner presentation
  • Refactored the Documents component into smaller, focused components for better maintainability
  • Added source-level metadata to efficiently determine available view modes

Technical Details

An overview of Source Explorer's functionality from my notes to help you better review this change.

  1. Entry Point (pages/sources.tsx):

    • Main page component that displays a table of data sources
    • Implements sorting and expandable rows for viewing source details
    • Uses the useSources hook for data fetching
    • Passes source metadata about available view modes
  2. Data Fetching Layer:

    • Three API endpoints under elasticSearchProxy/:
      • sources.ts: Retrieves aggregated source data and metadata from Elasticsearch
      • sourceDocuments.ts: Fetches paginated documents with view mode support
      • getDocumentContent.ts: Retrieves full content of a specific document
  3. Custom Hooks:

    • useSources.ts: Manages source data and metadata fetching
    • useSourceDocuments.ts: Handles paginated document fetching with view modes
    • useDocumentContent.ts: Manages individual document content retrieval
  4. UI Components:

    • Documents.tsx: Main container component orchestrating the document views
    • ViewModeSelector.tsx: Handles switching between view modes based on availability
    • DocumentTable.tsx: Renders flat/summary view of documents
    • ThreadedDocumentTable.tsx: Renders threaded view of documents
    • PaginationControls.tsx: Handles pagination for all view modes
    • DocumentModal.tsx: Displays detailed document content

The flow works as follows:

  1. Main page loads and fetches sources with metadata using useSources
  2. When a source row is expanded, Documents component initializes
  3. User can switch between available view modes (flat/threaded/summaries)
  4. Each view mode fetches and displays documents appropriately:
    • Flat view: Shows all documents except combined summaries
    • Threaded view: Groups documents by thread_url (if available)
    • Summaries view: Shows only combined-summary documents (if available)
  5. All data is cached using React Query, with Elasticsearch as the backend store

- Add threaded and combined summaries view modes for documents
- Filter out combined-summary documents from default view
- Break down Documents component into smaller, reusable components
- Add source metadata for available view modes (threads/summaries)
- Improve component organization and maintainability
Copy link

vercel bot commented Nov 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bitcoinsearch-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 14, 2024 0:58am

not related with the change but resulting in build error
@Emmanuel-Develops Emmanuel-Develops merged commit b44956c into bitcoinsearch:staging Nov 26, 2024
3 checks passed
Emmanuel-Develops pushed a commit to Emmanuel-Develops/bitcoinsearch that referenced this pull request Nov 29, 2024
* feat(sources): add view modes and refactor Documents component

- Add threaded and combined summaries view modes for documents
- Filter out combined-summary documents from default view
- Break down Documents component into smaller, reusable components
- Add source metadata for available view modes (threads/summaries)
- Improve component organization and maintainability

* fix build error with more readable code

not related with the change but resulting in build error
Emmanuel-Develops added a commit that referenced this pull request Nov 29, 2024
* Enhanced Document Views for Source Explorer (#150)

* feat(sources): add view modes and refactor Documents component

- Add threaded and combined summaries view modes for documents
- Filter out combined-summary documents from default view
- Break down Documents component into smaller, reusable components
- Add source metadata for available view modes (threads/summaries)
- Improve component organization and maintainability

* fix build error with more readable code

not related with the change but resulting in build error

* Addition of boss banner (#151)

* chore(banner): add boss banner

* chore(version): updated bdp-ui patch fix

---------

Co-authored-by: Andreas <[email protected]>
Co-authored-by: 0tuedon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants