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 useredit panel #22

Merged
merged 93 commits into from
Dec 13, 2024
Merged

Feat/UI useredit panel #22

merged 93 commits into from
Dec 13, 2024

Conversation

olzzon
Copy link
Collaborator

@olzzon olzzon commented Oct 22, 2024

This is an internal BBC WIP PR for discussion of concepts for the PropertiesPanel and Useredits.
Be aware:

  • The panel is currently implemented as a hack in the Notification Center
  • The schema of useredits is currently using a simple "select" tag instead of "Schema...." type, mainly because of styling
  • Maybe a "button" type of schema like the grouping array, would be cool to have as a schema, this way e.g. Split/DVE selection could be button with SVG icons on them, instead of a list.
  • Buttons can be either text or svg's.

The corresponding Blueprints is in this branch:
https://github.com/bbc/eng-ga-sofie-blueprints/tree/feat/user-edits-properties-panel

image

@olzzon olzzon requested review from Julusian and mint-dewit October 22, 2024 09:39
@olzzon olzzon marked this pull request as ready for review November 13, 2024 10:11
@olzzon olzzon requested a review from mint-dewit November 13, 2024 10:11
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.

I have a disagreement with how this is done, which is simply that I don't think the properties panel should be using the same list of userEditOperations that we added for the context menu.

I think that the properties panel should be using its own dedicated property, which provides the expected schemas for the panel.
Something like:

interface Part {
  ...

  propertiesPanel?: PropertiesPanelSchema

  ...
}

interface PropertiesPanelSchema {
    /** Common properties to show at the top **/
    headerSchema?: JSONBlob<JSONSchema>
    /** Common properties to show at the bottom **/
    footerSchema?: JSONBlob<JSONSchema>

	/** The json schemas describing the form to display */
	schemas: Record<string, UserEditingSourceLayer>
	/** Current values to populate the form with */
	currentValues: {
		type: string
		value: Record<string, any>
	}
    headerValues?: Record<string, any>
    footerValues?: Record<string, any>
}

As I have said in the comments, I think that reusing the userEditOperations is both making the properties panel ui very complex to handle the displaying and queueing of operations, and will easily result in unexpected behaviour when saving changes in the panel.

There are two key cases I am concerned about, which is that the user triggering the 'ACTION' type of operations in a sequence of A, B, A is not guaranteed to be the same as A, B or even B, A and so we can't reliably condense down the sequence of operations.
And even just executing A, B may not be ok as executing A could remove the ability to execute B.

I don't see a reason that these need to be using the same operations, and while them being separate will likely mean more work for the blueprints dev, it means that the properties panel content will be tailored specifically for the panel.
If they want to have a 'lock part' option in both places, they will have to define it for both, but then they can get better behaviour in both places. If there is an option which affects what other options should be shown/allowed, the json schema for the properties panel could (once we add support for these things to the SchemaForm component) show/hide the appropriate options which are dependent on the others.

} satisfies Complete<UserEditingDefinitionAction>
case UserEditingType.FORM:
return {
type: UserEditingType.FORM,
id: userEdit.id,
label: omit(userEdit.label, 'namespaces'),
schema: clone(userEdit.schema),
grouping: clone(userEdit.grouping) as UserEditingGroupingType[] | undefined,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
grouping: clone(userEdit.grouping) as UserEditingGroupingType[] | undefined,
grouping: clone<UserEditingGroupingType[] | undefined>(userEdit.grouping),

hopefully that satisfies the type error?

The casting you had would ignore some other real type errors

packages/blueprints-integration/src/ingest.ts Outdated Show resolved Hide resolved
packages/blueprints-integration/src/ingest.ts Outdated Show resolved Hide resolved
packages/webui/src/client/lib/forms/SchemaFormInPlace.tsx Outdated Show resolved Hide resolved
packages/blueprints-integration/src/userEditing.ts Outdated Show resolved Hide resolved
@mint-dewit mint-dewit merged commit deae44f into bbc-release52 Dec 13, 2024
30 checks passed
mint-dewit added a commit that referenced this pull request Dec 13, 2024
* wip: initial draft implementation of userEditPanel

* wip: userEditPanel grouping

* wip: userEditPanel cleanup remove schema as it's replaces by schemas

* wip: userEditPanel styling and use <select> for list

* wip: userEditPanel - make groupType optional to allow empty slots

* wip: userEditPanel - convert to FC

* wip: userEditPanel - uncomment context menu

* wip: UserEditPanel - Add DefaultUserOperationsTypes for revert buttons in panel

* wip: UserEditPanel - Default revert button on panel

* wip: UserEditPanel - tracker on part and segment

* wip: UserEditPanel - only render Segment or Part in panel

* wip: UserEditPanel - initial header for part and segment

* wip: UserEditPanel - comment for the usage of getTimePosition

* wip: UserEditPanel - add Icons in header

* wip: UserEditPanel - add button type in UserEditingDefinitions

* wip: UserEditPanel - rename revert button to "Revert Changes"

* wip: UserEditPanel - add support for SVG icons in grouping (e.g for split or DVE backgrounds)

* wip: UserEditPanel - center revert button

* wip: Renaming UserEditPanel to PropertiesPanel

* wip: UI selection - Context for SelectedElements

* wip: UI selection - refactor from useState() to useReducer()

* wip: UI selection - use type for SelectedElement

* wip: UI selection -Segment not updating upon selection

* feat: unit tests for SelectedElementsContext

* wip: UI selection - add isSelected to withSegmentTiming

* wip: fix props withSelection

* wip: fix props withSelection

* wip: remove componentDidUpdate - leftover from previous debugging

* fix: added listSelectedElements() instead of exposing the selectedElements

* fix: add assertNever() to selectionReducer

* fix: remove id and use ElementId as reference in context provider

* fix: clean up isSelected should parse boolean not function as props

* chore: update package with @testing-library/react

* fix: tests for SelecedElementsContext updated and type fixed

* fix: listSelectedElements is af function not an array

* wip: implement useSelection in PropertiesPanel

* wip: useSelection on Parts

* fix: missing rundown id in propertiespanel actions

* feat: add enabling of userediting in settings

* feat: doubleclick on part selection for properties panel

* fix: properties panel crash when no selection was made

* feat: segment selection

* feat: dbl click anywhere in segment header to select properties

* feat: select part by double clicking a piece

* feat: properties panel commit button for pending changes

* feat: select/deselect an element - fix flickering upen commit changes

* fix: render all userEditOperations when part is selected

* feat: move Properties panel out of notification center logic

* feat: use context.consumer instead of wrapping

* feat: refactor userEditing structure

* feat: properties panel with refactored data structure.

* feat: Schema selection implemented in commit button logic

* feat: implement Layer colors in group selectors

* feat: only parse the selected source on useraction commit

* feat: simplify structure for userEditing source

* fix: rerender group selection when selecting new part

* fix: read the SourceLayerType into UserEditingDefinition

* feat: selected element indicator

* feat: properties panel styling - is edited indication

* wip: add close propterties icon (sketch)

* wip: properties panel css dim commit+revert when not active

* wip: properties panel clean up first iteration selector

* wip: properties panel add close upper right

* fix: crash UI - remove transiongroup

* feat: properties panel animate in and shrink rundown view

* fix: cleanup using notificationpanel for properties panel

* wip: properties panel, rightbar icon color

* fix: re-run only if part.segmentId has changed

* wip: tests for properties panel

* wip: properties panel tests - useFaketimers and implement mock useTracker()

* wip: properties panel - element selection styling

* wip: properties panel styling edit pencil icon

* wip: properties panel close when notification is open

* wip: properties panel selection glow on segment header

* feat: StyledSchemaFormInPlace schema component

* fix: Properties panel - StyledSchemaFormInPlace schema for normal form

* feat: Properties panel is edited pencil styling

* feat: Properties header styling

* wip: Properties tests - more mocking to get correct rendering in test to work

* chore: fix unit tests

* feat: refactor form action to properties field

* chore: update styles

* chore: add actions back into property panel

* chore: support translations for properties panel

* chore: fix some build issues

* feat: allow editing piece properties

* chore: various review comments

* chore: fix tests

* chore: remove unused parameter

* chore: removed commented styles

---------

Co-authored-by: Olzzon <gh@olzzon.dk>
Co-authored-by: Mint de Wit <mint@superfly.tv>
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.

3 participants