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

Refactor Segment/Part properties to be a property instead of an operation #38

Merged
merged 5 commits into from
Dec 5, 2024

Conversation

mint-dewit
Copy link
Collaborator

No description provided.

* Properties that are user editable from the properties panel in the Sofie UI, if the user saves changes to these
* it will trigger a user edit operation of type DefaultUserOperationEditProperties
*/
userEditProperties?: Readonly<UserEditingProperties>
Copy link
Collaborator

@Julusian Julusian Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ReadOnly<...> here, but the plain type in Segment. They should be consistent

Copy link
Collaborator

@Julusian Julusian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im happy with the shape this is taking.

Most of my comments are related to translationNamespaces not being propogated, which I appreciate is a hard one to test as it becomes more theoretical when there are no translations yet.

@@ -66,3 +66,45 @@ export interface CoreUserEditingDefinitionSourceLayerForm {
value: Record<string, any>
}
}

export interface UserEditingProperties {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is missing any translationNamespaces properties that would be good to do in some way.
Maybe that could be done as a single property at the root of this interface, that sofie injects when processing the blueprint version of it?

I would also recommend making anywhere we convert from the bluerpint to core versions of this interface be very explicit conversions. Because while they 99% match, the core version should also be adding translationNamespaces in various places, such as any uses of ITranslatableMessage. If the conversion misses adding any of these then that is some bugs waiting to be discovered by the first person to try translating this ui section.

@@ -29,6 +29,7 @@ export enum SchemaFormUIField {
* Currently only valid for:
* - object properties. Valid values are 'json'.
* - string properties. Valid values are 'base64-image'.
* - boolean properties. Valid values are 'switch'.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is also a page in the documentation which describes the valid values of this

...change,
pieceTypeProperties: {
type: key,
value: {}, // todo - take defaults
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unhandled todo


const selectedGroupId = change.pieceTypeProperties.type
const selectedGroupSchema = properties.schema[selectedGroupId]?.schema
const parsedSchema = selectedGroupSchema ? JSONBlobParse(selectedGroupSchema) : undefined
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be beneficial to useMemo this line, to avoid doing the JSONBlobParse on every render of this component

schema={parsedSchema}
object={value}
onUpdate={onUpdate}
translationNamespaces={[]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to have this set to a proper value if possible

/**
* @todo - retrieve translationNamespaces for correct blueprint translations?
*/
function GlobalPropertiesEditor({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments for this as PropertiesEditor

<div>
{actions.map((action) => (
<button
title={'User Action : ' + action.label.key}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is skipping any translation

* A list of id's of operations to be exposed on the properties panel as buttons. These operations
* must be available on the element
*
* note - perhaps these should have their own full definitions?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this note be handled in this PR?

As the blueprint version of this interface has the full definition for these, it would make sense to keep that here too. It looks like the ui is expecting them to be the full definitions too

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want/need the CoreUserEditingDefinitionSourceLayerForm and similar types?
I don't mind if they stay, just want to ask the question

@@ -74,7 +74,7 @@ export enum UserEditingType {
}

export interface UserEditingSourceLayer {
sourceLayerLabel: string
sourceLayerLabel: string // translate? take from type?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unhandled todo?

@mint-dewit mint-dewit marked this pull request as ready for review December 5, 2024 11:15
@mint-dewit mint-dewit merged commit ffdde73 into feat/ui-useredit-panel Dec 5, 2024
78 of 86 checks passed
@mint-dewit mint-dewit deleted the chore/ui-useredit-properties branch December 13, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants