Update colors throughout app

This commit is contained in:
David Corbitt
2023-08-12 02:32:09 -07:00
parent ce6936f753
commit 723c0f7505
11 changed files with 84 additions and 65 deletions

View File

@@ -10,6 +10,7 @@ const ScenarioRow = (props: {
variants: PromptVariant[]; variants: PromptVariant[];
canHide: boolean; canHide: boolean;
rowStart: number; rowStart: number;
isLast: boolean;
}) => { }) => {
const [isHovered, setIsHovered] = useState(false); const [isHovered, setIsHovered] = useState(false);
@@ -21,10 +22,12 @@ const ScenarioRow = (props: {
onMouseEnter={() => setIsHovered(true)} onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)} onMouseLeave={() => setIsHovered(false)}
sx={isHovered ? highlightStyle : undefined} sx={isHovered ? highlightStyle : undefined}
bgColor="white"
borderLeftWidth={1} borderLeftWidth={1}
{...borders} {...borders}
rowStart={props.rowStart} rowStart={props.rowStart}
colStart={1} colStart={1}
borderBottomLeftRadius={props.isLast ? 8 : 0}
> >
<ScenarioEditor scenario={props.scenario} hovered={isHovered} canHide={props.canHide} /> <ScenarioEditor scenario={props.scenario} hovered={isHovered} canHide={props.canHide} />
</GridItem> </GridItem>
@@ -34,8 +37,10 @@ const ScenarioRow = (props: {
onMouseEnter={() => setIsHovered(true)} onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)} onMouseLeave={() => setIsHovered(false)}
sx={isHovered ? highlightStyle : undefined} sx={isHovered ? highlightStyle : undefined}
bgColor="white"
rowStart={props.rowStart} rowStart={props.rowStart}
colStart={i + 2} colStart={i + 2}
borderBottomRightRadius={props.isLast && i === props.variants.length - 1 ? 8 : 0}
{...borders} {...borders}
> >
<OutputCell key={variant.id} scenario={props.scenario} variant={variant} /> <OutputCell key={variant.id} scenario={props.scenario} variant={variant} />

View File

@@ -48,7 +48,20 @@ export const ScenariosHeader = () => {
); );
return ( return (
<HStack w="100%" pb={cellPadding.y} pt={0} align="center" spacing={0}> <HStack
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

@@ -53,20 +53,29 @@ export default function OutputsTable({ experimentId }: { experimentId: string |
colStart: i + 2, colStart: i + 2,
borderLeftWidth: i === 0 ? 1 : 0, borderLeftWidth: i === 0 ? 1 : 0,
marginLeft: i === 0 ? "-1px" : 0, marginLeft: i === 0 ? "-1px" : 0,
backgroundColor: "gray.100", backgroundColor: "white",
}; };
const isFirst = i === 0;
const isLast = i === variants.data.length - 1;
return ( return (
<Fragment key={variant.uiId}> <Fragment key={variant.uiId}>
<VariantHeader <VariantHeader
variant={variant} variant={variant}
canHide={variants.data.length > 1} canHide={variants.data.length > 1}
rowStart={1} rowStart={1}
borderTopLeftRadius={isFirst ? 8 : 0}
borderTopRightRadius={isLast ? 8 : 0}
{...sharedProps} {...sharedProps}
/> />
<GridItem rowStart={2} {...sharedProps}> <GridItem rowStart={2} {...sharedProps}>
<VariantEditor variant={variant} /> <VariantEditor variant={variant} />
</GridItem> </GridItem>
<GridItem rowStart={3} {...sharedProps}> <GridItem
rowStart={3}
{...sharedProps}
borderBottomLeftRadius={isFirst ? 8 : 0}
borderBottomRightRadius={isLast ? 8 : 0}
>
<VariantStats variant={variant} /> <VariantStats variant={variant} />
</GridItem> </GridItem>
</Fragment> </Fragment>
@@ -90,6 +99,7 @@ export default function OutputsTable({ experimentId }: { experimentId: string |
scenario={scenario} scenario={scenario}
variants={variants.data} variants={variants.data}
canHide={visibleScenariosCount > 1} canHide={visibleScenariosCount > 1}
isLast={i === visibleScenariosCount - 1}
/> />
))} ))}
<GridItem <GridItem

View File

@@ -54,6 +54,7 @@ const Paginator = ({
value={pageSize} value={pageSize}
onChange={(e) => updatePageSize(parseInt(e.target.value))} onChange={(e) => updatePageSize(parseInt(e.target.value))}
w={20} w={20}
backgroundColor="white"
> >
{pageSizeOptions.map((option) => ( {pageSizeOptions.map((option) => (
<option key={option} value={option}> <option key={option} value={option}>
@@ -76,6 +77,7 @@ const Paginator = ({
isDisabled={page === 1} isDisabled={page === 1}
aria-label="Go to first page" aria-label="Go to first page"
icon={<Icon as={FiChevronsLeft} boxSize={5} strokeWidth={1.5} />} icon={<Icon as={FiChevronsLeft} boxSize={5} strokeWidth={1.5} />}
bgColor="white"
/> />
<IconButton <IconButton
variant="outline" variant="outline"
@@ -84,6 +86,7 @@ const Paginator = ({
isDisabled={page === 1} isDisabled={page === 1}
aria-label="Previous page" aria-label="Previous page"
icon={<Icon as={FiChevronLeft} boxSize={5} strokeWidth={1.5} />} icon={<Icon as={FiChevronLeft} boxSize={5} strokeWidth={1.5} />}
bgColor="white"
/> />
{condense && ( {condense && (
<Text> <Text>
@@ -97,6 +100,7 @@ const Paginator = ({
isDisabled={page === lastPage} isDisabled={page === lastPage}
aria-label="Next page" aria-label="Next page"
icon={<Icon as={FiChevronRight} boxSize={5} strokeWidth={1.5} />} icon={<Icon as={FiChevronRight} boxSize={5} strokeWidth={1.5} />}
bgColor="white"
/> />
<IconButton <IconButton
variant="outline" variant="outline"
@@ -105,6 +109,7 @@ const Paginator = ({
isDisabled={page === lastPage} isDisabled={page === lastPage}
aria-label="Go to last page" aria-label="Go to last page"
icon={<Icon as={FiChevronsRight} boxSize={5} strokeWidth={1.5} />} icon={<Icon as={FiChevronsRight} boxSize={5} strokeWidth={1.5} />}
bgColor="white"
/> />
</HStack> </HStack>
</HStack> </HStack>

View File

@@ -75,7 +75,7 @@ export default function VariantHeader(
padding={0} padding={0}
sx={{ sx={{
position: "sticky", position: "sticky",
top: "0", top: "-2",
// Ensure that the menu always appears above the sticky header of other variants // Ensure that the menu always appears above the sticky header of other variants
zIndex: menuOpen ? "dropdown" : 10, zIndex: menuOpen ? "dropdown" : 10,
}} }}
@@ -84,6 +84,7 @@ export default function VariantHeader(
> >
<HStack <HStack
spacing={2} spacing={2}
py={2}
alignItems="flex-start" alignItems="flex-start"
minH={headerMinHeight} minH={headerMinHeight}
draggable={!isInputHovered} draggable={!isInputHovered}
@@ -102,7 +103,8 @@ export default function VariantHeader(
setIsDragTarget(false); setIsDragTarget(false);
}} }}
onDrop={onReorder} onDrop={onReorder}
backgroundColor={isDragTarget ? "gray.200" : "gray.100"} backgroundColor={isDragTarget ? "gray.200" : "white"}
borderTopLeftRadius={gridItemProps.borderTopLeftRadius}
h="full" h="full"
> >
<Icon <Icon

View File

@@ -9,11 +9,11 @@ export default function LoggedCallsTable() {
const { data: loggedCalls } = useLoggedCalls(); const { data: loggedCalls } = useLoggedCalls();
return ( return (
<Card variant="outline" width="100%" overflow="hidden"> <Card width="100%" overflow="hidden">
<CardHeader> <CardHeader>
<HStack justifyContent="space-between"> <HStack justifyContent="space-between">
<Heading as="h3" size="sm"> <Heading as="h3" size="sm">
Logged Calls Request Logs
</Heading> </Heading>
<Button as={Link} href="/request-logs" variant="ghost" colorScheme="blue"> <Button as={Link} href="/request-logs" variant="ghost" colorScheme="blue">
<Text>View All</Text> <Text>View All</Text>

View File

@@ -7,6 +7,7 @@ import {
Spinner, Spinner,
AspectRatio, AspectRatio,
SkeletonText, SkeletonText,
Card,
} from "@chakra-ui/react"; } from "@chakra-ui/react";
import { RiFlaskLine } from "react-icons/ri"; import { RiFlaskLine } from "react-icons/ri";
import { formatTimePast } from "~/utils/dayjs"; import { formatTimePast } from "~/utils/dayjs";
@@ -29,17 +30,21 @@ type ExperimentData = {
export const ExperimentCard = ({ exp }: { exp: ExperimentData }) => { export const ExperimentCard = ({ exp }: { exp: ExperimentData }) => {
return ( return (
<AspectRatio ratio={1.2} w="full"> <Card
w="full"
h="full"
cursor="pointer"
p={4}
bg="white"
borderRadius={4}
_hover={{ bg: "gray.100" }}
transition="background 0.2s"
>
<VStack <VStack
as={Link} as={Link}
w="full"
h="full"
href={{ pathname: "/experiments/[id]", query: { id: exp.id } }} href={{ pathname: "/experiments/[id]", query: { id: exp.id } }}
bg="gray.50"
_hover={{ bg: "gray.100" }}
transition="background 0.2s"
cursor="pointer"
borderColor="gray.200"
borderWidth={1}
p={4}
justify="space-between" justify="space-between"
> >
<HStack w="full" color="gray.700" justify="center"> <HStack w="full" color="gray.700" justify="center">
@@ -57,7 +62,7 @@ export const ExperimentCard = ({ exp }: { exp: ExperimentData }) => {
<Text flex={1}>Updated {formatTimePast(exp.updatedAt)}</Text> <Text flex={1}>Updated {formatTimePast(exp.updatedAt)}</Text>
</HStack> </HStack>
</VStack> </VStack>
</AspectRatio> </Card>
); );
}; };
@@ -89,30 +94,30 @@ export const NewExperimentCard = () => {
}, [createMutation, router, selectedProjectId]); }, [createMutation, router, selectedProjectId]);
return ( return (
<AspectRatio ratio={1.2} w="full"> <Card
<VStack w="full"
align="center" h="full"
justify="center" cursor="pointer"
_hover={{ cursor: "pointer", bg: "gray.50" }} p={4}
transition="background 0.2s" bg="white"
cursor="pointer" borderRadius={4}
borderColor="gray.200" _hover={{ bg: "gray.100" }}
borderWidth={1} transition="background 0.2s"
p={4} aspectRatio={1.2}
onClick={createExperiment} >
> <VStack align="center" justify="center" w="full" h="full" p={4} onClick={createExperiment}>
<Icon as={isLoading ? Spinner : BsPlusSquare} boxSize={8} /> <Icon as={isLoading ? Spinner : BsPlusSquare} boxSize={8} />
<Text display={{ base: "none", md: "block" }} ml={2}> <Text display={{ base: "none", md: "block" }} ml={2}>
New Experiment New Experiment
</Text> </Text>
</VStack> </VStack>
</AspectRatio> </Card>
); );
}; };
export const ExperimentCardSkeleton = () => ( export const ExperimentCardSkeleton = () => (
<AspectRatio ratio={1.2} w="full"> <AspectRatio ratio={1.2} w="full">
<VStack align="center" borderColor="gray.200" borderWidth={1} p={4} bg="gray.50"> <VStack align="center" borderColor="gray.200" borderWidth={1} p={4} bg="white">
<SkeletonText noOfLines={1} w="80%" /> <SkeletonText noOfLines={1} w="80%" />
<SkeletonText noOfLines={2} w="60%" /> <SkeletonText noOfLines={2} w="60%" />
<SkeletonText noOfLines={1} w="80%" /> <SkeletonText noOfLines={1} w="80%" />

View File

@@ -8,7 +8,7 @@ export default function LoggedCallsTable() {
const { data: loggedCalls } = useLoggedCalls(); const { data: loggedCalls } = useLoggedCalls();
return ( return (
<Card variant="outline" width="100%" overflow="hidden"> <Card width="100%" overflow="hidden">
<Table> <Table>
<TableHeader /> <TableHeader />
<Tbody> <Tbody>

View File

@@ -15,14 +15,10 @@ import {
Tr, Tr,
Td, Td,
Divider, Divider,
Breadcrumb,
BreadcrumbItem,
} from "@chakra-ui/react"; } from "@chakra-ui/react";
import { Ban, DollarSign, Hash } from "lucide-react"; import { Ban, DollarSign, Hash } from "lucide-react";
import AppShell from "~/components/nav/AppShell"; import AppShell from "~/components/nav/AppShell";
import PageHeaderContainer from "~/components/nav/PageHeaderContainer";
import ProjectBreadcrumbContents from "~/components/nav/ProjectBreadcrumbContents";
import { useSelectedProject } from "~/utils/hooks"; import { useSelectedProject } from "~/utils/hooks";
import { api } from "~/utils/api"; import { api } from "~/utils/api";
import LoggedCallsTable from "~/components/dashboard/LoggedCallsTable"; import LoggedCallsTable from "~/components/dashboard/LoggedCallsTable";
@@ -38,24 +34,14 @@ export default function Dashboard() {
return ( return (
<AppShell title="Dashboard" requireAuth> <AppShell title="Dashboard" requireAuth>
<PageHeaderContainer> <VStack px={8} py={8} alignItems="flex-start" spacing={4}>
<Breadcrumb>
<BreadcrumbItem>
<ProjectBreadcrumbContents />
</BreadcrumbItem>
<BreadcrumbItem isCurrentPage>
<Text>Dashboard</Text>
</BreadcrumbItem>
</Breadcrumb>
</PageHeaderContainer>
<VStack px={8} py={4} alignItems="flex-start" spacing={4}>
<Text fontSize="2xl" fontWeight="bold"> <Text fontSize="2xl" fontWeight="bold">
{selectedProject?.name} Dashboard
</Text> </Text>
<Divider /> <Divider />
<VStack margin="auto" spacing={4} align="stretch" w="full"> <VStack margin="auto" spacing={4} align="stretch" w="full">
<HStack gap={4} align="start"> <HStack gap={4} align="start">
<Card variant="outline" flex={1}> <Card flex={1}>
<CardHeader> <CardHeader>
<Heading as="h3" size="sm"> <Heading as="h3" size="sm">
Usage Statistics Usage Statistics
@@ -66,7 +52,7 @@ export default function Dashboard() {
</CardBody> </CardBody>
</Card> </Card>
<VStack spacing="4" width="300px" align="stretch"> <VStack spacing="4" width="300px" align="stretch">
<Card variant="outline"> <Card>
<CardBody> <CardBody>
<Stat> <Stat>
<HStack> <HStack>
@@ -79,7 +65,7 @@ export default function Dashboard() {
</Stat> </Stat>
</CardBody> </CardBody>
</Card> </Card>
<Card variant="outline"> <Card>
<CardBody> <CardBody>
<Stat> <Stat>
<HStack> <HStack>
@@ -94,7 +80,7 @@ export default function Dashboard() {
</Stat> </Stat>
</CardBody> </CardBody>
</Card> </Card>
<Card variant="outline" overflow="hidden"> <Card overflow="hidden">
<Stat> <Stat>
<CardHeader> <CardHeader>
<HStack> <HStack>

View File

@@ -80,6 +80,7 @@ export default function Settings() {
borderWidth={1} borderWidth={1}
borderRadius={4} borderRadius={4}
borderColor="gray.300" borderColor="gray.300"
bgColor="white"
p={6} p={6}
spacing={6} spacing={6}
> >

View File

@@ -1,25 +1,17 @@
import { Text, VStack, Breadcrumb, BreadcrumbItem } from "@chakra-ui/react"; import { Text, VStack, Divider } from "@chakra-ui/react";
import AppShell from "~/components/nav/AppShell"; import AppShell from "~/components/nav/AppShell";
import PageHeaderContainer from "~/components/nav/PageHeaderContainer";
import ProjectBreadcrumbContents from "~/components/nav/ProjectBreadcrumbContents";
import LoggedCallTable from "~/components/requestLogs/LoggedCallsTable"; import LoggedCallTable from "~/components/requestLogs/LoggedCallsTable";
import LoggedCallsPaginator from "~/components/requestLogs/LoggedCallsPaginator"; import LoggedCallsPaginator from "~/components/requestLogs/LoggedCallsPaginator";
export default function LoggedCalls() { export default function LoggedCalls() {
return ( return (
<AppShell title="Request Logs" requireAuth> <AppShell title="Request Logs" requireAuth>
<PageHeaderContainer> <VStack px={8} py={8} alignItems="flex-start" spacing={4} w="full">
<Breadcrumb> <Text fontSize="2xl" fontWeight="bold">
<BreadcrumbItem> Request Logs
<ProjectBreadcrumbContents /> </Text>
</BreadcrumbItem> <Divider />
<BreadcrumbItem isCurrentPage>
<Text>Request Logs</Text>
</BreadcrumbItem>
</Breadcrumb>
</PageHeaderContainer>
<VStack px={8} py={4} alignItems="flex-start" spacing={4}>
<LoggedCallTable /> <LoggedCallTable />
<LoggedCallsPaginator /> <LoggedCallsPaginator />
</VStack> </VStack>