This commit is contained in:
Your Name
2026-09-04 20:35:40 +03:00
parent 5c4ba565d0
commit a092f1dc86
12 changed files with 299 additions and 590 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
build/
Debug/
Debug/
*.pbw
+13 -36
View File
@@ -12,42 +12,13 @@
"displayName": "Percentage",
"enableMultiJS": true,
"messageKeys": [
"ITEM_1",
"ITEM_2",
"ITEM_3",
"ITEM_4",
"ITEM_5",
"ITEM_6",
"ITEM_7",
"ITEM_8",
"ITEM_9",
"ITEM_1_SUCCESS",
"ITEM_1_FAIL",
"ITEM_1_PERCENTAGE",
"ITEM_2_SUCCESS",
"ITEM_2_FAIL",
"ITEM_2_PERCENTAGE",
"ITEM_3_SUCCESS",
"ITEM_3_FAIL",
"ITEM_3_PERCENTAGE",
"ITEM_4_SUCCESS",
"ITEM_4_FAIL",
"ITEM_4_PERCENTAGE",
"ITEM_5_SUCCESS",
"ITEM_5_FAIL",
"ITEM_5_PERCENTAGE",
"ITEM_6_SUCCESS",
"ITEM_6_FAIL",
"ITEM_6_PERCENTAGE",
"ITEM_7_SUCCESS",
"ITEM_7_FAIL",
"ITEM_7_PERCENTAGE",
"ITEM_8_SUCCESS",
"ITEM_8_FAIL",
"ITEM_8_PERCENTAGE",
"ITEM_9_SUCCESS",
"ITEM_9_FAIL",
"ITEM_9_PERCENTAGE"
"ITEM_NAME",
"ITEM_SUCCESS",
"ITEM_FAIL",
"ITEM_PERCENTAGE",
"ITEM_REMOVE",
"RED_LIMIT",
"ORANGE_LIMIT"
],
"projectType": "native",
"resources": {
@@ -109,6 +80,12 @@
"targetPlatforms": null,
"type": "font"
},
{
"file": "fonts/slkscr.ttf",
"name": "FONT_SLKSCR_8",
"targetPlatforms": null,
"type": "font"
},
{
"file": "images/scroll_bar_third.png",
"name": "IMAGE_SCROLL_BAR_THIRD",
+90
View File
@@ -0,0 +1,90 @@
#include <pebble.h>
#include "config.h"
#include "src/c/scrolllayer.h"
#include "src/c/settings.h"
#include "src/c/items.h"
static void inbox_received_handler(DictionaryIterator *iter, void *context) {
// ITEMS
// Remove scroll layer items
scroll_layer_remove_items();
Tuple *tuple;;
item_t item;
memset(&item, 0, sizeof(item));
bool remove = false;
// Get the item
tuple = dict_find(iter, MESSAGE_KEY_ITEM_NAME);
if (tuple) {
strncpy(item.name, tuple->value->cstring, MAX_CHARACTERS);
item.name[MAX_CHARACTERS - 1] = '\0';
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item.successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item.fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item.show_percentage = show_percentage;
}
// Add or remove
tuple = dict_find(iter, MESSAGE_KEY_ITEM_REMOVE);
if (tuple) {
remove = tuple->value->int32 != 0;
}
// Update list from buffer
update_items(&item, remove);
// Save the items to NVM
items_organize();
items_nvm_save();
// Update the ScrollLayer
scroll_layer_add_items();
scroll_layer_update_scrollbar();
// SETTINGS
settings_t settings_buffer;
memset(&settings_buffer, 0, sizeof(settings_buffer));
// Get settings
tuple = dict_find(iter, MESSAGE_KEY_RED_LIMIT);
if (tuple) {
settings_buffer.red_limit = tuple->value->int32;
}
tuple = dict_find(iter, MESSAGE_KEY_ORANGE_LIMIT);
if (tuple) {
settings_buffer.orange_limit = tuple->value->int32;
}
if (settings_buffer.orange_limit < settings_buffer.red_limit) {
settings_buffer.orange_limit = settings_buffer.red_limit;
}
settings_set(&settings_buffer);
settings_nvm_save();
}
void config_init() {
// Register received handler
app_message_register_inbox_received(inbox_received_handler);
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
}
void config_deinit() {
app_message_deregister_callbacks();
}
+8
View File
@@ -0,0 +1,8 @@
#pragma once
#include <pebble.h>
void config_init();
void config_deinit();
+47 -285
View File
@@ -1,4 +1,6 @@
#include <pebble.h>
#include <ctype.h>
#include "items.h"
#include "src/c/scrolllayer.h"
@@ -7,7 +9,7 @@ item_list_t s_items;
// ------------ NVM ------------
static void items_nvm_load() {
void items_nvm_load() {
if (persist_exists(ITEMS_NVM_KEY)) {
persist_read_data(ITEMS_NVM_KEY, s_items.items, sizeof(s_items.items));
}
@@ -16,23 +18,23 @@ static void items_nvm_load() {
}
}
static void items_nvm_save() {
void items_nvm_save() {
persist_write_data(ITEMS_NVM_KEY, s_items.items, sizeof(s_items.items));
}
// ------------ ITEMS ------------
static void items_organize(item_list_t *item_list) {
item_list->num_items = 0;
void items_organize() {
s_items.num_items = 0;
for (int i = 0; i < MAX_ITEMS; i++) {
if (item_list->items[i].name[0] != 0) {
if (item_list->num_items != i) {
if (s_items.items[i].name[0] != 0) {
if (s_items.num_items != i) {
// Copy item up
memcpy(&item_list->items[item_list->num_items], &item_list->items[i], sizeof(item_list->items[i]));
memcpy(&s_items.items[s_items.num_items], &s_items.items[i], sizeof(s_items.items[i]));
// Delete item
memset(&item_list->items[i], 0, sizeof(item_list->items[i]));
memset(&s_items.items[i], 0, sizeof(s_items.items[i]));
}
item_list->num_items++;
s_items.num_items++;
}
}
}
@@ -41,289 +43,53 @@ item_list_t *items_get() {
return &s_items;
}
// ------------ HELPERS ------------
static int str_case_cmp(const char *a, const char *b, size_t n) {
for (size_t i = 0; i < n; i++) {
unsigned char ca = (unsigned char)a[i];
unsigned char cb = (unsigned char)b[i];
int lca = tolower(ca);
int lcb = tolower(cb);
if (lca != lcb) {
return lca - lcb;
}
if (ca == '\0') {
return 0;
}
}
return 0;
}
// ------------ PHONE ------------
static void update_items(item_list_t *items, const item_list_t *buffer) {
if (!items || !buffer) {
void update_items(const item_t *item, bool remove) {
if (!item || item->name[0] == '\0') {
return;
}
// Check existing items
// Find existing item
for (int i = 0; i < MAX_ITEMS; i++) {
if (items->items[i].name[0] == '\0') {
continue;
if (s_items.items[i].name[0] != '\0' && str_case_cmp(s_items.items[i].name, item->name, MAX_CHARACTERS) == 0) {
if (remove) {
memset(&s_items.items[i], 0, sizeof(s_items.items[i]));
}
else {
s_items.items[i].show_percentage = item->show_percentage;
}
return;
}
}
bool found = false;
for (int j = 0; j < MAX_ITEMS; j++) {
if (buffer->items[j].name[0] != '\0' && strcmp(items->items[i].name, buffer->items[j].name) == 0) {
// Item still exists
items->items[i].show_percentage = buffer->items[j].show_percentage;
found = true;
// Not found
if (!remove) {
for (int i = 0; i < MAX_ITEMS; i++) {
if (s_items.items[i].name[0] == '\0') {
s_items.items[i] = *item;
break;
}
}
// Item no longer exists
if (!found) {
memset(&items->items[i], 0, sizeof(items->items[i]));
}
}
// Add items
for (int i = 0; i < MAX_ITEMS; i++) {
if (buffer->items[i].name[0] == '\0') {
continue;
}
bool found = false;
for (int j = 0; j < MAX_ITEMS; j++) {
if (items->items[j].name[0] != '\0' && strcmp(items->items[j].name, buffer->items[i].name) == 0) {
found = true;
break;
}
}
if (!found) {
for (int j = 0; j < MAX_ITEMS; j++) {
if (items->items[j].name[0] == '\0') {
memcpy(&items->items[j], &buffer->items[i], sizeof(items->items[j]));
break;
}
}
}
}
items_organize(items);
}
static void inbox_received_handler(DictionaryIterator *iter, void *context) {
// Remove scroll layer items
scroll_layer_remove_items();
Tuple *tuple;
item_list_t item_buffer;
// Get the item 1
tuple = dict_find(iter, MESSAGE_KEY_ITEM_1);
if (tuple) {
strncpy(item_buffer.items[0].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_1_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[0].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_1_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[0].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_1_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[0].show_percentage = show_percentage;
}
// Get the item 2
tuple = dict_find(iter, MESSAGE_KEY_ITEM_2);
if (tuple) {
strncpy(item_buffer.items[1].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_2_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[1].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_2_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[1].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_2_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[1].show_percentage = show_percentage;
}
// Get the item 3
tuple = dict_find(iter, MESSAGE_KEY_ITEM_3);
if (tuple) {
strncpy(item_buffer.items[2].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_3_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[2].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_3_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[2].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_3_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[2].show_percentage = show_percentage;
}
// Get the item 4
tuple = dict_find(iter, MESSAGE_KEY_ITEM_4);
if (tuple) {
strncpy(item_buffer.items[3].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_4_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[3].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_4_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[3].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_4_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[3].show_percentage = show_percentage;
}
// Get the item 5
tuple = dict_find(iter, MESSAGE_KEY_ITEM_5);
if (tuple) {
strncpy(item_buffer.items[4].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_5_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[4].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_5_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[4].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_5_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[4].show_percentage = show_percentage;
}
// Get the item 6
tuple = dict_find(iter, MESSAGE_KEY_ITEM_6);
if (tuple) {
strncpy(item_buffer.items[5].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_6_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[5].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_6_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[5].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_6_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[5].show_percentage = show_percentage;
}
// Get the item 7
tuple = dict_find(iter, MESSAGE_KEY_ITEM_7);
if (tuple) {
strncpy(item_buffer.items[6].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_7_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[6].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_7_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[6].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_7_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[6].show_percentage = show_percentage;
}
// Get the item 8
tuple = dict_find(iter, MESSAGE_KEY_ITEM_8);
if (tuple) {
strncpy(item_buffer.items[7].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_8_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[7].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_8_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[7].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_8_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[7].show_percentage = show_percentage;
}
// Get the item 9
tuple = dict_find(iter, MESSAGE_KEY_ITEM_9);
if (tuple) {
strncpy(item_buffer.items[8].name, tuple->value->cstring, MAX_CHARACTERS);
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_9_SUCCESS);
if (tuple) {
int success = atoi(tuple->value->cstring);
if (success < 0) { success = 0; }
item_buffer.items[8].successes = success;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_9_FAIL);
if (tuple) {
int fail = atoi(tuple->value->cstring);
if (fail < 0) { fail = 0; }
item_buffer.items[8].fails = fail;
}
tuple = dict_find(iter, MESSAGE_KEY_ITEM_9_PERCENTAGE);
if (tuple) {
bool show_percentage = tuple->value->int32 != 0;
item_buffer.items[8].show_percentage = show_percentage;
}
// Organize buffer
items_organize(&item_buffer);
// Update list from buffer
update_items(&s_items, &item_buffer);
// Save the items to NVM
items_organize(&s_items);
items_nvm_save();
// Update the ScrollLayer
scroll_layer_add_items();
scroll_layer_update_scrollbar();
}
// ------------ INITS ------------
@@ -331,10 +97,6 @@ void items_init() {
// Read items from NVM
items_nvm_load();
items_organize(&s_items);
// Register received handler
app_message_register_inbox_received(inbox_received_handler);
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
}
void items_deinit() {
+5 -1
View File
@@ -4,7 +4,7 @@
// NVM
#define ITEMS_NVM_KEY 1
#define MAX_ITEMS 9
#define MAX_CHARACTERS 10
#define MAX_CHARACTERS 32
typedef struct {
@@ -20,6 +20,10 @@ typedef struct {
} item_list_t;
void items_nvm_load();
void items_nvm_save();
void items_organize();
item_list_t *items_get();
void update_items(const item_t *item, bool remove);
void items_init();
void items_deinit();
+14
View File
@@ -3,6 +3,8 @@
#include "src/c/battery.h"
#include "src/c/time.h"
#include "src/c/scrolllayer.h"
#include "src/c/config.h"
#include "src/c/settings.h"
static Window *s_main_window;
@@ -59,6 +61,12 @@ static void main_window_unload(Window *window) {
}
static void init() {
// Register app config
config_init();
// Settings load
settings_init();
// MAIN WINDOW CREATE
s_main_window = window_create();
window_set_background_color(s_main_window, GColorBlack);
@@ -70,6 +78,12 @@ static void init() {
}
static void deinit() {
// Config deinit
config_deinit();
// Settings deinit
settings_deinit();
// MAIN WINDOW DESTROY
window_destroy(s_main_window);
}
+25 -5
View File
@@ -2,10 +2,12 @@
#include "scrolllayer.h"
#include "src/c/colors.h"
#include "src/c/settings.h"
static ScrollLayer *s_scroll_layer;
static Layer *s_scroll_bar_layer;
static GFont s_scrolllayer_font;
static GFont s_scrolllayer_font_small;
static GBitmap *s_background_bitmap;
static GBitmap *s_plus_bitmap;
static GBitmap *s_minus_bitmap;
@@ -29,6 +31,9 @@ static int s_scroll_y;
static int s_scroll_page;
static scroll_items_t s_scroll_items;
// SETTINGS
settings_t *app_settings;
// ------------ SCROLL ------------
static void scroll_up(ClickRecognizerRef recognizer, void *context) {
@@ -99,11 +104,12 @@ static void click_config_provider(void *context) {
// ------------ HELPERS ------------
static GColor get_color_float(float val) {
GColor color;
int percentage = (int)(val * 100.0);
if (val < RED_LIMIT) {
if (percentage < app_settings->red_limit) {
color = RED;
}
else if (val < ORANGE_LIMIT) {
else if (percentage < app_settings->orange_limit) {
color = ORANGE;
}
else {
@@ -163,9 +169,15 @@ void scroll_layer_add_items() {
scroll_layer_add_child(s_scroll_layer, bitmap_layer_get_layer(s_scroll_items.backgrounds[i]));
// Add text
int name_len = (int)strlen(s_scroll_items.items->items[i].name);
s_scroll_items.texts[i] = text_layer_create(GRect(26, (i * ITEM_UI_HEIGHT) + 4, 124, 16));
text_layer_set_text(s_scroll_items.texts[i], s_scroll_items.items->items[i].name);
text_layer_set_font(s_scroll_items.texts[i], s_scrolllayer_font);
if (name_len < 10) {
text_layer_set_font(s_scroll_items.texts[i], s_scrolllayer_font);
}
else {
text_layer_set_font(s_scroll_items.texts[i], s_scrolllayer_font_small);
}
text_layer_set_text_alignment(s_scroll_items.texts[i], GTextAlignmentCenter);
text_layer_set_background_color(s_scroll_items.texts[i], GColorClear);
text_layer_set_text_color(s_scroll_items.texts[i], WHITE);
@@ -465,8 +477,12 @@ void scrolllayer_init(Layer *parent, Window *window) {
s_scroll_page = 0;
GRect bounds = SCROLLLAYER_FRAME_RECT;
// Load custom font
// Load settings
app_settings = settings_get();
// Load custom fonts
s_scrolllayer_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SLKSCR_16));
s_scrolllayer_font_small = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_SLKSCR_8));
// Add touch areas
item_1_plus_button = ITEM_1_PLUS_BUTTON_RECT;
@@ -533,8 +549,12 @@ void scrolllayer_init(Layer *parent, Window *window) {
}
void scrolllayer_deinit() {
// Unload font
// Destroy settings
app_settings = NULL;
// Unload fonts
fonts_unload_custom_font(s_scrolllayer_font);
fonts_unload_custom_font(s_scrolllayer_font_small);
// Unsubscribe touch
touch_service_unsubscribe();
-4
View File
@@ -26,10 +26,6 @@
#define MAX_UI_PAGES (MAX_ITEMS / MAX_UI_ITEMS)
#define ITEM_UI_HEIGHT 56
// LIMITS
#define RED_LIMIT 0.1
#define ORANGE_LIMIT 0.4
typedef struct {
item_list_t *items;
int page_count;
+39
View File
@@ -0,0 +1,39 @@
#include "settings.h"
settings_t main_settings;
// ------------ NVM ------------
void settings_nvm_load() {
if (persist_exists(SETTINGS_NVM_KEY)) {
persist_read_data(SETTINGS_NVM_KEY, &main_settings, sizeof(settings_t));
}
else {
memset(&main_settings, 0, sizeof(settings_t));
main_settings.red_limit = RED_LIMIT * 100;
main_settings.orange_limit = ORANGE_LIMIT * 100;
}
}
void settings_nvm_save() {
persist_write_data(SETTINGS_NVM_KEY, &main_settings, sizeof(settings_t));
}
settings_t *settings_get() {
return &main_settings;
}
void settings_set(settings_t *new_settings) {
memcpy(&main_settings, new_settings, sizeof(settings_t));
}
void settings_init() {
// Load settings from NVM
settings_nvm_load();
}
void settings_deinit() {
}
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include <pebble.h>
// NVM
#define SETTINGS_NVM_KEY 2
// DEFAULT LIMITS
#define RED_LIMIT 0.1
#define ORANGE_LIMIT 0.4
typedef struct {
int orange_limit;
int red_limit;
} settings_t;
void settings_nvm_load();
void settings_nvm_save();
settings_t *settings_get();
void settings_set(settings_t *new_settings);
void settings_init();
void settings_deinit();
+30 -258
View File
@@ -5,7 +5,7 @@ module.exports = [
},
{
"type": "text",
"defaultValue": "Character limit is 10. If numbers go higher than 1000, use percentage."
"defaultValue": "Add/remove up to 9 items. Character limit is 10. If numbers go higher than 1000, use percentage."
},
{
@@ -13,30 +13,36 @@ module.exports = [
"items": [
{
"type": "heading",
"defaultValue": "Item 1"
"defaultValue": "Item"
},
{
"type": "input",
"messageKey": "ITEM_1",
"messageKey": "ITEM_NAME",
"defaultValue": ""
},
{
"type": "input",
"messageKey": "ITEM_1_SUCCESS",
"messageKey": "ITEM_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_1_FAIL",
"messageKey": "ITEM_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_1_PERCENTAGE",
"messageKey": "ITEM_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
},
{
"type": "toggle",
"messageKey": "ITEM_REMOVE",
"label": "Remove item",
"defaultValue": false
}
]
},
@@ -46,261 +52,27 @@ module.exports = [
"items": [
{
"type": "heading",
"defaultValue": "Item 2"
"defaultValue": "Settings"
},
{
"type": "input",
"messageKey": "ITEM_2",
"defaultValue": ""
"type": "slider",
"messageKey": "RED_LIMIT",
"defaultValue": 10,
"label": "Red limit",
"description": "Turns color to red below this limit",
"min": 1,
"max": 100,
"step": 1
},
{
"type": "input",
"messageKey": "ITEM_2_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_2_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_2_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
}
]
},
{
"type": "section",
"items": [
{
"type": "heading",
"defaultValue": "Item 3"
},
{
"type": "input",
"messageKey": "ITEM_3",
"defaultValue": ""
},
{
"type": "input",
"messageKey": "ITEM_3_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_3_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_3_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
}
]
},
{
"type": "section",
"items": [
{
"type": "heading",
"defaultValue": "Item 4"
},
{
"type": "input",
"messageKey": "ITEM_4",
"defaultValue": ""
},
{
"type": "input",
"messageKey": "ITEM_4_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_4_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_4_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
}
]
},
{
"type": "section",
"items": [
{
"type": "heading",
"defaultValue": "Item 5"
},
{
"type": "input",
"messageKey": "ITEM_5",
"defaultValue": ""
},
{
"type": "input",
"messageKey": "ITEM_5_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_5_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_5_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
}
]
},
{
"type": "section",
"items": [
{
"type": "heading",
"defaultValue": "Item 6"
},
{
"type": "input",
"messageKey": "ITEM_6",
"defaultValue": ""
},
{
"type": "input",
"messageKey": "ITEM_6_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_6_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_6_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
}
]
},
{
"type": "section",
"items": [
{
"type": "heading",
"defaultValue": "Item 7"
},
{
"type": "input",
"messageKey": "ITEM_7",
"defaultValue": ""
},
{
"type": "input",
"messageKey": "ITEM_7_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_7_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_7_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
}
]
},
{
"type": "section",
"items": [
{
"type": "heading",
"defaultValue": "Item 8"
},
{
"type": "input",
"messageKey": "ITEM_8",
"defaultValue": ""
},
{
"type": "input",
"messageKey": "ITEM_8_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_8_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_8_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
}
]
},
{
"type": "section",
"items": [
{
"type": "heading",
"defaultValue": "Item 9"
},
{
"type": "input",
"messageKey": "ITEM_9",
"defaultValue": ""
},
{
"type": "input",
"messageKey": "ITEM_9_SUCCESS",
"label": "Success",
"defaultValue": "0"
},
{
"type": "input",
"messageKey": "ITEM_9_FAIL",
"label": "Fail",
"defaultValue": "0"
},
{
"type": "toggle",
"messageKey": "ITEM_9_PERCENTAGE",
"label": "Show percentage",
"defaultValue": false
{
"type": "slider",
"messageKey": "ORANGE_LIMIT",
"defaultValue": 40,
"label": "Orange limit",
"description": "Turns color to orange below this limit",
"min": 1,
"max": 100,
"step": 1
}
]
},