From 028c6fd8b3f77618e168bb1247334af7e14ecd68 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 26 Jun 2020 14:40:27 +0200 Subject: [PATCH] Sort buffers and members --- components/buffer-list.js | 20 +++++++++++++++++++- components/member-list.js | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/components/buffer-list.js b/components/buffer-list.js index 353c1ff..10c456c 100644 --- a/components/buffer-list.js +++ b/components/buffer-list.js @@ -39,10 +39,28 @@ function BufferItem(props) { `; } +function compareBuffers(a, b) { + if (a.type == BufferType.SERVER) { + return -1; + } + if (b.type == BufferType.SERVER) { + return 1; + } + + if (a.name > b.name) { + return -1; + } + if (a.name < b.name) { + return 1; + } + + return 0; +} + export default function BufferList(props) { return html` diff --git a/components/member-list.js b/components/member-list.js index 8ead455..e605265 100644 --- a/components/member-list.js +++ b/components/member-list.js @@ -17,7 +17,7 @@ function MemberItem(props) { export default function MemberList(props) { return html`