Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
This commit is contained in:
@@ -27,10 +27,10 @@ export interface CustomStatusDialogProps {
|
||||
|
||||
/**
|
||||
* CustomStatusDialog Component
|
||||
*
|
||||
*
|
||||
* Provides a dialog interface for users to set or clear their custom status message.
|
||||
* The status is stored in Matrix presence and will be visible to other users.
|
||||
*
|
||||
*
|
||||
* @param props - Component props
|
||||
* @returns The custom status dialog component
|
||||
*/
|
||||
@@ -38,9 +38,9 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
const mx = useMatrixClient();
|
||||
const userId = mx.getUserId();
|
||||
const presence = useUserPresence(userId ?? '');
|
||||
|
||||
|
||||
const [statusText, setStatusText] = useState(presence?.status || '');
|
||||
|
||||
|
||||
/**
|
||||
* Handles input changes for the status text field
|
||||
* @param evt - The change event from the input
|
||||
@@ -48,7 +48,7 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
const handleChange: ChangeEventHandler<HTMLInputElement> = (evt) => {
|
||||
setStatusText(evt.currentTarget.value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Async callback to save the status to Matrix presence
|
||||
*/
|
||||
@@ -59,9 +59,9 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
status_msg: statusText,
|
||||
});
|
||||
onClose();
|
||||
}, [mx, presence?.presence, statusText, onClose])
|
||||
}, [mx, presence?.presence, statusText, onClose]),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Async callback to clear the status from Matrix presence
|
||||
*/
|
||||
@@ -73,9 +73,9 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
});
|
||||
setStatusText('');
|
||||
onClose();
|
||||
}, [mx, presence?.presence, onClose])
|
||||
}, [mx, presence?.presence, onClose]),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Handles form submission to save the custom status
|
||||
* @param evt - The form submit event
|
||||
@@ -84,7 +84,7 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
evt.preventDefault();
|
||||
saveStatus();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handles the clear status button click
|
||||
*/
|
||||
@@ -118,7 +118,7 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
Your custom status will be visible to other users
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
|
||||
<Box direction="Column" gap="200">
|
||||
<Input
|
||||
value={statusText}
|
||||
@@ -126,7 +126,10 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
placeholder="What's on your mind?"
|
||||
maxLength={100}
|
||||
autoFocus
|
||||
disabled={saveState.status === AsyncStatus.Loading || clearState.status === AsyncStatus.Loading}
|
||||
disabled={
|
||||
saveState.status === AsyncStatus.Loading ||
|
||||
clearState.status === AsyncStatus.Loading
|
||||
}
|
||||
/>
|
||||
{statusText.length > 0 && (
|
||||
<Text size="T200" priority="300">
|
||||
@@ -135,7 +138,8 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{(saveState.status === AsyncStatus.Error || clearState.status === AsyncStatus.Error) && (
|
||||
{(saveState.status === AsyncStatus.Error ||
|
||||
clearState.status === AsyncStatus.Error) && (
|
||||
<Text size="T300" priority="400" style={{ color: 'var(--color-critical-main)' }}>
|
||||
Failed to update status. Please try again.
|
||||
</Text>
|
||||
@@ -146,7 +150,10 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
type="button"
|
||||
variant="Secondary"
|
||||
onClick={onClose}
|
||||
disabled={saveState.status === AsyncStatus.Loading || clearState.status === AsyncStatus.Loading}
|
||||
disabled={
|
||||
saveState.status === AsyncStatus.Loading ||
|
||||
clearState.status === AsyncStatus.Loading
|
||||
}
|
||||
>
|
||||
<Text size="B400">Cancel</Text>
|
||||
</Button>
|
||||
@@ -156,7 +163,10 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
variant="Critical"
|
||||
fill="None"
|
||||
onClick={handleClear}
|
||||
disabled={saveState.status === AsyncStatus.Loading || clearState.status === AsyncStatus.Loading}
|
||||
disabled={
|
||||
saveState.status === AsyncStatus.Loading ||
|
||||
clearState.status === AsyncStatus.Loading
|
||||
}
|
||||
>
|
||||
<Text size="B400">Clear Status</Text>
|
||||
</Button>
|
||||
@@ -164,7 +174,10 @@ export function CustomStatusDialog({ open, onClose }: CustomStatusDialogProps) {
|
||||
<Button
|
||||
type="submit"
|
||||
variant="Primary"
|
||||
disabled={saveState.status === AsyncStatus.Loading || clearState.status === AsyncStatus.Loading}
|
||||
disabled={
|
||||
saveState.status === AsyncStatus.Loading ||
|
||||
clearState.status === AsyncStatus.Loading
|
||||
}
|
||||
>
|
||||
<Text size="B400">
|
||||
{saveState.status === AsyncStatus.Loading ? 'Saving...' : 'Save'}
|
||||
|
||||
Reference in New Issue
Block a user