-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat: FIT-14: LabelStudio Playground 2.0 #7521
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
base: develop
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for label-studio-docs-new-theme canceled.
|
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for heartex-docs canceled.
|
className="relative h-[33px] flex flex-row items-center bg-neutral-surface select-none" | ||
style={{ minHeight: HEADER_HEIGHT, maxHeight: HEADER_HEIGHT }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should do the same thing with out inline styles but if we have the height set - why do we need min and max set too?
className="relative h-[33px] flex flex-row items-center bg-neutral-surface select-none" | |
style={{ minHeight: HEADER_HEIGHT, maxHeight: HEADER_HEIGHT }} | |
className={`relative h-[${HEADER_HEIGHT}px] flex flex-row items-center bg-neutral-surface select-none min-h-[${HEADER_HEIGHT}px] max-h-[${HEADER_HEIGHT}px]`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, if we need to have this height fixed:
h-[${HEADER_HEIGHT}px]
- no min/max
- flex-shrink: 0
className="lsf-button lsf-button_look_ lsf-collapsible-bottom-panel-toggle absolute right-[5px] top-1/2 -translate-y-1/2 !h-6 !w-6 !p-0 flex items-center justify-center !bg-transparent !border-none" | ||
style={{ zIndex: 10 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should do the same - but maybe there is a cleaner z-index class that does this?
className="lsf-button lsf-button_look_ lsf-collapsible-bottom-panel-toggle absolute right-[5px] top-1/2 -translate-y-1/2 !h-6 !w-6 !p-0 flex items-center justify-center !bg-transparent !border-none" | |
style={{ zIndex: 10 }} | |
className="lsf-button lsf-button_look_ lsf-collapsible-bottom-panel-toggle absolute right-[5px] top-1/2 -translate-y-1/2 !h-6 !w-6 !p-0 flex items-center justify-center !bg-transparent !border-none z-[10]" |
const setLoading = useSetAtom(loadingAtom); | ||
const setError = useSetAtom(errorAtom); | ||
const setInterfaces = useSetAtom(interfacesAtom); | ||
const [editorWidth, setEditorWidth] = useState(50); // percent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use a constant as the default value instead of a magic 50
web/libs/editor/src/LabelStudio.tsx
Outdated
|
||
const renderApp = () => { | ||
if (isRendered) { | ||
clearRenderedApp(); | ||
} | ||
render(<App store={this.store} />, rootElement); | ||
renderTimeout = setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to render it like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were errors when unmounting/remounting in quick succession. I am still adjusting for what I have been seeing in different usages, so this could be made redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good! in any case the final version better to have the reasoning described in a comment
document.body.style.cursor = "col-resize"; | ||
document.body.style.userSelect = "none"; | ||
const percent = (e.clientX / window.innerWidth) * 100; | ||
setEditorWidth(Math.max(20, Math.min(80, percent))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we set the default min and max (20 and 80) as constants so we're not using magic numbers
e.preventDefault(); | ||
document.body.style.cursor = ""; | ||
document.body.style.userSelect = ""; | ||
setEditorWidth(50); // Reset to 50/50 split |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should use the constant from earlier for 50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have a number of relatively minor suggestions but overall looks good - would love to see this get to production
…es with an empty string name
This pull request introduces the foundational setup and implementation of the LabelStudio Playground, a standalone React application for editing and previewing LabelStudio XML labeling configurations. This implementation will serve as the replacement of the defunct playground used on labelstud.io.
Project Setup and Configuration
.babelrc
file to configure Babel with the@nx/react/babel
preset for automatic runtime.jest.config.ts
file for unit testing, with support for Babel transformations and module name mapping.project.json
file to define build, serve, and test targets using Nx executors for Webpack and Jest.Documentation and Overview
README.mdc
file detailing the purpose of the Playground app, its features, architecture, state management, and extensibility.State Management
configAtoms.ts
to manage application state, including configuration, loading, error, and annotation data.UI Components
BottomPanel
component to display sample data input and annotation output, with collapsible and resizable functionality. [1] [2]EditorPanel
component for XML editing with a resizable bottom panel for input/output display. [1] [2]Styling
PlaygroundApp.module.scss
to lightly customize the appearance of CodeMirror and LabelStudio components.