Skip to content

Commit

Permalink
fix: update terminology in triggers editer to reference 'condition' i…
Browse files Browse the repository at this point in the history
…nstead of 'feedback' #2550
  • Loading branch information
Julusian committed Aug 17, 2023
1 parent bb7f795 commit 01e6ea0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions webui/src/Buttons/EditButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ function TabsSection({ style, controlId, steps, runtimeProps, rotaryActions, fee
<MyErrorBoundary>
<ControlFeedbacksEditor
heading="Feedbacks"
entityType="feedback"
controlId={controlId}
feedbacks={feedbacks}
isOnControl={true}
Expand Down
28 changes: 20 additions & 8 deletions webui/src/Controls/FeedbackEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ import { MenuPortalContext } from '../Components/DropdownInputField'
import { ParseControlId } from '@companion/shared/ControlId'
import { ButtonStyleProperties } from '@companion/shared/Style'

export function ControlFeedbacksEditor({ controlId, feedbacks, heading, booleanOnly, isOnControl, addPlaceholder }) {
export function ControlFeedbacksEditor({
controlId,
feedbacks,
heading,
entityType,
booleanOnly,
isOnControl,
addPlaceholder,
}) {
const socket = useContext(SocketContext)

const confirmModal = useRef()
Expand Down Expand Up @@ -61,13 +69,13 @@ export function ControlFeedbacksEditor({ controlId, feedbacks, heading, booleanO

const doDelete = useCallback(
(feedbackId) => {
confirmModal.current.show('Delete feedback', 'Delete feedback?', 'Delete', () => {
confirmModal.current.show(`Delete ${entityType}`, `Delete ${entityType}?`, 'Delete', () => {
socketEmitPromise(socket, 'controls:feedback:remove', [controlId, feedbackId]).catch((e) => {
console.error(`Failed to delete feedback: ${e}`)
})
})
},
[socket, controlId]
[socket, controlId, entityType]
)

const doDuplicate = useCallback(
Expand Down Expand Up @@ -154,6 +162,7 @@ export function ControlFeedbacksEditor({ controlId, feedbacks, heading, booleanO
<MyErrorBoundary key={a?.id ?? i}>
<FeedbackTableRow
key={a?.id ?? i}
entityType={entityType}
index={i}
controlId={controlId}
feedback={a}
Expand Down Expand Up @@ -192,6 +201,7 @@ export function ControlFeedbacksEditor({ controlId, feedbacks, heading, booleanO
}

function FeedbackTableRow({
entityType,
feedback,
controlId,
index,
Expand Down Expand Up @@ -290,6 +300,7 @@ function FeedbackTableRow({
</td>
<td>
<FeedbackEditor
entityType={entityType}
isOnControl={isOnControl}
controlId={controlId}
feedback={feedback}
Expand All @@ -311,6 +322,7 @@ function FeedbackTableRow({
}

function FeedbackEditor({
entityType,
feedback,
isOnControl,
controlId,
Expand Down Expand Up @@ -393,18 +405,18 @@ function FeedbackEditor({
<div className="cell-controls">
<CButtonGroup>
{isCollapsed ? (
<CButton size="sm" onClick={doExpand} title="Expand feedback view">
<CButton size="sm" onClick={doExpand} title={`Expand ${entityType} view`}>
<FontAwesomeIcon icon={faExpandArrowsAlt} />
</CButton>
) : (
<CButton size="sm" onClick={doCollapse} title="Collapse feedback view">
<CButton size="sm" onClick={doCollapse} title={`Collapse ${entityType} view`}>
<FontAwesomeIcon icon={faCompressArrowsAlt} />
</CButton>
)}
<CButton size="sm" onClick={innerDuplicate} title="Duplicate feedback">
<CButton size="sm" onClick={innerDuplicate} title={`Duplicate ${entityType}`}>
<FontAwesomeIcon icon={faCopy} />
</CButton>
<CButton size="sm" onClick={innerDelete} title="Remove feedback">
<CButton size="sm" onClick={innerDelete} title={`Remove ${entityType}`}>
<FontAwesomeIcon icon={faTrash} />
</CButton>
{doEnabled && (
Expand All @@ -413,7 +425,7 @@ function FeedbackEditor({
<CSwitch
color="success"
checked={!feedback.disabled}
title={feedback.disabled ? 'Enable feedback' : 'Disable feedback'}
title={feedback.disabled ? `Enable ${entityType}` : `Disable ${entityType}`}
onChange={innerSetEnabled}
/>
</>
Expand Down
1 change: 1 addition & 0 deletions webui/src/Triggers/EditPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export function EditTriggerPanel({ controlId }) {
/>
</>
}
entityType="condition"
controlId={controlId}
feedbacks={config.condition}
booleanOnly={true}
Expand Down

0 comments on commit 01e6ea0

Please sign in to comment.