Skip to content

Code Insights: Refactor search based live preview card

Administrator requested to merge vk/refactor-search-based-live-preview-card into main

Created by: vovakulikov

Based on https://github.com/sourcegraph/sourcegraph/pull/33553

  1. Implementation of low level card components and lang stats live preview refactoring
  2. This PR

Closes part of https://github.com/sourcegraph/sourcegraph/issues/32944

Background

This PR simplifies the live preview card for the search-based insight creation UI and edit UI, also since the in-product landing page uses this component as well in this PR we adjust the dynamic insight card as well.

The main idea is simple. Prior to this PR, we tried to reuse card components for different cases, creation UI, and dynamic insight on the landing page, Since they are similar but not exactly the same we have a lot of UI props and logic to render/hide some elements within the card.

In this PR we re-implement dynamic insight and live preview cards separately with our low-level-based card components. But we are still reusing data fetch logic and data models as well.

So the rule I found: if UI is becoming more and more complex it's ok to duplicate implementation in different consumers as long as all consumers rely on low-level abstraction.

Test plan

  • Make sure that chart live preview logic works properly on the search based creation UI and edit UI
  • Make sure that the dynamic insight card works properly on the landing page

App preview:

Merge request reports

Loading