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

feat: DIA-1783: [FE] Prep work - Tailwind + shadcn cross integration in LSO + LSE #6870

Merged
merged 41 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
86cc448
Adding tailwind (wip)
nick-skriabin Dec 6, 2024
b3ed266
Merge branch 'develop' into tailwind
nick-skriabin Dec 6, 2024
d220c4e
Adding Tailwind and shadcn UI
nick-skriabin Dec 12, 2024
4aa7085
Fix global styles
nick-skriabin Dec 12, 2024
a3ec3d6
setting up storybook
nick-skriabin Dec 27, 2024
f84e442
Merge branch 'develop' into tailwind
nick-skriabin Jan 7, 2025
93cb876
Move Tailwind config to UI lib
nick-skriabin Jan 7, 2025
6318bf6
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin Jan 7, 2025
0a03083
Tailwind and shadcn cross-repo setup
nick-skriabin Jan 8, 2025
9e063ea
Remove testing code
nick-skriabin Jan 8, 2025
2afc869
Rollback unnecessary changes
nick-skriabin Jan 8, 2025
3572a74
Remove dist changes
nick-skriabin Jan 8, 2025
0707aaf
Fix logo size
nick-skriabin Jan 8, 2025
606568d
Properly set up shadcn components installation, remove dist changes
nick-skriabin Jan 9, 2025
88190aa
Restore dist to develop state
nick-skriabin Jan 9, 2025
8dca930
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin Jan 9, 2025
c9204a3
Update web/apps/labelstudio/src/pages/Settings/GeneralSettings.jsx
nick-skriabin Jan 13, 2025
92d627f
Remove and ignore dist
nick-skriabin Jan 13, 2025
fc943a4
Ignore dist
nick-skriabin Jan 13, 2025
3eb160f
fix icon
nick-skriabin Jan 13, 2025
fcf9963
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin Jan 13, 2025
33a6e93
Remove excess code
nick-skriabin Jan 14, 2025
df8ba6e
Restore dist (to many changes)
nick-skriabin Jan 14, 2025
9d5e25b
Update web/apps/labelstudio/src/components/Menubar/Menubar.jsx
nick-skriabin Jan 17, 2025
07a9bc7
Remove unnecessary files
nick-skriabin Jan 17, 2025
19b9df3
Keeping one location for stories (libs/storybook)
nick-skriabin Jan 17, 2025
87e49c2
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin Jan 17, 2025
eb54285
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin Jan 20, 2025
4e8fb29
Dist
nick-skriabin Jan 20, 2025
3e5f3ef
Add UI icons
nick-skriabin Jan 20, 2025
e3813d8
Update stylelint and biome
nick-skriabin Jan 20, 2025
451e1ea
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin Jan 22, 2025
9f34cc7
Rollback unnecessary changes
nick-skriabin Jan 22, 2025
a07ab67
storybook
nick-skriabin Jan 22, 2025
f5de72f
Storybook setup
nick-skriabin Jan 22, 2025
b67c273
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin Jan 23, 2025
b41dec7
Fix formatting
nick-skriabin Jan 23, 2025
6a4a8a5
Fix formatting
nick-skriabin Jan 23, 2025
be6debb
Add docs references
nick-skriabin Jan 23, 2025
23d5e86
Upgrade to Tailwind 4
nick-skriabin Jan 23, 2025
a14a254
Merge branch 'develop' into fb-dia-1783/tailwind
nick-skriabin Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions Dockerfile.development
nick-skriabin marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# syntax=docker/dockerfile:1
ARG NODE_VERSION=18
ARG PYTHON_VERSION=3.12
ARG POETRY_VERSION=1.8.4
ARG VERSION_OVERRIDE
ARG BRANCH_OVERRIDE

################################ Overview

# This Dockerfile builds a Label Studio environment.
# It consists of three main stages:
# 1. "frontend-builder" - Compiles the frontend assets using Node.
# 2. "frontend-version-generator" - Generates version files for frontend sources.
# 3. "venv-builder" - Prepares the virtualenv environment.
# 4. "py-version-generator" - Generates version files for python sources.
# 5. "prod" - Creates the final production image with the Label Studio, Nginx, and other dependencies.

################################ Stage: frontend-builder (build frontend assets)
FROM --platform=${BUILDPLATFORM} node:${NODE_VERSION} AS frontend-builder
WORKDIR /label-studio/web

COPY web .
COPY pyproject.toml ../pyproject.toml

################################ Stage: venv-builder (prepare the virtualenv)
FROM python:${PYTHON_VERSION}-slim AS venv-builder
ARG POETRY_VERSION

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
PIP_CACHE_DIR="/.cache" \
POETRY_CACHE_DIR="/.poetry-cache" \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
PATH="/opt/poetry/bin:$PATH"

ADD https://install.python-poetry.org /tmp/install-poetry.py
RUN python /tmp/install-poetry.py

RUN --mount=type=cache,target="/var/cache/apt",sharing=locked \
--mount=type=cache,target="/var/lib/apt/lists",sharing=locked \
set -eux; \
apt-get update; \
apt-get install --no-install-recommends -y \
build-essential git; \
apt-get autoremove -y

WORKDIR /label-studio

ENV VENV_PATH="/label-studio/.venv"
ENV PATH="$VENV_PATH/bin:$PATH"

## Starting from this line all packages will be installed in $VENV_PATH

# Copy dependency files
COPY pyproject.toml poetry.lock README.md ./

# Install dependencies without dev packages
RUN --mount=type=cache,target=$POETRY_CACHE_DIR,sharing=locked \
poetry check --lock && poetry install --no-root --without test --extras uwsgi

# Install LS
COPY label_studio label_studio
RUN --mount=type=cache,target=$POETRY_CACHE_DIR,sharing=locked \
# `--extras uwsgi` is mandatory here due to poetry bug: https://github.com/python-poetry/poetry/issues/7302
poetry install --only-root --extras uwsgi && \
python3 label_studio/manage.py collectstatic --no-input

################################ Stage: py-version-generator
FROM venv-builder AS py-version-generator
ARG VERSION_OVERRIDE
ARG BRANCH_OVERRIDE

# Create version_.py and ls-version_.py
RUN --mount=type=bind,source=.git,target=./.git \
VERSION_OVERRIDE=${VERSION_OVERRIDE} BRANCH_OVERRIDE=${BRANCH_OVERRIDE} poetry run python label_studio/core/version.py

################################### Stage: prod
FROM python:${PYTHON_VERSION}-slim AS production

ENV LS_DIR=/label-studio \
HOME=/label-studio \
LABEL_STUDIO_BASE_DATA_DIR=/label-studio/data \
OPT_DIR=/opt/heartex/instance-data/etc \
PATH="/label-studio/.venv/bin:$PATH" \
DJANGO_SETTINGS_MODULE=core.settings.label_studio \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1

WORKDIR $LS_DIR

# install prerequisites for app
RUN --mount=type=cache,target="/var/cache/apt",sharing=locked \
--mount=type=cache,target="/var/lib/apt/lists",sharing=locked \
set -eux; \
apt-get update; \
apt-get upgrade -y; \
apt-get install --no-install-recommends -y libexpat1 \
gnupg2 curl; \
apt-get autoremove -y

# install nginx
RUN --mount=type=cache,target="/var/cache/apt",sharing=locked \
--mount=type=cache,target="/var/lib/apt/lists",sharing=locked \
set -eux; \
curl -sSL https://nginx.org/keys/nginx_signing.key | gpg --dearmor -o /etc/apt/keyrings/nginx-archive-keyring.gpg >/dev/null; \
DEBIAN_VERSION=$(awk -F '=' '/^VERSION_CODENAME=/ {print $2}' /etc/os-release); \
printf "deb [signed-by=/etc/apt/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/debian ${DEBIAN_VERSION} nginx\n" > /etc/apt/sources.list.d/nginx.list; \
printf "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" > /etc/apt/preferences.d/99nginx; \
apt-get update; \
apt-get install --no-install-recommends -y nginx; \
apt-get autoremove -y

RUN set -eux; \
mkdir -p $LS_DIR $LABEL_STUDIO_BASE_DATA_DIR $OPT_DIR && \
chown -R 1001:0 $LS_DIR $LABEL_STUDIO_BASE_DATA_DIR $OPT_DIR /var/log/nginx /etc/nginx

COPY --chown=1001:0 deploy/default.conf /etc/nginx/nginx.conf

# Copy essential files for installing Label Studio and its dependencies
COPY --chown=1001:0 pyproject.toml .
COPY --chown=1001:0 poetry.lock .
COPY --chown=1001:0 README.md .
COPY --chown=1001:0 LICENSE LICENSE
COPY --chown=1001:0 licenses licenses
COPY --chown=1001:0 deploy deploy

# Copy files from build stages
COPY --chown=1001:0 --from=venv-builder $LS_DIR $LS_DIR
COPY --chown=1001:0 --from=py-version-generator $LS_DIR/label_studio/core/version_.py $LS_DIR/label_studio/core/version_.py
COPY --chown=1001:0 --from=frontend-builder $LS_DIR/web/dist $LS_DIR/web/dist

USER 1001

EXPOSE 8080

ENTRYPOINT ["./deploy/docker-entrypoint.sh"]
CMD ["label-studio"]
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9"
services:
nginx:
build: .
Expand Down
5 changes: 5 additions & 0 deletions package.json
nick-skriabin marked this conversation as resolved.
Show resolved Hide resolved
nick-skriabin marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"shadcn": "2.1.6"
}
}
2 changes: 1 addition & 1 deletion web/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "stylelint-config-standard-scss",
"extends": ["stylelint-config-standard-scss", "stylelint-config-tailwindcss", "stylelint-config-tailwindcss/scss"],
"rules": {
"selector-class-pattern": null,
"custom-property-pattern": null,
Expand Down
1 change: 1 addition & 0 deletions web/apps/labelstudio/src/app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ErrorBoundary from "./ErrorBoundary";
import { RootPage } from "./RootPage";
import { FF_OPTIC_2, FF_UNSAVED_CHANGES, isFF } from "../utils/feature-flags";
import { ToastProvider, ToastViewport } from "@humansignal/ui";
import "@humansignal/ui/src/tailwind.css";

const baseURL = new URL(APP_SETTINGS.hostname || location.origin);
export const UNBLOCK_HISTORY_MESSAGE = "UNBLOCK_HISTORY";
Expand Down
7 changes: 6 additions & 1 deletion web/apps/labelstudio/src/components/Menubar/Menubar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ export const Menubar = ({ enabled, defaultOpened, defaultPinned, children, onSid
<div className={menubarClass}>
<Dropdown.Trigger dropdown={menuDropdownRef} closeOnClickOutside={!sidebarPinned}>
<div className={`${menubarClass.elem("trigger")} main-menu-trigger`}>
<img src={absoluteURL("/static/icons/logo.svg")} alt="Label Studio Logo" height="22" />
<img
src={absoluteURL("/static/icons/logo.svg")}
alt="Label Studio Logo"
height="22"
nick-skriabin marked this conversation as resolved.
Show resolved Hide resolved
style={{ height: 22 }}
/>
<Hamburger opened={sidebarOpened} />
</div>
</Dropdown.Trigger>
Expand Down
3 changes: 2 additions & 1 deletion web/apps/labelstudio/src/pages/Settings/GeneralSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const GeneralSettings = () => {
return (
<Block name="general-settings">
<Elem name={"wrapper"}>
<h1>General Settings</h1>
<h1>General Settings!</h1>

nick-skriabin marked this conversation as resolved.
Show resolved Hide resolved
<Block name="settings-wrapper">
<Form action="updateProject" formData={{ ...project }} params={{ pk: project.id }} onSubmit={updateProject}>
<Form.Row columnCount={1} rowGap="16px">
Expand Down
21 changes: 21 additions & 0 deletions web/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "libs/ui/src/tailwind.config.js",
"css": "libs/ui/src/tailwind.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@humansignal/shad/components",
"ui": "@humansignal/shad/components/ui",
"utils": "@humansignal/shad/utils",
"lib": "@humansignal/shad/lib",
"hooks": "@humansignal/shad/hooks"
},
"iconLibrary": "lucide"
}
1 change: 0 additions & 1 deletion web/dist/apps/labelstudio/139.css.map
nick-skriabin marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

1 change: 0 additions & 1 deletion web/dist/apps/labelstudio/139.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/543.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/543.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/543.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/543.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/dist/apps/labelstudio/709.css.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web/dist/apps/labelstudio/709.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/runtime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/runtime.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/vendor.js

Large diffs are not rendered by default.

Loading
Loading