Skip to content

Commit

Permalink
chore: various review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-dewit committed Dec 10, 2024
1 parent 80ae9d8 commit 50d869e
Show file tree
Hide file tree
Showing 18 changed files with 210 additions and 332 deletions.
37 changes: 1 addition & 36 deletions packages/blueprints-integration/src/userEditing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import { SourceLayerType } from './content'
/**
* Description of a user performed editing operation allowed on an document
*/
export type UserEditingDefinition =
| UserEditingDefinitionAction
| UserEditingDefinitionForm
| UserEditingDefinitionSourceLayerForm
export type UserEditingDefinition = UserEditingDefinitionAction | UserEditingDefinitionForm

/**
* A simple 'action' that can be performed
Expand All @@ -26,8 +23,6 @@ export interface UserEditingDefinitionAction {
svgIconInactive?: string
/** Whether this action should be indicated as being active */
isActive?: boolean
/** Button Type */
buttonType?: UserEditingButtonType
}

/**
Expand All @@ -45,32 +40,11 @@ export interface UserEditingDefinitionForm {
currentValues: Record<string, any>
}

/**
* A form based operation where the user first selects the type
* of form they want to use (i.e. Camera form vs VT form)
*/
export interface UserEditingDefinitionSourceLayerForm {
type: UserEditingType.SOURCE_LAYER_FORM
/** Id of this operation */
id: string
/** Label to show to the user for this operation */
label: ITranslatableMessage
/** The json schemas describing the form to display */
schemas: Record<string, UserEditingSourceLayer>
/** Current values to populate the form with */
currentValues: {
type: SourceLayerType
value: Record<string, any>
}
}

export enum UserEditingType {
/** Action */
ACTION = 'action',
/** Form */
FORM = 'form',
/** Forms that the user has to select a sourceLayerType first */
SOURCE_LAYER_FORM = 'sourceLayerForm',
}

export interface UserEditingSourceLayer {
Expand All @@ -80,15 +54,6 @@ export interface UserEditingSourceLayer {
defaultValue?: Record<string, any>
}

export enum UserEditingButtonType {
/** Button */
BUTTON = 'button',
/** Icon */
SWITCH = 'switch',
/** Hidden */
HIDDEN = 'hidden',
}

export interface UserEditingProperties {
/**
* These properties are dependent on the (primary) piece type, the user will get the option
Expand Down
30 changes: 1 addition & 29 deletions packages/corelib/src/dataModel/UserEditingDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@ import type {
JSONBlob,
JSONSchema,
UserEditingSourceLayer,
UserEditingButtonType,
SourceLayerType,
} from '@sofie-automation/blueprints-integration'
import type { ITranslatableMessage } from '../TranslatableMessage'

export type CoreUserEditingDefinition =
| CoreUserEditingDefinitionAction
| CoreUserEditingDefinitionForm
| CoreUserEditingDefinitionSourceLayerForm
export type CoreUserEditingDefinition = CoreUserEditingDefinitionAction | CoreUserEditingDefinitionForm

export interface CoreUserEditingDefinitionAction {
type: UserEditingType.ACTION
Expand All @@ -25,8 +20,6 @@ export interface CoreUserEditingDefinitionAction {
svgIconInactive?: string
/** Whether this action should be indicated as being active */
isActive?: boolean
//** Button Type */
buttonType?: UserEditingButtonType
}

/**
Expand All @@ -46,27 +39,6 @@ export interface CoreUserEditingDefinitionForm {
translationNamespaces: string[]
}

/**
* A form based operation where the user first selects the type
* of form they want to use (i.e. Camera form vs VT form)
*/
export interface CoreUserEditingDefinitionSourceLayerForm {
type: UserEditingType.SOURCE_LAYER_FORM
/** Id of this operation */
id: string
/** Label to show to the user for this operation */
label: ITranslatableMessage
/** Sourcelayer Type */
schemas: Record<string, UserEditingSourceLayer>
/** Translation namespaces to use when rendering this form */
translationNamespaces: string[]
/** Current values to populate the form with */
currentValues: {
type: SourceLayerType
value: Record<string, any>
}
}

export interface CoreUserEditingProperties {
/**
* These properties are dependent on the (primary) piece type, the user will get the option
Expand Down
23 changes: 0 additions & 23 deletions packages/job-worker/src/blueprints/context/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
CoreUserEditingDefinition,
CoreUserEditingDefinitionAction,
CoreUserEditingDefinitionForm,
CoreUserEditingDefinitionSourceLayerForm,
CoreUserEditingProperties,
} from '@sofie-automation/corelib/dist/dataModel/UserEditingDefinitions'
import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
Expand Down Expand Up @@ -58,7 +57,6 @@ import {
UserEditingDefinition,
UserEditingDefinitionAction,
UserEditingDefinitionForm,
UserEditingDefinitionSourceLayerForm,
UserEditingProperties,
UserEditingType,
} from '@sofie-automation/blueprints-integration/dist/userEditing'
Expand Down Expand Up @@ -521,7 +519,6 @@ function translateUserEditsToBlueprint(
svgIcon: userEdit.svgIcon,
svgIconInactive: userEdit.svgIconInactive,
isActive: userEdit.isActive,
buttonType: userEdit.buttonType,
} satisfies Complete<UserEditingDefinitionAction>
case UserEditingType.FORM:
return {
Expand All @@ -531,14 +528,6 @@ function translateUserEditsToBlueprint(
schema: clone(userEdit.schema),
currentValues: clone(userEdit.currentValues),
} satisfies Complete<UserEditingDefinitionForm>
case UserEditingType.SOURCE_LAYER_FORM:
return {
type: UserEditingType.SOURCE_LAYER_FORM,
id: userEdit.id,
label: omit(userEdit.label, 'namespaces'),
schemas: clone(userEdit.schemas),
currentValues: clone(userEdit.currentValues),
} satisfies Complete<UserEditingDefinitionSourceLayerForm>
default:
assertNever(userEdit)
return undefined
Expand All @@ -565,7 +554,6 @@ function translateUserEditPropertiesToBlueprint(
svgIcon: userEdit.svgIcon,
svgIconInactive: userEdit.svgIconInactive,
isActive: userEdit.isActive,
buttonType: userEdit.buttonType,
} satisfies Complete<UserEditingDefinitionAction>)
),
}
Expand All @@ -588,7 +576,6 @@ export function translateUserEditsFromBlueprint(
svgIcon: userEdit.svgIcon,
svgIconInactive: userEdit.svgIconInactive,
isActive: userEdit.isActive,
buttonType: userEdit.buttonType,
} satisfies Complete<CoreUserEditingDefinitionAction>
case UserEditingType.FORM:
return {
Expand All @@ -599,15 +586,6 @@ export function translateUserEditsFromBlueprint(
currentValues: clone(userEdit.currentValues),
translationNamespaces: unprotectStringArray(blueprintIds),
} satisfies Complete<CoreUserEditingDefinitionForm>
case UserEditingType.SOURCE_LAYER_FORM:
return {
type: UserEditingType.SOURCE_LAYER_FORM,
id: userEdit.id,
label: wrapTranslatableMessageFromBlueprints(userEdit.label, blueprintIds),
schemas: clone(userEdit.schemas),
currentValues: clone(userEdit.currentValues),
translationNamespaces: unprotectStringArray(blueprintIds),
} satisfies Complete<CoreUserEditingDefinitionSourceLayerForm>
default:
assertNever(userEdit)
return undefined
Expand Down Expand Up @@ -635,7 +613,6 @@ export function translateUserEditPropertiesFromBlueprint(
svgIcon: userEdit.svgIcon,
svgIconInactive: userEdit.svgIconInactive,
isActive: userEdit.isActive,
buttonType: userEdit.buttonType,
} satisfies Complete<UserEditingDefinitionAction>)
),

Expand Down
137 changes: 68 additions & 69 deletions packages/webui/src/client/lib/forms/SchemaFormInPlace.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,74 @@
// to get styling on the current Sofie UI schema/overrides components
// without changing current look and behavior in other places of Sofie
.styled-schema-form {
width: 100%;

// Force the base input-l class
.input-l {
width: 100% !important;
max-width: none !important;
margin-left: 0px;
border: none;
}

// Force the select/text-input defaults
.select,
.inline-select,
.text-input {
display: block !important;
position: relative;
width: 100% !important;
}

.input {
border: 1px solid #e5e7eb;
border-radius: 0.375rem;
padding: 0.5rem 0.75rem;
width: 100%;

&:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 1px #3b82f6;
}
}

.label-text {
&:before {
content: none !important;
}
}

.dropdown {
background: white;
border: 1px solid #e5e7eb;
border-radius: 0.375rem;
width: 100%;
max-width: 100%;

.input,
.input-l {
border: none;
outline: none;
box-shadow: none;
}

&:focus-within {
border-color: #3b82f6;
box-shadow: 0 0 0 1px #3b82f6;
}
}
width: 100%;

// Force the label over selector
.label-actual {
margin-bottom: 0.5rem !important; // Increased spacing between label and selector
}

.label {
font-size: 0.875rem;
font-weight: 500;
color: #374151;
display: block;
}
// Force the base input-l class
.input-l {
width: 100% !important;
max-width: none !important;
margin-left: 0px;
border: none;
}

// Force the select/text-input defaults
.select,
.inline-select,
.text-input {
display: block !important;
position: relative;
width: 100% !important;
}

}
.input {
border: 1px solid #e5e7eb;
border-radius: 0.375rem;
padding: 0.5rem 0.75rem;
width: 100%;

&:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 1px #3b82f6;
background-color: unset !important; // origo >.>
}
}

.label-text {
&:before {
content: none !important;
}
}

.dropdown {
background: white;
border: 1px solid #e5e7eb;
border-radius: 0.375rem;
width: 100%;
max-width: 100%;

.input,
.input-l {
border: none;
outline: none;
box-shadow: none;
}

&:focus-within {
border-color: #3b82f6;
box-shadow: 0 0 0 1px #3b82f6;
}
}

// Force the label over selector
.label-actual {
margin-bottom: 0.5rem !important; // Increased spacing between label and selector
}

.label {
font-size: 0.875rem;
font-weight: 500;
color: #374151;
display: block;
}
}
Loading

0 comments on commit 50d869e

Please sign in to comment.