mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import * as React from 'react';
|
|
|
|
import { Box, Button, FormLabel } from '@mui/joy';
|
|
import RefreshIcon from '@mui/icons-material/Refresh';
|
|
|
|
import type { ToggleableBoolean } from '~/common/util/hooks/useToggleableBoolean';
|
|
|
|
|
|
/**
|
|
* Bottom row: model reload and optional 'advanced' toggle
|
|
*/
|
|
export function SetupFormRefetchButton(props: {
|
|
refetch: () => void,
|
|
disabled: boolean,
|
|
loading: boolean,
|
|
error: boolean,
|
|
leftButton?: React.ReactNode,
|
|
advanced?: ToggleableBoolean
|
|
}) {
|
|
return (
|
|
<Box sx={{ display: 'flex', alignItems: 'end', justifyContent: 'space-between' }}>
|
|
|
|
{props.leftButton}
|
|
|
|
{!!props.advanced && (
|
|
<FormLabel onClick={props.advanced.toggle} sx={{ textDecoration: 'underline', cursor: 'pointer', color: 'text.tertiary' }}>
|
|
{props.advanced.on ? 'Hide Advanced' : 'Advanced'}
|
|
</FormLabel>
|
|
)}
|
|
|
|
<Button
|
|
color={props.error ? 'warning' : 'primary'}
|
|
disabled={props.disabled}
|
|
loading={props.loading}
|
|
endDecorator={<RefreshIcon />}
|
|
onClick={props.refetch}
|
|
sx={{ minWidth: 120, ml: 'auto' }}
|
|
>
|
|
Models
|
|
</Button>
|
|
|
|
</Box>
|
|
);
|
|
} |