Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / applications / drive / src / app / store / _views / useDevicesView.ts
blobebcf0033e61e1042ba4761d233aa93c8992fdec4
1 import { SORT_DIRECTION } from '@proton/shared/lib/constants';
3 import { useDevicesListing } from '../_devices';
4 import { useUserSettings } from '../_settings';
5 import { useMemoArrayNoMatterTheOrder } from './utils';
6 import type { SortField } from './utils/useSortingDevices';
7 import { useSortingWithDefault } from './utils/useSortingDevices';
9 const DEFAULT_SORT = {
10     sortField: 'name' as SortField,
11     sortOrder: SORT_DIRECTION.ASC,
14 export default function useDevicesView() {
15     const devicesListing = useDevicesListing();
17     const devices = devicesListing.cachedDevices;
19     const cachedDevices = useMemoArrayNoMatterTheOrder(devices);
21     const { layout } = useUserSettings();
22     const { sortedList } = useSortingWithDefault(cachedDevices, DEFAULT_SORT);
24     return {
25         layout,
26         items: sortedList,
27         isLoading: devicesListing.isLoading,
28     };