Skip to content

feat: BROS-73: [FE] Create empty states for panels: info, regions, relations, history #7694

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

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

ricardoantoniocm
Copy link
Contributor

@ricardoantoniocm ricardoantoniocm commented Jun 4, 2025

Reason for change

The existing empty states in the Info, Regions, Relations, and History panels of the outliner are not sufficiently informative or user-friendly. This PR introduces new, improved empty states to provide a better user experience when these panels have no content to display.

The implemented solution follows a consistent design pattern across all affected panels: an icon, a concise title, and a descriptive message.

In addition to these changes, design tokens were updated to fix a typo in corner radius tokens.

Key improvements include:

  • New EmptyState Component: A reusable React component (EmptyState.tsx) has been created to display an icon, header, description, and an optional "Learn more" link. This component is designed to hide the "Learn more" link in white-label environments.
  • Updated Panel Content:
    • Info Panel: Displays "Info" as the title and "Select a region to view its details."
    • Regions Panel (Outliner): Utilizes the new EmptyState component when no regions are present, with a relevant icon and "Learn more" link (hidden in white-label mode).
    • Relations Panel: Uses the new relations icon and displays "Create a relation" with the description "Created relations will be listed here."
    • History Panel: Displays "Draft creation, annotation submission, and annotation reviews will be listed here."
  • Dynamic Documentation Links: A new utility (utils/docs.ts) generates documentation URLs dynamically based on the deployment (Open Source vs. Enterprise) and ensures links are hidden for white-labeled environments.
  • Visibility: The new empty states will appear in quick view, label stream, review stream, and label config preview.
  • Code Quality: Various React functional components have been refactored for improved TypeScript typing, consistent named function expressions for observers, and cleaned-up callbacks (e.g., for region sorting, grouping, filtering).
  • Icon alignment: Two icons used to represent region types were reduced from 32x32 to 24x24 to ensure they are properly display and do not cause alignment issues.

Other minor improvements:

  • Fixed size of polygon and rectangle tool icons to prevent alignment issues on Regions and Info panels.

Screenshots

Before:
image
image
image

After:
image
image
Cursor_and_LSE_Local
image

Testing

  • Unit Tests:
    • Added EmptyState.test.tsx with unit tests for the new EmptyState component, verifying:
      • Correct rendering of icon, header, and description props.
      • Behavior of the "Learn more" link, including its absence in white-label mode.
  • Manual Verification:
    • Confirmed that the new empty states display correctly in the Info, Regions, Relations, and History panels.
    • Verified visibility and correct content in:
      • Quick view
      • Label stream
      • Review stream
      • Label config preview
    • Ensured "Learn more" links are appropriately hidden in white-labeled environments.
    • Confirmed new icons (IconHistoryRewind, IconLsLabeling, new relations icon) and text content match the specifications.

Reviewer notes

  • Please verify the correct display and behavior of the "Learn more" links, especially in the context of white-labeled environments. The utility utils/docs.ts handles the dynamic URL generation.
  • Note the refactoring in DetailsPanel.tsx and OutlinerPanel.tsx for improved typing and maintainability.

General notes

This PR focuses on improving the user experience by providing clear and helpful empty states in key areas of the outliner. The introduction of the reusable EmptyState component promotes consistency and maintainability. Additionally, the changes include general code quality improvements such as enhanced TypeScript typings and refactoring of component logic.

…tates for Info, Regions, Relations, and History panel in outliner
…to get the Community or Enterprise variant of a docs page. Improves history-rewind icon visual weight.
@ricardoantoniocm ricardoantoniocm self-assigned this Jun 4, 2025
Copy link

netlify bot commented Jun 4, 2025

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 8de9858
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/684757702bc80100080f8af0

Copy link

netlify bot commented Jun 4, 2025

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 8de9858
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/6847577015d8200008bcd6c4
😎 Deploy Preview https://deploy-preview-7694--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the feat label Jun 4, 2025
Copy link

netlify bot commented Jun 4, 2025

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 8de9858
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/684757702e6132000832aadd
😎 Deploy Preview https://deploy-preview-7694--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

netlify bot commented Jun 4, 2025

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 8de9858
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/68475770e124e6000827a456

@ricardoantoniocm ricardoantoniocm marked this pull request as ready for review June 5, 2025 14:52
@ricardoantoniocm ricardoantoniocm requested a review from makseq June 5, 2025 14:53
@ricardoantoniocm ricardoantoniocm requested a review from a team as a code owner June 5, 2025 15:17
@ricardoantoniocm ricardoantoniocm requested a review from Copilot June 5, 2025 15:59
Copilot

This comment was marked as outdated.

@ricardoantoniocm ricardoantoniocm requested a review from Copilot June 5, 2025 16:56
Copilot

This comment was marked as outdated.

ricardoantoniocm and others added 4 commits June 5, 2025 12:58
…ty-states-info-regions-relations-history-panel-outliner' of https://github.com/heartexlabs/label-studio into fb-bros-73/fe-create-more-informative-user-friendly-empty-states-info-regions-relations-history-panel-outliner
@ricardoantoniocm ricardoantoniocm requested a review from Copilot June 5, 2025 17:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a reusable EmptyState component and applies it to the Info, Regions (Outliner), Relations, and History panels to provide more informative, consistent empty states. It also adds dynamic documentation link utilities and fixes a typo in design tokens.

  • Added getDocsUrl utility for dynamic documentation links based on deployment
  • Created EmptyState component and integrated it into several side panels
  • Updated design tokens JSON to correct corner-radius token naming

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web/libs/editor/src/utils/docs.ts New utilities to compute deployment-aware docs URLs
web/libs/editor/src/components/SidePanels/Components/EmptyState.tsx New reusable empty-state component
web/libs/editor/src/components/SidePanels/OutlinerPanel/OutlinerPanel.tsx Use EmptyState for regions panel
web/libs/editor/src/components/SidePanels/DetailsPanel/DetailsPanel.tsx Use EmptyState for Info, Relations, History panels
web/design-tokens.json Fixed naming in typography/spacing tokens
web/libs/editor/jest.setup.js Added @testing-library/jest-dom setup
Comments suppressed due to low confidence (1)

web/design-tokens.json:5699

  • The $letter-spacing key appears twice in the same object, which will result in invalid JSON or stale overrides. Remove the duplicate block or rename it appropriately to avoid collisions.
"$letter-spacing": {

@hlomzik hlomzik changed the title feat: BROS-73: [FE] Create more informative user friendly empty states info regions relations history panel outliner feat: BROS-73: [FE] Create empty states for panels: info, regions, relations, history Jun 5, 2025
interface Window {
APP_SETTINGS?: {
whitelabel_is_active?: boolean;
[key: string]: any;
Copy link
Collaborator

Choose a reason for hiding this comment

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

that line is excess I believe. @bmartel ?

Suggested change
[key: string]: any;

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this it is. I don't particular like that we have to redefine in the global objects within a component, that part seems odd to me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

also true! we can just define all main props we use in APP_SETTINGS in types.d.ts

Copy link
Contributor

@bmartel bmartel Jun 6, 2025

Choose a reason for hiding this comment

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

We end up ts-ignore'ing it elsewhere, lets just ts-ignore it here too for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback! I've addressed it with the latest commit. Please review at your earliest. @hlomzik @bmartel .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants