Skip to content

Commit

Permalink
chore(ui): fix spacing for annotation types in feedback grid (#3288)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtarpenning authored Dec 18, 2024
1 parent a24512a commit 8ce826d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -44,7 +45,10 @@ export const FeedbackGridInner = ({
<span className="night-aware">{params.row.payload.emoji}</span>
);
}
if (params.row.feedback_type.startsWith('wandb.annotation.')) {
if (isHumanAnnotationType(params.row.feedback_type)) {
if (typeof params.row.payload.value === 'string') {
return <CellValueString value={params.row.payload.value} />;
}
return (
<CellValueString
value={JSON.stringify(params.row.payload.value ?? null)}
Expand Down Expand Up @@ -143,16 +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'
) {
return 'auto';
if (isWandbFeedbackType(params.model.feedback_type)) {
return 38;
}
return 38;
return 'auto';
}}
columns={columns}
disableRowSelectionOnClick
/>
);
};

const isWandbFeedbackType = (feedbackType: string) =>
feedbackType.startsWith('wandb.');
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ export type HumanAnnotationPayload = {
};

export type HumanAnnotation = Feedback & {};

export const isHumanAnnotationType = (feedbackType: string) =>
feedbackType.startsWith(HUMAN_ANNOTATION_BASE_TYPE);

0 comments on commit 8ce826d

Please sign in to comment.