From 0508680e1c267a2bc55ff8ec206dfa4713abb3c9 Mon Sep 17 00:00:00 2001 From: gtarpenning Date: Wed, 18 Dec 2024 14:17:12 -0800 Subject: [PATCH 1/2] chore(ui): fix spacing for annotation types --- .../Home/Browse3/feedback/FeedbackGridInner.tsx | 9 +++++++-- .../feedback/StructuredFeedback/humanAnnotationTypes.ts | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/FeedbackGridInner.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/FeedbackGridInner.tsx index 15a4bad2262b..fa85a30f3296 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/FeedbackGridInner.tsx +++ b/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/FeedbackGridInner.tsx @@ -9,6 +9,7 @@ import {Feedback} from '../pages/wfReactInterface/traceServerClientTypes'; import {StyledDataGrid} from '../StyledDataGrid'; import {FeedbackGridActions} from './FeedbackGridActions'; import {FeedbackTypeChip} from './FeedbackTypeChip'; +import {isHumanAnnotationType} from './StructuredFeedback/humanAnnotationTypes'; type FeedbackGridInnerProps = { feedback: Feedback[]; @@ -44,7 +45,10 @@ export const FeedbackGridInner = ({ {params.row.payload.emoji} ); } - if (params.row.feedback_type.startsWith('wandb.annotation.')) { + if (isHumanAnnotationType(params.row.feedback_type)) { + if (typeof params.row.payload.value === 'string') { + return ; + } return ( { if ( params.model.feedback_type !== 'wandb.reaction.1' && - params.model.feedback_type !== 'wandb.note.1' + params.model.feedback_type !== 'wandb.note.1' && + !isHumanAnnotationType(params.model.feedback_type) ) { return 'auto'; } diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/StructuredFeedback/humanAnnotationTypes.ts b/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/StructuredFeedback/humanAnnotationTypes.ts index 2b675e244dc1..ce28f3113fec 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/StructuredFeedback/humanAnnotationTypes.ts +++ b/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/StructuredFeedback/humanAnnotationTypes.ts @@ -23,3 +23,6 @@ export type HumanAnnotationPayload = { }; export type HumanAnnotation = Feedback & {}; + +export const isHumanAnnotationType = (feedbackType: string) => + feedbackType.startsWith(HUMAN_ANNOTATION_BASE_TYPE); From 269ef43694e835483bf62e270143ebf37f3b9e67 Mon Sep 17 00:00:00 2001 From: gtarpenning Date: Wed, 18 Dec 2024 14:18:49 -0800 Subject: [PATCH 2/2] more intuitive --- .../Home/Browse3/feedback/FeedbackGridInner.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/FeedbackGridInner.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/FeedbackGridInner.tsx index fa85a30f3296..b8b2f4154c28 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/FeedbackGridInner.tsx +++ b/weave-js/src/components/PagePanelComponents/Home/Browse3/feedback/FeedbackGridInner.tsx @@ -147,17 +147,16 @@ export const FeedbackGridInner = ({ }} columnHeaderHeight={40} getRowHeight={(params: GridRowHeightParams) => { - if ( - params.model.feedback_type !== 'wandb.reaction.1' && - params.model.feedback_type !== 'wandb.note.1' && - !isHumanAnnotationType(params.model.feedback_type) - ) { - return 'auto'; + if (isWandbFeedbackType(params.model.feedback_type)) { + return 38; } - return 38; + return 'auto'; }} columns={columns} disableRowSelectionOnClick /> ); }; + +const isWandbFeedbackType = (feedbackType: string) => + feedbackType.startsWith('wandb.');