Remove scenarios header from output table card (#151)

This commit is contained in:
arcticfly
2023-08-13 03:26:58 -07:00
committed by GitHub
parent e423ad656a
commit b28f4cad57
3 changed files with 9 additions and 17 deletions

View File

@@ -10,6 +10,7 @@ const ScenarioRow = (props: {
variants: PromptVariant[]; variants: PromptVariant[];
canHide: boolean; canHide: boolean;
rowStart: number; rowStart: number;
isFirst: boolean;
isLast: boolean; isLast: boolean;
}) => { }) => {
const [isHovered, setIsHovered] = useState(false); const [isHovered, setIsHovered] = useState(false);
@@ -23,11 +24,13 @@ const ScenarioRow = (props: {
onMouseLeave={() => setIsHovered(false)} onMouseLeave={() => setIsHovered(false)}
sx={isHovered ? highlightStyle : undefined} sx={isHovered ? highlightStyle : undefined}
bgColor="white" bgColor="white"
borderLeftWidth={1}
{...borders}
rowStart={props.rowStart} rowStart={props.rowStart}
colStart={1} colStart={1}
borderLeftWidth={1}
borderTopWidth={props.isFirst ? 1 : 0}
borderTopLeftRadius={props.isFirst ? 8 : 0}
borderBottomLeftRadius={props.isLast ? 8 : 0} borderBottomLeftRadius={props.isLast ? 8 : 0}
{...borders}
> >
<ScenarioEditor scenario={props.scenario} hovered={isHovered} canHide={props.canHide} /> <ScenarioEditor scenario={props.scenario} hovered={isHovered} canHide={props.canHide} />
</GridItem> </GridItem>
@@ -40,6 +43,8 @@ const ScenarioRow = (props: {
bgColor="white" bgColor="white"
rowStart={props.rowStart} rowStart={props.rowStart}
colStart={i + 2} colStart={i + 2}
borderTopWidth={props.isFirst ? 1 : 0}
borderTopRightRadius={props.isFirst && i === props.variants.length - 1 ? 8 : 0}
borderBottomRightRadius={props.isLast && i === props.variants.length - 1 ? 8 : 0} borderBottomRightRadius={props.isLast && i === props.variants.length - 1 ? 8 : 0}
{...borders} {...borders}
> >

View File

@@ -48,20 +48,7 @@ export const ScenariosHeader = () => {
); );
return ( return (
<HStack <HStack w="100%" py={cellPadding.y} px={cellPadding.x} align="center" spacing={0}>
w="100%"
py={cellPadding.y}
px={cellPadding.x}
align="center"
spacing={0}
borderTopRightRadius={8}
borderTopLeftRadius={8}
bgColor="white"
borderWidth={1}
borderBottomWidth={0}
borderColor="gray.300"
mt={8}
>
<Text fontSize={16} fontWeight="bold"> <Text fontSize={16} fontWeight="bold">
Scenarios ({scenarios.data?.count}) Scenarios ({scenarios.data?.count})
</Text> </Text>

View File

@@ -86,7 +86,6 @@ export default function OutputsTable({ experimentId }: { experimentId: string |
colSpan={allCols - 1} colSpan={allCols - 1}
rowStart={variantHeaderRows + 1} rowStart={variantHeaderRows + 1}
colStart={1} colStart={1}
{...borders}
borderRightWidth={0} borderRightWidth={0}
> >
<ScenariosHeader /> <ScenariosHeader />
@@ -99,6 +98,7 @@ export default function OutputsTable({ experimentId }: { experimentId: string |
scenario={scenario} scenario={scenario}
variants={variants.data} variants={variants.data}
canHide={visibleScenariosCount > 1} canHide={visibleScenariosCount > 1}
isFirst={i === 0}
isLast={i === visibleScenariosCount - 1} isLast={i === visibleScenariosCount - 1}
/> />
))} ))}