Skip to content

Commit

Permalink
only edit users feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gtarpenning committed Oct 29, 2024
1 parent 1a9919a commit 0842c40
Showing 1 changed file with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,8 @@ export const HumanFeedbackCell: React.FC<
[feedback.creator ?? '']: feedback.payload.value,
...acc,
};
}, {});
}, {}) as Record<string, Record<string, Record<string, string>>>;

console.log('combinedFeedback', combinedFeedback);

// rawValues is an array of values from the feedback
const parsedRef = parseRef(props.sfData.ref);

Expand All @@ -223,10 +221,9 @@ export const HumanFeedbackCell: React.FC<
values.push(pRecord[parsedRef.artifactName]?.[parsedRef.artifactVersion]);
}
return values;
}, [combinedFeedback, parsedRef])

console.log('rawValues', rawValues);
}, [combinedFeedback, parsedRef]);

const viewerFeedbackVal = props.viewer ? combinedFeedback[props.viewer]?.[parsedRef.artifactName]?.[parsedRef.artifactVersion] : null;

if (query?.loading) {
return <LoadingDots />;
Expand All @@ -239,24 +236,9 @@ export const HumanFeedbackCell: React.FC<
</div>;
}

// TODO: fix, we want only one callsite for renderFeedbackComponent
if (Object.keys(combinedFeedback).length === 0) {
return <div className="flex w-full justify-center">
{renderFeedbackComponent(props, onAddFeedback, null)}
</div>;
}

return (
<div className="w-full py-4">
{rawValues?.map(val => renderFeedbackComponent(props, onAddFeedback, val))}
{/* {Object.entries(combinedFeedback)
.map(([userId, value]) => {
return renderFeedbackComponent(
props,
onAddFeedback,
value[0]?.[parsedRef.artifactName]?.[parsedRef.artifactVersion]
)
})} */}
{renderFeedbackComponent(props, onAddFeedback, viewerFeedbackVal)}
</div>
);
};
Expand Down

0 comments on commit 0842c40

Please sign in to comment.