overleaf/services/web/frontend/js/features/group-management/components/error-alert.tsx
Alexandre Bourdin ed40a87cdc [web] Migrate group management to React (#11293)
* Rename manage group entry point

* Migrate group management root page to React

* Add cypress tests for the group management react page

* Fix linting

* Add checkbox labels for screen-readers + remove unused classes

* Await on add/remove members calls

* Display the export CSV link for a full group

* Display error message when group is full

* Sort locales

* Handle the managers management page in React version

* Fix missing type in GroupMemberRow

* Split members and managers React pages

* Build API paths on frontend side + add cypress tests for each page

* Fix linting

* Update unit tests

* Review improvements

* Type API errors

GitOrigin-RevId: d124a9d24cbf33de8aacc5d69e9d46e7bcda93c5
2023-02-07 09:04:18 +00:00

31 lines
530 B
TypeScript

import { useTranslation } from 'react-i18next'
export type APIError = {
message?: string
}
type ErrorAlertProps = {
error?: APIError
}
export default function ErrorAlert({ error }: ErrorAlertProps) {
const { t } = useTranslation()
if (!error) {
return null
}
if (error.message) {
return (
<div className="alert alert-danger">
{t('error')}: {error.message}
</div>
)
}
return (
<div className="alert alert-danger">
{t('generic_something_went_wrong')}
</div>
)
}