From af453eea71edccd6cd1905d8f06d6cccadd1a465 Mon Sep 17 00:00:00 2001 From: Manuel Stahl Date: Mon, 5 Feb 2024 13:06:47 +0100 Subject: [PATCH] Remove/mark unused parameters All top level components should pass props to the generic react-admin component to be more versatile. Change-Id: I25dd099cde1aefacbc748dc4716a8b0a3db9ab93 --- src/components/EventReports.js | 43 +++++++------- src/components/ImportFeature.js | 8 +-- src/components/RegistrationTokens.js | 86 +++++++++++++--------------- src/components/RoomDirectory.js | 6 +- src/components/destinations.js | 6 +- src/components/devices.js | 1 + src/components/media.js | 9 ++- src/components/rooms.js | 19 +++--- src/components/statistics.js | 44 +++++++------- src/components/users.js | 67 +++++++++++----------- 10 files changed, 142 insertions(+), 147 deletions(-) diff --git a/src/components/EventReports.js b/src/components/EventReports.js index 7e9c2a3..8185960 100644 --- a/src/components/EventReports.js +++ b/src/components/EventReports.js @@ -98,26 +98,23 @@ export const ReportShow = props => { ); }; -export const ReportList = ({ ...props }) => { - return ( - } - sort={{ field: "received_ts", order: "DESC" }} - bulkActionButtons={false} - > - - - - - - - - - ); -}; +export const ReportList = props => ( + } + sort={{ field: "received_ts", order: "DESC" }} + > + + + + + + + + +); diff --git a/src/components/ImportFeature.js b/src/components/ImportFeature.js index d30d302..c0066fe 100644 --- a/src/components/ImportFeature.js +++ b/src/components/ImportFeature.js @@ -32,7 +32,7 @@ function TranslatableOption({ value, text }) { return ; } -const FilePicker = props => { +const FilePicker = () => { const [values, setValues] = useState(null); const [error, setError] = useState(null); const [stats, setStats] = useState(null); @@ -191,7 +191,7 @@ const FilePicker = props => { return true; }; - const runImport = async e => { + const runImport = async _e => { if (progress !== null) { notify("import_users.errors.already_in_progress"); return; @@ -307,7 +307,7 @@ const FilePicker = props => { let retries = 0; const submitRecord = recordData => { return dataProvider.getOne("users", { id: recordData.id }).then( - async alreadyExists => { + async _alreadyExists => { if (LOGGING) console.log("already existed"); if (useridMode === "update" || conflictMode === "skip") { @@ -332,7 +332,7 @@ const FilePicker = props => { } } }, - async okToSubmit => { + async _okToSubmit => { if (LOGGING) console.log( "OK to create record " + diff --git a/src/components/RegistrationTokens.js b/src/components/RegistrationTokens.js index 97a2581..779feec 100644 --- a/src/components/RegistrationTokens.js +++ b/src/components/RegistrationTokens.js @@ -54,30 +54,28 @@ const dateFormatter = v => { const registrationTokenFilters = []; -export const RegistrationTokenList = props => { - return ( - - - - - - - - - - ); -}; +export const RegistrationTokenList = props => ( + + + + + + + + + +); export const RegistrationTokenCreate = props => ( @@ -104,24 +102,22 @@ export const RegistrationTokenCreate = props => ( ); -export const RegistrationTokenEdit = props => { - return ( - - - - - - - - - - ); -}; +export const RegistrationTokenEdit = props => ( + + + + + + + + + +); diff --git a/src/components/RoomDirectory.js b/src/components/RoomDirectory.js index 84d4027..4fbcca7 100644 --- a/src/components/RoomDirectory.js +++ b/src/components/RoomDirectory.js @@ -102,16 +102,16 @@ export const RoomDirectorySaveButton = () => { const refresh = useRefresh(); const [create, { isloading }] = useCreate(); - const handleSend = values => { + const handleSend = () => { create( "room_directory", { data: { id: record.id } }, { - onSuccess: data => { + onSuccess: _data => { notify("resources.room_directory.action.send_success"); refresh(); }, - onError: error => + onError: _error => notify("resources.room_directory.action.send_failure", { type: "error", }), diff --git a/src/components/destinations.js b/src/components/destinations.js index 6027258..cdd9e99 100644 --- a/src/components/destinations.js +++ b/src/components/destinations.js @@ -42,7 +42,7 @@ const destinationRowSx = (record, _index) => ({ const destinationFilters = []; -export const DestinationReconnectButton = props => { +export const DestinationReconnectButton = () => { const record = useRecordContext(); const refresh = useRefresh(); const notify = useNotify(); @@ -83,13 +83,13 @@ export const DestinationReconnectButton = props => { ); }; -const DestinationShowActions = props => ( +const DestinationShowActions = () => ( ); -const DestinationTitle = props => { +const DestinationTitle = () => { const record = useRecordContext(); const translate = useTranslate(); return ( diff --git a/src/components/devices.js b/src/components/devices.js index e467c39..313bb47 100644 --- a/src/components/devices.js +++ b/src/components/devices.js @@ -44,6 +44,7 @@ export const DeviceRemoveButton = props => { return ( <> @@ -311,7 +312,11 @@ export const QuarantineMediaButton = props => { })} >
-
diff --git a/src/components/rooms.js b/src/components/rooms.js index 23d2000..deedfb1 100644 --- a/src/components/rooms.js +++ b/src/components/rooms.js @@ -54,7 +54,7 @@ const RoomPagination = props => ( ); -const RoomTitle = props => { +const RoomTitle = () => { const record = useRecordContext(); const translate = useTranslate(); var name = ""; @@ -69,23 +69,23 @@ const RoomTitle = props => { ); }; -const RoomShowActions = ({ data, resource }) => { +const RoomShowActions = () => { + const record = useRecordContext(); var roomDirectoryStatus = ""; - if (data) { - roomDirectoryStatus = data.public; + if (record) { + roomDirectoryStatus = record.public; } return ( {roomDirectoryStatus === false && ( - + )} {roomDirectoryStatus === true && ( - + )} ( ); -export const RoomList = () => { +export const RoomList = props => { const theme = useTheme(); return ( } sort={{ field: "name", order: "ASC" }} filters={roomFilters} diff --git a/src/components/statistics.js b/src/components/statistics.js index 9dca38b..1cadac6 100644 --- a/src/components/statistics.js +++ b/src/components/statistics.js @@ -52,27 +52,25 @@ const UserMediaStatsPagination = props => ( const userMediaStatsFilters = []; -export const UserMediaStatsList = props => { - return ( - } - filters={userMediaStatsFilters} - pagination={} - sort={{ field: "media_length", order: "DESC" }} +export const UserMediaStatsList = props => ( + } + filters={userMediaStatsFilters} + pagination={} + sort={{ field: "media_length", order: "DESC" }} + > + "/users/" + id + "/media"} + bulkActionButtons={false} > - "/users/" + id + "/media"} - bulkActionButtons={false} - > - - - - - - - ); -}; + + + + + + +); diff --git a/src/components/users.js b/src/components/users.js index 53d0e5a..a2e240f 100644 --- a/src/components/users.js +++ b/src/components/users.js @@ -134,11 +134,10 @@ const userFilters = [ />, ]; -const UserBulkActionButtons = props => ( +const UserBulkActionButtons = () => ( <> - + ( ); -export const UserList = props => { - return ( - } - pagination={} - > - }> - - - - - - - - - - ); -}; +export const UserList = props => ( + } + pagination={} + > + }> + + + + + + + + + +); // https://matrix.org/docs/spec/appendices#user-identifiers // here only local part of user_id @@ -300,7 +297,7 @@ export const UserCreate = props => ( ); -const UserTitle = props => { +const UserTitle = () => { const record = useRecordContext(); const translate = useTranslate(); return (