sort detailed profiles
This commit is contained in:
@@ -3,6 +3,9 @@ import type {
|
||||
BookmarkSummary,
|
||||
ExtensionSortKey,
|
||||
ExtensionSummary,
|
||||
AssociatedProfileSortKey,
|
||||
AssociatedProfileSummary,
|
||||
BookmarkAssociatedProfileSummary,
|
||||
ProfileSortKey,
|
||||
ProfileSummary,
|
||||
} from "../types/browser";
|
||||
@@ -73,6 +76,19 @@ export function sortBookmarks(items: BookmarkSummary[], sortKey: BookmarkSortKey
|
||||
});
|
||||
}
|
||||
|
||||
export function sortAssociatedProfiles(
|
||||
items: (AssociatedProfileSummary | BookmarkAssociatedProfileSummary)[],
|
||||
sortKey: AssociatedProfileSortKey,
|
||||
) {
|
||||
const profiles = [...items];
|
||||
return profiles.sort((left, right) => {
|
||||
if (sortKey === "name") {
|
||||
return compareText(left.name, right.name) || compareProfileId(left.id, right.id);
|
||||
}
|
||||
return compareProfileId(left.id, right.id) || compareText(left.name, right.name);
|
||||
});
|
||||
}
|
||||
|
||||
function profileSortKeyValue(profileId: string) {
|
||||
if (profileId === "Default") {
|
||||
return { group: 0, number: 0, text: profileId };
|
||||
|
||||
Reference in New Issue
Block a user