@@ -11,10 +11,7 @@ import { isEnterprise } from '@/lib/billing/plan-helpers'
1111import { HEX_COLOR_REGEX } from '@/lib/branding'
1212import type { OrganizationWhitelabelSettings } from '@/lib/branding/types'
1313import { useDeploymentShape } from '@/lib/core/config/deployment-shape'
14- import {
15- CHIP_FIELD_INPUT ,
16- CHIP_FIELD_SHELL ,
17- } from '@/app/workspace/[workspaceId]/components/credential-detail'
14+ import { DropZone } from '@/app/workspace/[workspaceId]/components/drop-zone'
1815import { SettingsEmptyState } from '@/app/workspace/[workspaceId]/settings/components/settings-empty-state'
1916import { SettingsPanel } from '@/app/workspace/[workspaceId]/settings/components/settings-panel'
2017import { SettingsSection } from '@/app/workspace/[workspaceId]/settings/components/settings-section/settings-section'
@@ -31,42 +28,6 @@ import { useWorkspacesQuery } from '@/hooks/queries/workspace'
3128
3229const logger = createLogger ( 'WhitelabelingSettings' )
3330
34- interface DropZoneProps {
35- onDrop : ( e : React . DragEvent ) => void
36- children : React . ReactNode
37- className ?: string
38- }
39-
40- function DropZone ( { onDrop, children, className } : DropZoneProps ) {
41- const [ isDragging , setIsDragging ] = useState ( false )
42-
43- return (
44- < div
45- className = { cn ( 'relative' , className ) }
46- onDragOver = { ( e ) => {
47- if ( e . dataTransfer . types . includes ( 'Files' ) ) {
48- e . preventDefault ( )
49- setIsDragging ( true )
50- }
51- } }
52- onDragLeave = { ( e ) => {
53- if ( ! e . currentTarget . contains ( e . relatedTarget as Node ) ) {
54- setIsDragging ( false )
55- }
56- } }
57- onDrop = { ( e ) => {
58- setIsDragging ( false )
59- onDrop ( e )
60- } }
61- >
62- { children }
63- { isDragging && (
64- < div className = 'pointer-events-none absolute inset-0 z-10 rounded-lg border-[1.5px] border-[var(--brand-accent)] border-dashed bg-[color-mix(in_srgb,var(--brand-accent)_8%,transparent)]' />
65- ) }
66- </ div >
67- )
68- }
69-
7031interface ColorInputProps {
7132 label : string
7233 value : string
@@ -81,30 +42,31 @@ function ColorInput({ label, value, onChange, placeholder = '#000000' }: ColorIn
8142 return (
8243 < div className = 'flex flex-col gap-1.5' >
8344 < Label > { label } </ Label >
84- < div className = { cn ( CHIP_FIELD_SHELL , ! isValidHex && 'border-[var(--text-error)]' ) } >
85- < div
86- className = { cn (
87- 'size-[16px] shrink-0 rounded-sm border border-[var(--border-1)]' ,
88- ! showColor && 'bg-[var(--surface-3)]'
89- ) }
90- style = { showColor ? { backgroundColor : value } : undefined }
91- />
92- < input
93- value = { value }
94- onChange = { ( e ) => {
95- let v = e . target . value . trim ( )
96- if ( v && ! v . startsWith ( '#' ) ) {
97- v = `#${ v } `
98- }
99- v = v . slice ( 0 , 1 ) + v . slice ( 1 ) . replace ( / [ ^ 0 - 9 a - f A - F ] / g, '' )
100- onChange ( v . slice ( 0 , 7 ) )
101- } }
102- onFocus = { ( e ) => e . target . select ( ) }
103- placeholder = { placeholder }
104- maxLength = { 7 }
105- className = { cn ( CHIP_FIELD_INPUT , 'font-mono' ) }
106- />
107- </ div >
45+ < ChipInput
46+ error = { ! isValidHex }
47+ startAdornment = {
48+ < div
49+ className = { cn (
50+ 'size-[16px] shrink-0 rounded-sm border border-[var(--border-1)]' ,
51+ ! showColor && 'bg-[var(--surface-3)]'
52+ ) }
53+ style = { showColor ? { backgroundColor : value } : undefined }
54+ />
55+ }
56+ value = { value }
57+ onChange = { ( e ) => {
58+ let v = e . target . value . trim ( )
59+ if ( v && ! v . startsWith ( '#' ) ) {
60+ v = `#${ v } `
61+ }
62+ v = v . slice ( 0 , 1 ) + v . slice ( 1 ) . replace ( / [ ^ 0 - 9 a - f A - F ] / g, '' )
63+ onChange ( v . slice ( 0 , 7 ) )
64+ } }
65+ onFocus = { ( e ) => e . target . select ( ) }
66+ placeholder = { placeholder }
67+ maxLength = { 7 }
68+ inputClassName = 'font-mono'
69+ />
10870 { ! isValidHex && (
10971 < p className = 'text-[var(--text-error)] text-caption' >
11072 Must be a valid hex color (e.g. #33c482)
0 commit comments