Skip to content

Commit

Permalink
resolved eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Prayag-Das committed Dec 14, 2024
1 parent 3e9f929 commit e456173
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ const DescriptionForm = ({ groupDescription, groupPath }: { groupDescription: st
<div className="relative">
<form className="max-w-full flex rounded bg-white" onSubmit={handleSubmit(onSubmit)}>
<input
className="rounded-r-none float-left border-0 block w-full h-[calc(1.5em+0.75rem+2px)] p-[0.375rem_0.75rem] text-base font-normal leading-6 text-gray-700 bg-white border border-gray-300 rounded transition duration-150 ease-in-out focus:border-blue-500 focus:outline-none"
className="rounded-r-none float-left border-0 block w-full
h-[calc(1.5em+0.75rem+2px)] p-[0.375rem_0.75rem] text-base font-normal
leading-6 text-gray-700 bg-white border-gray-300 rounded transition duration-150
ease-in-out focus:border-blue-500 focus:outline-none"
{...register('description')}
placeholder="Brief description for this grouping..."
maxLength={98}
Expand All @@ -97,7 +100,8 @@ const DescriptionForm = ({ groupDescription, groupPath }: { groupDescription: st
<Tooltip>
<TooltipTrigger asChild>
<button
className="text-primary border-none bg-white text-text-color px-1 py-0.5 my-0 mx-0.5 h-9"
className="text-primary border-none bg-white
text-text-color px-1 py-0.5 my-0 mx-0.5 h-9"
disabled={isSubmitting}
type="submit"
aria-label="circle-check"
Expand All @@ -121,7 +125,8 @@ const DescriptionForm = ({ groupDescription, groupPath }: { groupDescription: st
<button
type="button"
onClick={closeForm}
className="text-primary border-none bg-white text-text-color px-1 py-0.5 my-0 mx-0.5 h-9"
className="text-primary border-none bg-white
text-text-color px-1 py-0.5 my-0 mx-0.5 h-9"
aria-label="times-circle"
>
<FontAwesomeIcon
Expand All @@ -141,7 +146,8 @@ const DescriptionForm = ({ groupDescription, groupPath }: { groupDescription: st
{currentDescription.length >= 98 && (
<Alert
data-testid="description-alert"
className="bg-rose-100 text-rose-900 lg:w-max lg:h-[50px] md:w-max md:h-[50px] sm:h-1/2 pt-2.5 pl-2 pr-2 mb-1 mt-1 border"
className="bg-rose-100 text-rose-900 lg:w-max lg:h-[50px]
md:w-max md:h-[50px] sm:h-1/2 pt-2.5 pl-2 pr-2 mb-1 mt-1 border"
>
<strong>Maximum length reached. </strong>A grouping&apos;s description cannot exceed 98
characters.
Expand Down
10 changes: 8 additions & 2 deletions ui/src/components/modal/remove-member-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,14 @@ const RemoveMemberModal = ({
</div>
</div>
<AlertDialogDescription>
Are you sure you want to remove <span className="font-bold text-text-color">{name}</span> from the{' '}
<span>{list}</span> list?
Are you sure you want to remove{' '}
<span
className="font-bold
text-text-color"
>
{name}
</span>{' '}
from the <span>{list}</span> list?
</AlertDialogDescription>
<div className="px-3">
<Alert className="bg-yellow-100 border border-yellow-200 mb-2">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,115 +1,112 @@
import {
AlertDialog, AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger
AlertDialog,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger
} from '@/components/ui/alert-dialog';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input'
import { Input } from '@/components/ui/input';
import { Dispatch, SetStateAction } from 'react';
import { Alert, AlertDescription } from '@/components/ui/alert';
import { Label } from '@/components/ui/label';
import { MemberResult } from '@/lib/types';
import { addAdmin } from '@/lib/actions';

interface InputProps {
input: string;
setInput: Dispatch<SetStateAction<string>>;
input: string;
setInput: Dispatch<SetStateAction<string>>;
}

const AddAdminsDialog = ({input, setInput} : InputProps, {uid, name, uhUuid} : MemberResult) => {
const AddAdminsDialog = ({ input, setInput }: InputProps, { uid, name, uhUuid }: MemberResult) => {
return (
<div className="inline-flex" role="group">
<Input
className="rounded-r-none"
placeholder={'UH Username or UH #'}
value={input || ''}
onChange={(e) => setInput(e.target.value)}
/>
<AlertDialog>
<AlertDialogTrigger asChild>
<Button className="rounded-l-none">Add</Button>
</AlertDialogTrigger>
<AlertDialogContent className="sm:max-w-[500px]">
<AlertDialogHeader>
<AlertDialogTitle className="text-[1.4rem] text-text-color">Add Member</AlertDialogTitle>
<AlertDialogDescription>
You are about to add the following member to the admins list.
</AlertDialogDescription>
</AlertDialogHeader>
<div className="grid grid-cols-2">
<div className="grid">
<div className="grid grid-cols-3 items-center py-1 px-4">
<Label htmlFor="name" className="font-bold text-s text-left whitespace-nowrap">
NAME:
</Label>
</div>
<div className="grid grid-cols-3 items-center py-1 px-4">
<Label htmlFor="name" className="font-bold text-s text-left whitespace-nowrap">
UH USERNAME:
</Label>
</div>
<div className="grid grid-cols-3 items-center py-1 px-4">
<Label htmlFor="name" className="font-bold text-s text-left whitespace-nowrap">
UH USER ID:
</Label>
</div>
</div>

return (
<div className="inline-flex" role="group">
<Input
className="rounded-r-none"
placeholder={'UH Username or UH #'}
value={input || ''}
{/*second column*/}

onChange={e => setInput(e.target.value)}
/>
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
className="rounded-l-none"
>
Add
</Button>
</AlertDialogTrigger>
<AlertDialogContent className="sm:max-w-[500px]">
<AlertDialogHeader>
<AlertDialogTitle className="text-[1.4rem] text-text-color">Add Member</AlertDialogTitle>
<AlertDialogDescription>
You are about to add the following member to the admins list.
</AlertDialogDescription>
</AlertDialogHeader>
<div className="grid grid-cols-2">
<div className="grid">
<div className="grid grid-cols-3 items-center py-1 px-4">
<Label htmlFor="name" className="font-bold text-s text-left whitespace-nowrap">
NAME:
</Label>
</div>
<div className="grid grid-cols-3 items-center py-1 px-4">
<Label htmlFor="name" className="font-bold text-s text-left whitespace-nowrap">
UH USERNAME:
</Label>
</div>
<div className="grid grid-cols-3 items-center py-1 px-4">
<Label htmlFor="name" className="font-bold text-s text-left whitespace-nowrap">
UH USER ID:
</Label>
</div>
</div>

{/*second column*/}

<div className="grid">
<div className="grid grid-cols-3 items-center">
<Label htmlFor="name" className="text-s text-left whitespace-nowrap">
{name}
</Label>
</div>
<div className="grid grid-cols-4 items-center">
<Label htmlFor="name" className="text-s text-left whitespace-nowrap">
{uid}
</Label>
</div>
<div className="grid grid-cols-4 items-center">
<Label htmlFor="name" className="text-s text-left whitespace-nowrap">
{uhUuid}
</Label>
</div>
</div>
</div>
<AlertDialogDescription>
Are you sure you want to add <span className="font-bold text-text-color">{name}</span> to the admins list?
</AlertDialogDescription>
<div className="px-3">
<Alert className="bg-yellow-100 border border-yellow-200 mb-2">
<AlertDescription>
Membership changes made
may not take effect immediately.
Usually, 3-5 minutes should be
anticipated. In extreme cases changes
may take several hours to be fully
processed, depending on the number
of members and the synchronization
destination.
</AlertDescription>
</Alert>
</div>
<AlertDialogFooter>
<Button onClick={() => addAdmin(uid)}>Yes</Button>
<AlertDialogCancel onClick={() => close()}>Cancel</AlertDialogCancel>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
);
<div className="grid">
<div className="grid grid-cols-3 items-center">
<Label htmlFor="name" className="text-s text-left whitespace-nowrap">
{name}
</Label>
</div>
<div className="grid grid-cols-4 items-center">
<Label htmlFor="name" className="text-s text-left whitespace-nowrap">
{uid}
</Label>
</div>
<div className="grid grid-cols-4 items-center">
<Label htmlFor="name" className="text-s text-left whitespace-nowrap">
{uhUuid}
</Label>
</div>
</div>
</div>
<AlertDialogDescription>
Are you sure you want to add{' '}
<span
className="font-bold
text-text-color"
>
{name}
</span>{' '}
to the admins list?
</AlertDialogDescription>
<div className="px-3">
<Alert className="bg-yellow-100 border border-yellow-200 mb-2">
<AlertDescription>
Membership changes made may not take effect immediately. Usually, 3-5 minutes should be
anticipated. In extreme cases changes may take several hours to be fully processed,
depending on the number of members and the synchronization destination.
</AlertDescription>
</Alert>
</div>
<AlertDialogFooter>
<Button onClick={() => addAdmin(uid)}>Yes</Button>
<AlertDialogCancel onClick={() => close()}>Cancel</AlertDialogCancel>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
);
};

export default AddAdminsDialog;
12 changes: 9 additions & 3 deletions ui/src/components/table/table-element/global-filter.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { Input } from '@/components/ui/input';
import { Dispatch, SetStateAction } from 'react';

const GlobalFilter = ({ placeholder, filter, setFilter }: { placeholder: string; filter: string; setFilter: Dispatch<SetStateAction<string>> }) => (
<Input placeholder={placeholder} value={filter || ''} onChange={(e) => setFilter(e.target.value)} />
);
const GlobalFilter = ({
placeholder,
filter,
setFilter
}: {
placeholder: string;
filter: string;
setFilter: Dispatch<SetStateAction<string>>;
}) => <Input placeholder={placeholder} value={filter || ''} onChange={(e) => setFilter(e.target.value)} />;

export default GlobalFilter;
19 changes: 16 additions & 3 deletions ui/src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay
ref={ref}
className={cn(
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out ' +
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
)}
{...props}
Expand All @@ -38,13 +39,25 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
className={cn(
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-slate-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-slate-800 dark:bg-slate-950',
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] ' +
'translate-y-[-50%] gap-4 border border-slate-200 bg-white p-6 shadow-lg duration-200 ' +
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 ' +
'data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 ' +
'data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] ' +
'data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] ' +
'sm:rounded-lg dark:border-slate-800 dark:bg-slate-950',
className
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-slate-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-slate-100 data-[state=open]:text-slate-500 dark:ring-offset-slate-950 dark:focus:ring-slate-300 dark:data-[state=open]:bg-slate-800 dark:data-[state=open]:text-slate-400">
<DialogPrimitive.Close
className="absolute right-4 top-4 rounded-sm opacity-70
ring-offset-white transition-opacity hover:opacity-100 focus:outline-none
focus:ring-2 focus:ring-slate-950 focus:ring-offset-2 disabled:pointer-events-none
data-[state=open]:bg-slate-100 data-[state=open]:text-slate-500 dark:ring-offset-slate-950
dark:focus:ring-slate-300 dark:data-[state=open]:bg-slate-800 dark:data-[state=open]:text-slate-400"
>
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
Expand Down
3 changes: 0 additions & 3 deletions ui/src/lib/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import {
GroupingRemoveResult,
GroupingRemoveResults,
GroupingUpdateDescriptionResult,
GroupingGroupMembers,
GroupingPaths,
MemberAttributeResults
} from './types';
import {
Expand All @@ -20,7 +18,6 @@ import {
postRequest,
postRequestAsync,
putRequest,
getRequest,
putRequestAsync
} from './http-client';
import { getUser } from '@/lib/access/user';
Expand Down

0 comments on commit e456173

Please sign in to comment.