Pin Bloc 0 and Arrivant juste at top of relations list, sort others alphabetically

- Rename "Newbie" to "Arrivant juste"
- Base friends (Bloc 0, Arrivant juste) always stay at the top
- User-added relations are sorted below them

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-02-21 15:50:31 +01:00
parent 2b5543791f
commit 554602ad52
2 changed files with 13 additions and 3 deletions

View File

@@ -101,11 +101,19 @@ function toggleSort(key: string) {
}
const sortedItems = computed(() => {
const items = [...props.items];
const baseNames = new Set(props.baseFriends.map((f) => f.name));
const bases: TableFriend[] = [];
const others: TableFriend[] = [];
for (const item of props.items) {
if (baseNames.has(item.name)) bases.push(item);
else others.push(item);
}
const key = sortKey.value;
const dir = sortAsc.value ? 1 : -1;
return items.sort((a, b) => {
others.sort((a, b) => {
const first = a[key];
const second = b[key];
let cmp = 0;
@@ -123,6 +131,8 @@ const sortedItems = computed(() => {
}
return cmp * dir;
});
return [...bases, ...others];
});
function isBaseFriend(friend: TableFriend): boolean {