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(ui): add dark mode #1998

Merged
merged 53 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
135b187
Add next-themes package dependency
RichardKruemmel May 7, 2024
23fc1c2
Add dark mode theme provider component
RichardKruemmel May 7, 2024
a43e375
Add theming guidelines to CONTRIBUTING.md
RichardKruemmel May 7, 2024
73a1a10
Update web/src/pages/_app.tsx
RichardKruemmel May 8, 2024
4b1a079
Update theming approach to include shadcn color palette.
RichardKruemmel May 8, 2024
903d819
Merge branch 'main' into richard/lfe-1082
RichardKruemmel May 14, 2024
b098256
Update theming guidelines and add new color definitions
RichardKruemmel May 14, 2024
bc23596
feat(ui): implement dark mode (#2013)
RichardKruemmel May 15, 2024
294cc89
Add muted-gray color to tailwind.config.ts
RichardKruemmel May 17, 2024
cb00e30
Update badge color in StatusBadge component
RichardKruemmel May 17, 2024
390b196
Refactor UI styling in IOPreview and OpenAiMessageView components
RichardKruemmel May 17, 2024
4e31235
Update text color in ObservationTree component
RichardKruemmel May 17, 2024
6f54412
Update dialog overlay background opacity
RichardKruemmel May 17, 2024
325cb64
Refactor input component styles
RichardKruemmel May 17, 2024
81ac3f7
Refactor NoData component styling
RichardKruemmel May 17, 2024
9776cb7
Update color variables in globals.css
RichardKruemmel May 17, 2024
937b474
Update color variables in globals.css and tailwind.config.ts
RichardKruemmel May 21, 2024
26598f0
Update TableLink styles
RichardKruemmel May 21, 2024
09bab1d
Update styling for IOPreview and OpenAiMessageView components
RichardKruemmel May 21, 2024
15edd71
Refactor CodeJsonViewer component
RichardKruemmel May 21, 2024
cd37bfd
Merge branch 'main' into richard/lfe-1082
RichardKruemmel May 21, 2024
c7cf199
Update layout styling in layout.tsx
RichardKruemmel May 21, 2024
dbc39d5
Add muted-primary-accent color to globals.css and tailwind.config.ts
RichardKruemmel May 21, 2024
39633ce
Update text color for disabled elements in ModelParameters component
RichardKruemmel May 21, 2024
f97af97
Refactor DataTable styling
RichardKruemmel May 21, 2024
1c14a86
Update table header background color
RichardKruemmel May 21, 2024
24075aa
Update Divider color in Variables component
RichardKruemmel May 21, 2024
c80a737
Update text color and class names in AuthCloudRegionSwitch component
RichardKruemmel May 21, 2024
e398208
Refactor tab component styles
RichardKruemmel May 21, 2024
96e67bf
Update sign-up link styling
RichardKruemmel May 21, 2024
1a471e4
Reorder class names in Sign Up page link
RichardKruemmel May 21, 2024
b4cd8a3
Update '@tanstack/react-virtual' version to 3.5.0
RichardKruemmel May 21, 2024
5ead61f
Update color variables in globals.css and tailwind.config.ts
RichardKruemmel May 21, 2024
14a8652
Update hover text color in sign-in and sign-up links
RichardKruemmel May 21, 2024
a835919
Update DatasetActionButton styles
RichardKruemmel May 21, 2024
144229f
Fix styling issue in UserPage component
RichardKruemmel May 21, 2024
c4f90df
Update tab component styles
RichardKruemmel May 21, 2024
f1e1a8f
Update class names and remove unnecessary styling in AuthCloudRegionS…
RichardKruemmel May 21, 2024
d9c50d0
Update TableLink styling
RichardKruemmel May 21, 2024
95e32cb
Fix styling issue in OpenAiMessageView component
RichardKruemmel May 21, 2024
5ad2f3c
Refactor CodeJsonViewer component
RichardKruemmel May 21, 2024
2c23ae5
Update CSS variables and color conventions
RichardKruemmel May 21, 2024
3f5692f
Update layout styling in Layout component
RichardKruemmel May 21, 2024
2cfe139
Update status colors in DatasetItemsTable
RichardKruemmel May 21, 2024
9d0c4f1
Refactor TagInput component styles
RichardKruemmel May 21, 2024
08cfa1a
Merge branch 'main' into richard/lfe-1082
RichardKruemmel May 21, 2024
faf3052
Update Card class in TraceCardList component
RichardKruemmel May 21, 2024
ebd751b
Update Langchain input in QuickstartExamples.tsx
RichardKruemmel May 21, 2024
0b1aa06
use typing
marcklingen May 21, 2024
1420639
Fix typo
RichardKruemmel May 22, 2024
3bc892d
Change to default light mode
RichardKruemmel May 22, 2024
6f193ca
Fix userNavigation
RichardKruemmel May 22, 2024
3e06c59
Revert default theme to system
RichardKruemmel May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
68 changes: 68 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,74 @@ When a new release is tagged on the `main` branch (excluding prereleases), it tr
1. The Docker image is published to GitHub Packages with the version number and `latest` tag.
2. The deployment is carried out on Langfuse Cloud. This is done by force pushing the `main` branch to the `production` branch during every release, using the [`release.yml`](.github/workflows/release.yml) GitHub Action.

## Theming

At Langfuse, we utilize CSS variables to manage our theme settings across the platform.

Our approach leverages separate CSS variables for backgrounds (--background) and foregrounds (--foreground), fully adhering to the [shadcn/ui](https://ui.shadcn.com/docs/theming) color conventions. The background suffix can be omitted if the variable is used for the background color of the component. We recommend using HSL values for these colors to enhance consistency and customization. There is no need to manually handle dark mode styling with "dark:" prefixes, as next-themes automatically manages the theme switching.

Given the following CSS variables:

```
--primary: 222.2 47.4% 11.2%; // e.g. background-color
--primary-foreground: 210 40% 98%; // e.g. text-color
```

The background color of the following component will be `hsl(var(--primary))` and the foreground color will be `hsl(var(--primary-foreground))`.

```
<div class="bg-primary text-primary-foreground">Hello</div>
```

### Color Variables

| Variable | Description | Examples |
| ------------------------ | ------------------------------------------------------------------ | -------------------------------- |
| --background | Background color | Default background color of body |
| --foreground | Foreground color | Default text color of body |
| --muted | Muted background color | TabsList, Skeleton and Switch |
| --muted-foreground | Muted foreground color | |
| --popover | Popover background color | DropdownMenu, HoverCard, Popover |
| --popover-foreground | Popover foreground color | |
| --card | Card background color | Card |
| --card-foreground | Card foreground color | |
| --border | Border color | Default border color |
| --input | Input field border color | Input, Select, Textarea |
| --primary | Primary button background colors | Button variant="primary" |
| --primary-foreground | Primary button foreground color | |
| --secondary | Secondary button background color | Button variant="secondary" |
| --secondary-foreground | Secondary button foreground color | |
| --accent | Used for accents such as hover effects | DropdownMenuItem, SelectItem |
| --accent-foreground | Used for texts on hover effects | DropdownMenuItem, SelectItem |
| --destructive | Destructive action color for background | Button variant="destructive" |
| --destructive-foreground | Destructive action color for text | |
| --ring | Focus ring color | MultiSelect |
| --primary-accent | Primary accent color used for branding | Layout |
| --hover-primary-accent | Primary accent color used for hover effects for links | SignIn and AuthCloudRegionSwitch |
| --muted-green | Muted green for Event label | ObservationTree |
| --muted-orange | Muted orange for Generation label | ObservationTree |
| --muted-blue | Muted blue for Span label | ObservationTree |
| --muted-gray | Muted gray for disabled status badges | StatusBadge |
| --accent-light-green | Light green accent for background of output and assistant messages | IOPreview, Generations, Traces |
| --accent-dark-green | Dark green accent for border of output and assistant messages | CodeJsonViewer and IOPReview |
| --light-red | Light red for error background | level-color and StatusBadge |
| --dark-red | Dark red for error text and error badge dot color | level-color and ErrorPage |
| --light-yellow | Light yellow for warning background | LevelColor |
| --dark-yellow | Dark yellow for warning text | LevelColor |
| --light-green | Light green for success status badge background | StatusBadge |
| --dark-green | Dark green for success status badge text and dot | StatusBadge |
| --light-blue | Light blue for background of Staging label | LangfuseLogo |
| --dark-blue | Dark blue for text and border of Staging label | LangfuseLogo |
| --accent-light-blue | Light blue accent for table link hover effect | TableLink |
| --accent-dark-blue | Dark blue accent for table link text | TableLink |

### Adding New Colors

1. Global Definitions: Add new CSS variable definitions in the global.css file.
2. Tailwind Configuration: Reflect these new colors in the tailwind.config.js to maintain alignment with Tailwind's utility classes.

By following these guidelines, you can ensure that any contributions to our theme are consistent, maintainable, and aligned with our design system.

## Using secrets stored in 1Password

When applying changes to non-local environments, you may need to use secrets stored in 1Password. We use the 1Password CLI for this purpose.
Expand Down
86 changes: 68 additions & 18 deletions pnpm-lock.yaml

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

9 changes: 6 additions & 3 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"@aws-sdk/lib-storage": "^3.568.0",
"@aws-sdk/s3-request-presigner": "^3.554.0",
"@codemirror/lang-json": "^6.0.1",
"@headlessui/react": "^1.7.19",
"@headlessui/react": "1.7.18",
"@headlessui/tailwindcss": "0.2.0",
"@heroicons/react": "^2.1.3",
"@hookform/resolvers": "^3.3.4",
"@langchain/anthropic": "^0.1.16",
Expand Down Expand Up @@ -57,6 +58,7 @@
"@radix-ui/react-tooltip": "^1.0.7",
"@react-email/components": "^0.0.17",
"@react-email/render": "^0.0.13",
"@remixicon/react": "^4.2.0",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@sentry/nextjs": "^7.113.0",
Expand All @@ -65,11 +67,10 @@
"@sentry/types": "^7.113.0",
"@t3-oss/env-nextjs": "^0.8.0",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/forms": "^0.5.7",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-table": "^8.11.8",
"@tremor/react": "3.16.2",
"@tanstack/react-virtual": "^3.5.0",
"@tremor/react": "3.11.1",
"@trpc/client": "^10.45.0",
"@trpc/next": "^10.45.0",
"@trpc/react-query": "^10.45.0",
Expand All @@ -95,6 +96,7 @@
"next": "^14.2.3",
"next-auth": "^4.24.7",
"next-query-params": "^5.0.0",
"next-themes": "^0.3.0",
"nodemailer": "^6.9.13",
"posthog-js": "^1.122.0",
"posthog-node": "^3.6.3",
Expand All @@ -118,6 +120,7 @@
"@jedmao/location": "^3.0.0",
"@mermaid-js/mermaid-cli": "^10.7.0",
"@playwright/test": "^1.43.1",
"@tailwindcss/forms": "^0.5.7",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.6",
"@types/bcryptjs": "^2.4.6",
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/LangfuseLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export const LangfuseLogo = ({
className={cn(
"flex items-center gap-2 self-stretch rounded-md px-1 py-1 text-xs ring-1 sm:px-3 sm:py-2 lg:-mx-2",
env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "STAGING"
? "bg-blue-100 text-blue-500 ring-blue-500"
? "bg-light-blue text-dark-blue ring-dark-blue"
: env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "DEV"
? "bg-green-100 text-green-500 ring-green-500"
: "bg-red-100 text-red-500 ring-red-500",
? "bg-light-green text-dark-green ring-dark-green"
: "bg-light-red text-dark-red ring-dark-red",
)}
>
{env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "DEV" ? (
Expand Down Expand Up @@ -76,7 +76,7 @@ export const LangfuseLogo = ({
target="_blank"
rel="noopener"
title="View releases on GitHub"
className="ml-2 text-xs text-gray-400"
className="ml-2 text-xs text-muted-foreground"
>
{VERSION}
</a>
Expand Down
9 changes: 7 additions & 2 deletions web/src/components/ModelParameters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ const ModelParamsSelect = ({
}: ModelParamsSelectProps) => {
return (
<div className="space-y-2">
<p className={cn("text-xs font-semibold", disabled && "text-gray-400")}>
<p
className={cn(
"text-xs font-semibold",
disabled && "text-muted-foreground",
)}
>
{title}
</p>
<Select
Expand Down Expand Up @@ -187,7 +192,7 @@ const ModelParamsSlider = ({
<p
className={cn(
"flex-1 text-xs font-semibold",
(!enabled || formDisabled) && "text-gray-400",
(!enabled || formDisabled) && "text-muted-foreground",
)}
>
{title}
Expand Down