Skip to content

Conversation

@harikakondur
Copy link
Contributor

@harikakondur harikakondur commented Jan 30, 2026

Purpose

This PR introduces a hierarchical tree visualization for the entry preview modal in the Google Docs app, replacing the previous flat list. The tree view shows parent-child relationships between entries up to 4 levels of nesting and handles circular references.

Approach

  • Visual tree connectors show parent-child relationships
  • Root entries have bold borders to distinguish them
  • Indentation based on nesting level (max depth: 4 levels)

New Components:

  • TreeRow - Renders each node with proper indentation
  • EntryCard - Displays entry information (title, content type)
  • Indentation - Renders tree connector lines (├─, │, └─)

Two Display Modes:

a) Normal Tree Structure (entries with clear hierarchy):

Blog Post: "My Journey" (blogPost)
  └─ Jane Smith (Author)

Blog Post: "Future of Web" (blogPost)
  └─ John Doe (Author)

b) Flat List (all entries circular):
When ALL entries are part of circular reference chains, shows a flat list:

- Jane Smith (Author)
- John Doe (Author)
- My Journey into AI (blogPost)
- The Future of Web (blogPost)

Testing screenshots

  1. When ALL entries are in a circular reference -> display entries as a flat list
Screenshot 2026-02-02 at 12 26 02 AM
  1. Entries with shared references
Screenshot 2026-02-01 at 11 27 56 PM Screenshot 2026-02-01 at 11 28 00 PM
  1. Deep nesting
Screenshot 2026-02-02 at 8 11 18 AM
  1. Entry with reference array
Screenshot 2026-02-02 at 8 13 31 AM
  1. Circular references
Screenshot 2026-02-02 at 9 01 41 AM

@harikakondur harikakondur changed the title Integ3425 feat(google-docs): reference tree preview ui [INTEG-3425] Feb 2, 2026
@harikakondur harikakondur marked this pull request as ready for review February 2, 2026 15:51
@harikakondur harikakondur requested a review from a team as a code owner February 2, 2026 15:51
const pathKey = nodePath.join('/');

// Stop at max depth
if (level >= MAX_TREE_DEPTH) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any ideas on how(or if?) we should display entries past the max depth limit?

* Extracts all reference tempIds from an entry's fields
*/
function extractReferences(entry: EntryToCreate): string[] {
const referenceTempIds: string[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If order doesn't matter, make this a set, not an array

</Text>
</Flex>
</Box>
{treeNodes.map((node, index) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just make a wrapper component and just pass the treeNodes as a prop instead of doing this loop

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.

3 participants