From edb9fa9c9f9dc61804cc3136cf22efc423023f43 Mon Sep 17 00:00:00 2001 From: futpib Date: Thu, 15 Nov 2018 19:15:37 +0300 Subject: [PATCH] Show card profile availability and order by priority --- components/cards/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/cards/index.js b/components/cards/index.js index cb7ddb9..113b61f 100644 --- a/components/cards/index.js +++ b/components/cards/index.js @@ -3,6 +3,7 @@ const { values, map, path, + sortBy, } = require('ramda'); const r = require('r-dom'); @@ -50,9 +51,14 @@ const Preferences = withStateHandlers( ]), r(Select, { - options: card.profiles, + options: sortBy(p => -p.priority, card.profiles), optionValue: p => p.name, - optionText: p => p.description, + optionText: p => [ + p.description, + !p.available && '(unavailable)', + ] + .filter(Boolean) + .join(' '), value: card.activeProfileName, onChange: e => { props.actions.setCardProfile(card.index, e.target.value);