Merge pull request #3056 from danswer-ai/form_stretch

Improve form
This commit is contained in:
hagen-danswer
2024-11-05 14:19:11 -08:00
committed by GitHub
7 changed files with 33 additions and 29 deletions

View File

@@ -58,9 +58,6 @@ export function DanswerBotChart({
categories={["Total Queries", "Automatically Resolved"]} categories={["Total Queries", "Automatically Resolved"]}
index="Day" index="Day"
colors={["indigo", "fuchsia"]} colors={["indigo", "fuchsia"]}
valueFormatter={(number: number) =>
`${Intl.NumberFormat("us").format(number).toString()}`
}
yAxisWidth={60} yAxisWidth={60}
/> />
); );

View File

@@ -56,9 +56,6 @@ export function FeedbackChart({
categories={["Positive Feedback", "Negative Feedback"]} categories={["Positive Feedback", "Negative Feedback"]}
index="Day" index="Day"
colors={["indigo", "fuchsia"]} colors={["indigo", "fuchsia"]}
valueFormatter={(number: number) =>
`${Intl.NumberFormat("us").format(number).toString()}`
}
yAxisWidth={60} yAxisWidth={60}
/> />
); );

View File

@@ -74,10 +74,21 @@ export function QueryPerformanceChart({
categories={["Queries", "Unique Users"]} categories={["Queries", "Unique Users"]}
index="Day" index="Day"
colors={["indigo", "fuchsia"]} colors={["indigo", "fuchsia"]}
valueFormatter={(number: number) => yAxisFormatter={(number: number) =>
`${Intl.NumberFormat("us").format(number).toString()}` new Intl.NumberFormat("en-US", {
notation: "standard",
maximumFractionDigits: 0,
}).format(number)
} }
xAxisFormatter={(dateStr: string) => {
const date = new Date(dateStr);
return date.toLocaleDateString("en-US", {
month: "short",
day: "numeric",
});
}}
yAxisWidth={60} yAxisWidth={60}
allowDecimals={false}
/> />
); );
} }

View File

@@ -11,7 +11,7 @@ export default function CardSection({
return ( return (
<div <div
className={cn( className={cn(
"p-6 shadow-sm rounded-lg bg-white border border-border-strong/80", "p-6 shadow-sm rounded-lg bg-white border border-border-strong/80",
className className
)} )}
> >

View File

@@ -635,22 +635,20 @@ export function SelectorFormField({
className={maxHeight ? `max-h-[${maxHeight}]` : undefined} className={maxHeight ? `max-h-[${maxHeight}]` : undefined}
container={container} container={container}
> >
{options.length == 0 && ( {options.length === 0 ? (
<SelectItem value="default">Select...</SelectItem> <SelectItem value="default">Select...</SelectItem>
) : (
options.map((option) => (
<SelectItem
icon={option.icon}
key={option.value}
value={String(option.value)}
selected={field.value === option.value}
>
{option.name}
</SelectItem>
))
)} )}
{defaultValue && (
<SelectItem value={defaultValue}>{defaultValue}</SelectItem>
)}
{options.map((option) => (
<SelectItem
icon={option.icon}
key={option.value}
value={String(option.value)}
selected={field.value === option.value}
>
{option.name}
</SelectItem>
))}
</SelectContent> </SelectContent>
)} )}
</Select> </Select>

View File

@@ -188,7 +188,7 @@ export default function CreateCredential({
onSubmit={() => {}} // This will be overridden by our custom submit handlers onSubmit={() => {}} // This will be overridden by our custom submit handlers
> >
{(formikProps) => ( {(formikProps) => (
<Form> <Form className="w-full flex items-stretch">
{!hideSource && ( {!hideSource && (
<p className="text-sm"> <p className="text-sm">
Check our Check our

View File

@@ -24,7 +24,6 @@ interface AreaChartProps {
categories?: string[]; categories?: string[];
index?: string; index?: string;
colors?: string[]; colors?: string[];
valueFormatter?: (value: number) => string;
startEndOnly?: boolean; startEndOnly?: boolean;
showXAxis?: boolean; showXAxis?: boolean;
showYAxis?: boolean; showYAxis?: boolean;
@@ -42,6 +41,8 @@ interface AreaChartProps {
className?: string; className?: string;
title?: string; title?: string;
description?: string; description?: string;
xAxisFormatter?: (value: any) => string;
yAxisFormatter?: (value: any) => string;
} }
export function AreaChartDisplay({ export function AreaChartDisplay({
@@ -49,8 +50,6 @@ export function AreaChartDisplay({
categories = [], categories = [],
index, index,
colors = ["indigo", "fuchsia"], colors = ["indigo", "fuchsia"],
valueFormatter = (number: number) =>
`${Intl.NumberFormat("us").format(number).toString()}`,
startEndOnly = false, startEndOnly = false,
showXAxis = true, showXAxis = true,
showYAxis = true, showYAxis = true,
@@ -68,6 +67,8 @@ export function AreaChartDisplay({
className, className,
title, title,
description, description,
xAxisFormatter = (dateStr: string) => dateStr,
yAxisFormatter = (number: number) => number.toString(),
}: AreaChartProps) { }: AreaChartProps) {
return ( return (
<Card className={className}> <Card className={className}>
@@ -94,7 +95,7 @@ export function AreaChartDisplay({
tickLine={false} tickLine={false}
axisLine={false} axisLine={false}
tickMargin={8} tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)} tickFormatter={(value) => xAxisFormatter(value)}
/> />
)} )}
{showYAxis && ( {showYAxis && (
@@ -102,7 +103,7 @@ export function AreaChartDisplay({
width={yAxisWidth} width={yAxisWidth}
tickLine={false} tickLine={false}
axisLine={false} axisLine={false}
tickFormatter={valueFormatter} tickFormatter={(value) => yAxisFormatter(value)}
allowDecimals={allowDecimals} allowDecimals={allowDecimals}
/> />
)} )}