Skip to content

Commit

Permalink
fix(console): small ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
baktun14 committed Aug 6, 2024
1 parent dfff217 commit b301f7f
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const AllowanceModal: React.FunctionComponent<Props> = ({ editingAllowanc
min={0}
step={0.000001}
max={denomData?.inputMax}
startIcon={denomData?.label}
startIcon={<span className="text-xs pl-2">{denomData?.label}</span>}
/>
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export const GrantModal: React.FunctionComponent<Props> = ({ editingGrant, addre
min={0}
step={0.000001}
max={denomData?.inputMax}
startIcon={denomData?.label}
startIcon={<span className="text-xs pl-2">{denomData?.label}</span>}
className="ml-4 flex-grow"
/>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/deploy-web/src/components/sdl/CpuFormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const CpuFormControl: React.FunctionComponent<Props> = ({ control, servic
min={0.1}
step={0.1}
max={validationConfig.maxCpuAmount}
className="ml-4 w-[100px]"
inputClassName="ml-4 w-[100px]"
/>
</div>

Expand Down
3 changes: 2 additions & 1 deletion apps/deploy-web/src/components/sdl/GpuFormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const GpuFormControl: React.FunctionComponent<Props> = ({ gpuModels, cont
min={1}
step={1}
max={validationConfig.maxGpuAmount}
className="w-[100px]"
inputClassName="w-[100px]"
/>
</div>
)}
Expand All @@ -122,6 +122,7 @@ export const GpuFormControl: React.FunctionComponent<Props> = ({ gpuModels, cont
step={1}
color="secondary"
aria-label="GPUs"
className="pt-2"
onValueChange={newValue => field.onChange(newValue)}
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions apps/deploy-web/src/components/sdl/ImageSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ export const ImageSelect: React.FunctionComponent<Props> = ({ control, currentSe
onResizeCapture={undefined}
>
<ul className="relative m-0 max-h-[40vh] list-none overflow-auto py-2">
{filteredGpuTemplates.map(template => (
{filteredGpuTemplates.map((template, i) => (
<li
className="MuiAutocomplete-option flex w-full cursor-pointer items-center justify-between px-4 py-2 text-sm hover:bg-neutral-100 dark:text-neutral-200 dark:hover:bg-neutral-800"
ref={eleRefs[template.id as string]}
key={template.id}
key={`${template.id}-${i}`}
onClick={() => _onSelectTemplate(template)}
onMouseOver={() => {
setHoveredTemplate(template);
Expand Down
8 changes: 4 additions & 4 deletions apps/deploy-web/src/components/sdl/MemoryFormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const MemoryFormControl: React.FunctionComponent<Props> = ({ control, ser
control={control}
name={`services.${serviceIndex}.profile.ram`}
render={({ field, fieldState }) => (
<FormPaper className={cn({ ["border-b border-red-500"]: !!fieldState.error })}>
<FormPaper>
<FormItem>
<div className="flex flex-col items-start sm:flex-row sm:items-center">
<div className="flex items-center">
Expand Down Expand Up @@ -68,7 +68,7 @@ export const MemoryFormControl: React.FunctionComponent<Props> = ({ control, ser
onChange={event => field.onChange(parseFloat(event.target.value))}
min={1}
step={1}
className="w-[100px]"
inputClassName="w-[100px]"
/>

<Controller
Expand All @@ -77,8 +77,8 @@ export const MemoryFormControl: React.FunctionComponent<Props> = ({ control, ser
defaultValue=""
render={({ field }) => (
<Select value={field.value || ""} onValueChange={field.onChange}>
<SelectTrigger className="ml-1">
<SelectValue placeholder="Select unit" className="w-[75px]" />
<SelectTrigger className="ml-1 w-[75px]">
<SelectValue placeholder="Select unit" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
Expand Down
10 changes: 5 additions & 5 deletions apps/deploy-web/src/components/sdl/PersistentStorage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const PersistentStorage: React.FunctionComponent<Props> = ({ currentServi
name={`services.${serviceIndex}.profile.persistentStorage`}
render={({ field, fieldState }) => (
<FormItem>
<div className="flex items-start justify-between sm:flex-row sm:items-center">
<div className="flex flex-col items-start sm:flex-row sm:items-center">
<div className="flex items-center">
<div className="flex items-center">
<MdStorage className="mr-2 text-2xl text-muted-foreground" />
Expand Down Expand Up @@ -75,7 +75,7 @@ export const PersistentStorage: React.FunctionComponent<Props> = ({ currentServi
</div>

{currentService.profile.hasPersistentStorage && (
<div className="mt-2 flex items-center sm:mt-0">
<div className="mt-2 flex items-center sm:ml-4 sm:mt-0">
<Input
type="number"
color="secondary"
Expand All @@ -84,7 +84,7 @@ export const PersistentStorage: React.FunctionComponent<Props> = ({ currentServi
onChange={event => field.onChange(parseFloat(event.target.value))}
min={1}
step={1}
className="w-[100px]"
inputClassName="w-[100px]"
/>

<Controller
Expand All @@ -93,8 +93,8 @@ export const PersistentStorage: React.FunctionComponent<Props> = ({ currentServi
defaultValue=""
render={({ field }) => (
<Select value={field.value || ""} onValueChange={field.onChange}>
<SelectTrigger className="ml-1">
<SelectValue placeholder="Select unit" className="w-[75px]" />
<SelectTrigger className="ml-1 w-[75px]">
<SelectValue placeholder="Select unit" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
Expand Down
2 changes: 1 addition & 1 deletion apps/deploy-web/src/components/sdl/RentGpusForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export const RentGpusForm: React.FunctionComponent = () => {

<Form {...form}>
<form onSubmit={handleSubmit(onSubmit)} ref={formRef} autoComplete="off">
<FormPaper className="mt-4 p-4">
<FormPaper className="mt-4 md:p-4">
<ImageSelect control={control as any} currentService={currentService} onSelectTemplate={onSelectTemplate} />

<div className="mt-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ export const SimpleServiceFormControl: React.FunctionComponent<Props> = ({
</div>
}
placeholder="Example: mydockerimage:1.01"
className="space-y-1"
value={field.value}
error={!!fieldState.error}
onChange={event => field.onChange((event.target.value || "").toLowerCase())}
Expand Down
8 changes: 4 additions & 4 deletions apps/deploy-web/src/components/sdl/StorageFormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const StorageFormControl: React.FunctionComponent<Props> = ({ control, se
control={control}
name={`services.${serviceIndex}.profile.storage`}
render={({ field, fieldState }) => (
<FormPaper className={cn({ ["border-b border-red-500"]: !!fieldState.error })}>
<FormPaper>
<FormItem>
<div className="flex flex-col items-start sm:flex-row sm:items-center">
<div className="flex items-center">
Expand Down Expand Up @@ -71,7 +71,7 @@ export const StorageFormControl: React.FunctionComponent<Props> = ({ control, se
onChange={event => field.onChange(parseFloat(event.target.value))}
min={1}
step={1}
className="w-[100px]"
inputClassName="w-[100px]"
/>

<Controller
Expand All @@ -80,8 +80,8 @@ export const StorageFormControl: React.FunctionComponent<Props> = ({ control, se
defaultValue=""
render={({ field }) => (
<Select value={field.value || ""} onValueChange={field.onChange}>
<SelectTrigger className="ml-1">
<SelectValue placeholder="Select unit" className="w-[75px]" />
<SelectTrigger className="ml-1 w-[75px]">
<SelectValue placeholder="Select unit" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
Expand Down
2 changes: 1 addition & 1 deletion apps/deploy-web/src/utils/sdl/sdlImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const importSimpleSdl = (yamlStr: string) => {
const _expose: ExposeType = {
id: nanoid(),
port: expose.port,
as: expose.as,
as: expose.as || 80,
proto: expose.proto === "tcp" ? expose.proto : "http",
global: !!isGlobal,
to: expose.to.filter(t => t.global === undefined).map(t => ({ id: nanoid(), value: t.service })),
Expand Down
5 changes: 2 additions & 3 deletions packages/ui/components/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ const FormInput = React.forwardRef<HTMLInputElement, FormInputProps>(({ classNam
const { error } = useFormField();
return (
<FormItem className={className}>
{label && <FormLabel>{label}</FormLabel>}
<FormControl>
<Input type={type} inputClassName={inputClassName} ref={ref} error={!!error} {...props} />
<Input type={type} inputClassName={inputClassName} ref={ref} error={!!error} label={label} {...props} />
</FormControl>
{description && <FormDescription>{description}</FormDescription>}
<FormMessage />
Expand Down Expand Up @@ -47,7 +46,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
const formField = useFormField();

return (
<div className={className}>
<div className={cn("space-y-1", className)}>
{label && (formField.id ? <FormLabel>{label}</FormLabel> : <Label htmlFor={`${id}-input`}>{label}</Label>)}
<div className="relative flex items-center">
{startIcon && <div className={cn("absolute inset-y-0 left-0 flex items-center", startIconClassName)}>{startIcon}</div>}
Expand Down

0 comments on commit b301f7f

Please sign in to comment.