Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
avoid dead code warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerry Archibald committed Aug 11, 2022
1 parent b45ed8d commit 74272ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/views/settings/devices/FilteredDeviceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
import React from 'react';

import DeviceTile from './DeviceTile';
import { filterDevicesBySecurityRecommendation } from './filter';
import { DevicesDictionary, DeviceWithVerification } from './useOwnDevices';

interface Props {
Expand All @@ -27,16 +28,17 @@ interface Props {
const sortDevicesByLatestActivity = (left: DeviceWithVerification, right: DeviceWithVerification) =>
(right.last_seen_ts || 0) - (left.last_seen_ts || 0);

const getSortedDevices = (devices: DevicesDictionary) =>
Object.values(devices).sort(sortDevicesByLatestActivity);
const getFilteredSortedDevices = (devices: DevicesDictionary) =>
filterDevicesBySecurityRecommendation(Object.values(devices), [])
.sort(sortDevicesByLatestActivity);

/**
* Filtered list of devices
* Sorted by latest activity descending
* TODO(kerrya) Filtering to added as part of PSG-648
*/
const FilteredDeviceList: React.FC<Props> = ({ devices }) => {
const sortedDevices = getSortedDevices(devices);
const sortedDevices = getFilteredSortedDevices(devices);

return <ol className='mx_FilteredDeviceList'>
{ sortedDevices.map((device) =>
Expand Down

0 comments on commit 74272ce

Please sign in to comment.