Skip to content
Snippets Groups Projects
Unverified Commit 01515c6a authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

General cleanup (#4772)

parent 6f274cdb
Branches
Tags
No related merge requests found
...@@ -17,12 +17,15 @@ import useCreateServerRoom from '../../../hooks/mutations/admin/manage_users/use ...@@ -17,12 +17,15 @@ import useCreateServerRoom from '../../../hooks/mutations/admin/manage_users/use
import DeleteUserForm from './forms/DeleteUserForm'; import DeleteUserForm from './forms/DeleteUserForm';
import useUpdateUserStatus from '../../../hooks/mutations/admin/manage_users/useUpdateUserStatus'; import useUpdateUserStatus from '../../../hooks/mutations/admin/manage_users/useUpdateUserStatus';
import RoleBadge from '../roles/RoleBadge'; import RoleBadge from '../roles/RoleBadge';
import { useAuth } from '../../../contexts/auth/AuthProvider';
export default function ManageUserRow({ user }) { export default function ManageUserRow({ user }) {
const { t } = useTranslation(); const { t } = useTranslation();
const currentUser = useAuth();
const mutationWrapper = (args) => useCreateServerRoom({ userId: user.id, ...args }); const mutationWrapper = (args) => useCreateServerRoom({ userId: user.id, ...args });
const updateUserStatus = useUpdateUserStatus(); const updateUserStatus = useUpdateUserStatus();
const localizedTime = localizeDateTimeString(user?.created_at, user?.language); const localizedTime = localizeDateTimeString(user?.created_at, currentUser?.language);
return ( return (
<tr key={user.id} className="align-middle text-muted border border-2"> <tr key={user.id} className="align-middle text-muted border border-2">
......
...@@ -32,11 +32,12 @@ export default function SettingSelect({ ...@@ -32,11 +32,12 @@ export default function SettingSelect({
SettingSelect.defaultProps = { SettingSelect.defaultProps = {
defaultValue: '', defaultValue: '',
children: undefined,
}; };
SettingSelect.propTypes = { SettingSelect.propTypes = {
defaultValue: PropTypes.string, defaultValue: PropTypes.string,
title: PropTypes.string.isRequired, title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired, description: PropTypes.string.isRequired,
children: PropTypes.arrayOf(PropTypes.element).isRequired, children: PropTypes.arrayOf(PropTypes.element),
}; };
import React, { useEffect, useMemo } from 'react'; import React, { useEffect } from 'react';
import { import {
Col, Row, Col, Row,
} from 'react-bootstrap'; } from 'react-bootstrap';
...@@ -31,10 +31,9 @@ export default function HomePage() { ...@@ -31,10 +31,9 @@ export default function HomePage() {
[currentUser.signed_in], [currentUser.signed_in],
); );
// hack to deal with the fact that useEffect and toast dont work together very well useEffect(() => {
useMemo(() => {
switch (error) { switch (error) {
case 'InviteInvald': case 'InviteInvalid':
toast.error(t('toast.error.users.invalid_invite')); toast.error(t('toast.error.users.invalid_invite'));
break; break;
case 'SignupError': case 'SignupError':
...@@ -42,8 +41,7 @@ export default function HomePage() { ...@@ -42,8 +41,7 @@ export default function HomePage() {
break; break;
default: default:
} }
// Remove the error if (error) { setSearchParams(searchParams.delete('error')); }
setSearchParams(searchParams.delete('error'));
}, [error]); }, [error]);
return ( return (
......
...@@ -97,7 +97,7 @@ export default function RecordingRow({ ...@@ -97,7 +97,7 @@ export default function RecordingRow({
<Button <Button
onClick={() => window.open(format.url, '_blank')} onClick={() => window.open(format.url, '_blank')}
className={`btn-sm rounded-pill me-1 mt-1 border-0 btn-format-${format.recording_type.toLowerCase()}`} className={`btn-sm rounded-pill me-1 mt-1 border-0 btn-format-${format.recording_type.toLowerCase()}`}
key={format.id} key={`${format.recording_type}-${format.url}`}
> >
{format.recording_type} {format.recording_type}
</Button> </Button>
......
...@@ -90,7 +90,10 @@ RecordingsList.propTypes = { ...@@ -90,7 +90,10 @@ RecordingsList.propTypes = {
name: PropTypes.string, name: PropTypes.string,
length: PropTypes.number, length: PropTypes.number,
visibility: PropTypes.string, visibility: PropTypes.string,
formats: PropTypes.arrayOf(PropTypes.string), formats: PropTypes.arrayOf(PropTypes.shape({
recording_type: PropTypes.string,
url: PropTypes.string,
})),
users: PropTypes.arrayOf(PropTypes.shape({ users: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.number, id: PropTypes.number,
name: PropTypes.string, name: PropTypes.string,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment