Skip to content

Commit

Permalink
list item + configuration updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Nov 1, 2024
1 parent df38bde commit a222b9d
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 59 deletions.
2 changes: 1 addition & 1 deletion web/src/app/admin/add-connector/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function Page() {
title="Add Connector"
farRightElement={
<Link href="/admin/indexing/status">
<Button variant="next">See Connectors</Button>
<Button variant="navigate">See Connectors</Button>
</Link>
}
/>
Expand Down
4 changes: 2 additions & 2 deletions web/src/app/admin/assistants/AssistantEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ export function AssistantEditor({
)}
/>
) : (
<Italic className="text-sm">
<p className="text-sm italic">
No Document Sets available.{" "}
{user?.role !== "admin" && (
<>
Expand All @@ -883,7 +883,7 @@ export function AssistantEditor({
Danswer for assistance.
</>
)}
</Italic>
</p>
)}

<div className="mt-4 flex flex-col gap-y-4">
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/admin/bot/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ const Main = () => {
onClick={() => {
setSlackBotTokensModalIsOpen(!slackBotTokensModalIsOpen);
}}
variant="edit"
variant="outline"
className="mt-2"
icon={slackBotTokensModalIsOpen ? FiChevronUp : FiChevronDown}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function LLMProviderDisplay({

<div className="ml-auto">
<Button
variant={existingLlmProvider ? "edit" : "next"}
variant={existingLlmProvider ? "outline" : "next"}
onClick={() => setFormIsVisible(true)}
>
{existingLlmProvider ? "Edit" : "Set up"}
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/admin/configuration/llm/LLMConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function DefaultLLMProviderDisplay({
</div>

<div className="ml-auto">
<Button variant="next" onClick={() => setFormIsVisible(true)}>
<Button variant="navigate" onClick={() => setFormIsVisible(true)}>
Set up
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/admin/token-rate-limits/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function Main() {
<Button
variant="submit"
size="sm"
className="mt-3"
className="my-3"
onClick={() => setModalIsOpen(true)}
>
Create a Token Rate Limit
Expand Down
18 changes: 15 additions & 3 deletions web/src/app/ee/admin/groups/[groupId]/GroupDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ import {
} from "@/lib/types";
import { AddConnectorForm } from "./AddConnectorForm";
import { Separator } from "@/components/ui/separator";
import { Select, SelectItem } from "@/components/ui/select";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import Text from "@/components/ui/text";
import {
Table,
Expand Down Expand Up @@ -95,13 +101,19 @@ const UserRoleDropdown = ({
if (isEditable) {
return (
<div className="w-40">
Select group
<Select
value={localRole}
onValueChange={handleChange}
disabled={isSettingRole}
>
<SelectItem value={UserRole.BASIC}>Basic</SelectItem>
<SelectItem value={UserRole.CURATOR}>Curator</SelectItem>
<SelectTrigger>
<SelectValue placeholder="Select role" />
</SelectTrigger>
<SelectContent>
<SelectItem value={UserRole.BASIC}>Basic</SelectItem>
<SelectItem value={UserRole.CURATOR}>Curator</SelectItem>
</SelectContent>
</Select>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ import {
} from "@/components/ui/table";
import Text from "@/components/ui/text";

import { Select, SelectItem } from "@/components/ui/select";
import {
Select,
SelectItem,
SelectValue,
SelectTrigger,
SelectContent,
} from "@/components/ui/select";
import { ThreeDotsLoader } from "@/components/Loading";
import { ChatSessionMinimal } from "../usage/types";
import { timestampToReadableDate } from "@/lib/dateUtils";
Expand Down Expand Up @@ -80,15 +86,29 @@ function SelectFeedbackType({
value={value}
onValueChange={onValueChange as (value: string) => void}
>
<SelectItem value="all" icon={FiMinus}>
Any
</SelectItem>
<SelectItem value="like" icon={FiSmile}>
Like
</SelectItem>
<SelectItem value="dislike" icon={FiFrown}>
Dislike
</SelectItem>
<SelectTrigger>
<SelectValue placeholder="Select feedback type" />
</SelectTrigger>
<SelectContent>
<SelectItem value="all">
<div className="flex items-center gap-2">
<FiMinus className="h-4 w-4" />
<span>Any</span>
</div>
</SelectItem>
<SelectItem value="like">
<div className="flex items-center gap-2">
<FiSmile className="h-4 w-4" />
<span>Like</span>
</div>
</SelectItem>
<SelectItem value="dislike">
<div className="flex items-center gap-2">
<FiFrown className="h-4 w-4" />
<span>Dislike</span>
</div>
</SelectItem>
</SelectContent>
</Select>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/ee/admin/standard-answer/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ const StandardAnswersTable = ({
</div>
</div>
<div className="mx-auto">
<Table>
<Table className="w-full flex items-stretch">
<TableHeader>
<TableRow>
{columns.map((column) => (
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/admin/connectors/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ export function TextArrayField<T extends Yup.AnyObject>({
arrayHelpers.push("");
}}
className="mt-3"
variant="success"
variant="update"
size="sm"
type="button"
icon={FiPlus}
Expand Down
57 changes: 35 additions & 22 deletions web/src/components/admin/users/SignedUpUserTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import {
TableCell,
} from "@/components/ui/table";

import { Select, SelectItem } from "@/components/ui/select";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Button } from "@/components/ui/button";
import { GenericConfirmModal } from "@/components/modals/GenericConfirmModal";
import { useState } from "react";
Expand Down Expand Up @@ -77,26 +83,33 @@ const UserRoleDropdown = ({
onValueChange={handleChange}
disabled={isSettingRole}
>
{Object.entries(USER_ROLE_LABELS).map(([role, label]) =>
!isPaidEnterpriseFeaturesEnabled &&
(role === UserRole.CURATOR ||
role === UserRole.GLOBAL_CURATOR) ? null : (
<SelectItem
key={role}
value={role}
className={
role === UserRole.CURATOR ? "opacity-30 cursor-not-allowed" : ""
}
title={
role === UserRole.CURATOR
? "Curator role must be assigned in the Groups tab"
: ""
}
>
{label}
</SelectItem>
)
)}
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
{Object.entries(USER_ROLE_LABELS).map(([role, label]) =>
!isPaidEnterpriseFeaturesEnabled &&
(role === UserRole.CURATOR ||
role === UserRole.GLOBAL_CURATOR) ? null : (
<SelectItem
key={role}
value={role}
className={
role === UserRole.CURATOR
? "opacity-30 cursor-not-allowed"
: ""
}
title={
role === UserRole.CURATOR
? "Curator role must be assigned in the Groups tab"
: ""
}
>
{label}
</SelectItem>
)
)}
</SelectContent>
</Select>
{showConfirmModal && (
<GenericConfirmModal
Expand Down Expand Up @@ -258,7 +271,7 @@ const SignedUpUserTable = ({
{users.map((user) => (
<TableRow key={user.id}>
<TableCell>{user.email}</TableCell>
<TableCell>
<TableCell className="w-40 ">
<UserRoleDropdown
user={user}
onSuccess={onRoleChangeSuccess}
Expand Down
40 changes: 36 additions & 4 deletions web/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,57 @@ const buttonVariants = cva(
variant: {
success:
"bg-green-100 text-green-600 hover:bg-green-500/90 dark:bg-blue-500 dark:text-neutral-50 dark:hover:bg-green-900/90",
"success-reverse":
"bg-green-600 text-green-100 hover:bg-green-600/90 dark:bg-neutral-50 dark:text-blue-500 dark:hover:bg-green-100/90",
default:
"bg-neutral-900 border-border text-neutral-50 hover:bg-neutral-900/90 dark:bg-neutral-50 dark:text-neutral-900 dark:hover:bg-neutral-50/90",
"default-reverse":
"bg-neutral-50 border-border text-neutral-900 hover:bg-neutral-50/90 dark:bg-neutral-900 dark:text-neutral-50 dark:hover:bg-neutral-900/90",
destructive:
"bg-red-500 text-neutral-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-neutral-50 dark:hover:bg-red-900/90",
"destructive-reverse":
"bg-neutral-50 text-red-500 hover:bg-neutral-50/90 dark:bg-neutral-50 dark:text-red-900 dark:hover:bg-neutral-50/90",
outline:
"border border-neutral-200 bg-white hover:bg-neutral-100 hover:text-neutral-900 dark:border-neutral-800 dark:bg-neutral-950 dark:hover:bg-neutral-800 dark:hover:text-neutral-50",
"border border-neutral-300 bg-white hover:bg-neutral-50 hover:text-neutral-900 dark:border-neutral-800 dark:bg-neutral-950 dark:hover:bg-neutral-800 dark:hover:text-neutral-50",
"outline-reverse":
"border border-neutral-300 bg-neutral-900 hover:bg-neutral-800 hover:text-neutral-50 dark:border-neutral-800 dark:bg-white dark:hover:bg-neutral-50 dark:hover:text-neutral-900",
secondary:
"bg-neutral-100 text-neutral-900 hover:bg-neutral-100/80 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800/80",
"secondary-reverse":
"bg-neutral-900 text-neutral-100 hover:bg-neutral-900/80 dark:bg-neutral-50 dark:text-neutral-800 dark:hover:bg-neutral-50/80",
ghost:
"hover:bg-neutral-100 hover:text-neutral-900 dark:hover:bg-neutral-800 dark:hover:text-neutral-50",
"ghost-reverse":
"hover:bg-neutral-800 hover:text-neutral-50 dark:hover:bg-neutral-100 dark:hover:text-neutral-900",
link: "text-neutral-900 underline-offset-4 hover:underline dark:text-neutral-50",
"link-reverse":
"text-neutral-50 underline-offset-4 hover:underline dark:text-neutral-900",
submit:
"bg-blue-600 text-neutral-50 hover:bg-blue-600/80 dark:bg-blue-600 dark:text-neutral-50 dark:hover:bg-blue-600/90",
"submit-reverse":
"bg-neutral-50 text-blue-600 hover:bg-neutral-50/80 dark:bg-neutral-50 dark:text-blue-600 dark:hover:bg-neutral-50/90",
navigate:
"bg-blue-50 text-blue-700 hover:bg-blue-100 border border-blue-200 dark:bg-blue-900 dark:text-blue-100 dark:hover:bg-blue-800 dark:border-blue-700",
edit: "border border-neutral-200 bg-neutral-100 text-neutral-900 hover:bg-neutral-100/80 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800/80",
"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-600 dark:hover:bg-blue-700",
"navigate-reverse":
"bg-white text-blue-500 hover:bg-blue-50 dark:bg-blue-100 dark:hover:bg-blue-200",
update:
"bg-neutral-100 text-neutral-900 hover:bg-neutral-100/80 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800/80",
"update-reverse":
"bg-neutral-900 text-neutral-100 hover:bg-neutral-900/80 dark:bg-neutral-50 dark:text-neutral-800 dark:hover:bg-neutral-50/80",
next: "bg-neutral-700 text-neutral-50 hover:bg-neutral-700/90 dark:bg-neutral-600 dark:text-neutral-50 dark:hover:bg-neutral-600/90",
"next-reverse":
"bg-neutral-50 text-neutral-700 hover:bg-neutral-50/90 dark:bg-neutral-50 dark:text-neutral-600 dark:hover:bg-neutral-50/90",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
reverse: {
true: "",
false: "",
},
},
defaultVariants: {
variant: "default",
Expand All @@ -51,6 +76,7 @@ export interface ButtonProps
asChild?: boolean;
icon?: React.ElementType;
tooltip?: string;
reverse?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
Expand All @@ -69,7 +95,13 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
const Comp = asChild ? Slot : "button";
const button = (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
className={cn(
buttonVariants({
variant,
size,
className,
})
)}
ref={ref}
{...props}
>
Expand Down
11 changes: 0 additions & 11 deletions web/src/components/ui/italic.tsx

This file was deleted.

0 comments on commit a222b9d

Please sign in to comment.