mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-09 13:44:29 +08:00
fixes
This commit is contained in:
parent
cf0962f8bf
commit
6b118663d1
2 changed files with 17 additions and 7 deletions
|
|
@ -17,6 +17,8 @@ import { SortedTable } from "../utils/sorted-table";
|
|||
|
||||
const pageElement = $(".page.pageFriends");
|
||||
|
||||
let friendsTable: SortedTable<Friend> | undefined = undefined;
|
||||
|
||||
const addFriendModal = new SimpleModal({
|
||||
id: "addFriend",
|
||||
title: "Add a friend",
|
||||
|
|
@ -103,12 +105,17 @@ async function fetchFriends(): Promise<void> {
|
|||
$(".pageFriends .friends table").removeClass("hidden");
|
||||
$(".pageFriends .friends .nodata").addClass("hidden");
|
||||
|
||||
new SortedTable<Friend>({
|
||||
table: ".pageFriends .friends table",
|
||||
data: result.body.data,
|
||||
buildRow: buildFriendRow,
|
||||
initialSort: { property: "name", descending: false },
|
||||
});
|
||||
if (friendsTable === undefined) {
|
||||
friendsTable = new SortedTable<Friend>({
|
||||
table: ".pageFriends .friends table",
|
||||
data: result.body.data,
|
||||
buildRow: buildFriendRow,
|
||||
initialSort: { property: "name", descending: false },
|
||||
});
|
||||
} else {
|
||||
friendsTable.setData(result.body.data);
|
||||
}
|
||||
friendsTable.updateBody();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
type Sort = { property: string; descending: boolean };
|
||||
type Sort = {
|
||||
property: string;
|
||||
descending: boolean;
|
||||
};
|
||||
|
||||
type SortedTableOptions<T> = {
|
||||
table: string;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue