Better environment color picker (#282)

This commit is contained in:
Gregory Schier
2025-10-26 12:05:03 -07:00
committed by GitHub
parent 923b1ac830
commit 3f5b5a397c
10 changed files with 233 additions and 64 deletions

View File

@@ -49,7 +49,7 @@ export function getCharsetFromContentType(headers: HttpResponseHeader[]): string
}
export function isBaseEnvironment(environment: Environment): boolean {
return environment.parentId == null;
return environment.parentModel == 'workspace';
}
export function isSubEnvironment(environment: Environment): boolean {

View File

@@ -1,17 +1,17 @@
import type { Environment } from '@yaakapp-internal/models';
import { patchModel } from '@yaakapp-internal/models';
import { showDialog } from './dialog';
import { EnvironmentColorPicker } from '../components/EnvironmentColorPicker';
import { showDialog } from './dialog';
export function showColorPicker(environment: Environment) {
showDialog({
title: 'Environment Color',
id: 'color-picker',
size: 'dynamic',
size: 'sm',
render: ({ hide }) => {
return (
<EnvironmentColorPicker
color={environment.color ?? '#54dc44'}
color={environment.color}
onChange={async (color) => {
await patchModel(environment, { color });
hide();