diff --git a/app/components/gratewizard/GwCRA.vue b/app/components/gratewizard/GwCRA.vue index 7966e8f..3937d6c 100644 --- a/app/components/gratewizard/GwCRA.vue +++ b/app/components/gratewizard/GwCRA.vue @@ -134,7 +134,7 @@ import { Block0Date, getDays, getRatio, dateToString, fr, type Friend, type Tabl const todayDate = dateToString(new Date()); const baseFriends: Friend[] = [ { name: 'Bloc 0', date: Block0Date }, - { name: 'Newbie', date: todayDate }, + { name: 'Arrivant juste', date: todayDate }, ]; const price = useLocalStorage('price', '1'); diff --git a/app/components/gratewizard/GwRelations.vue b/app/components/gratewizard/GwRelations.vue index 994069d..138b7c0 100644 --- a/app/components/gratewizard/GwRelations.vue +++ b/app/components/gratewizard/GwRelations.vue @@ -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 {