diff --git a/app/api.imba b/app/api.imba index 508a62f..2c0ae0f 100644 --- a/app/api.imba +++ b/app/api.imba @@ -1,5 +1,6 @@ import db from './db' import state from './state' +import { config, save_config } from './config' import { omit, orderBy } from 'lodash' import { parse_url } from './utils' import { nanoid } from 'nanoid' @@ -113,3 +114,7 @@ export default new class api return reader.readAsDataURL(blob) + def toggle_effective_names + config.enable_effective_names = !config.enable_effective_names + save_config! + diff --git a/app/client.imba b/app/client.imba index e292e91..8f13926 100644 --- a/app/client.imba +++ b/app/client.imba @@ -231,10 +231,6 @@ tag app viewing_community_links = no sort_links! - def handle_input - selection_index = 0 - sort_links! - def name_exists new_name state.links.some! do |{name}| new_name is name diff --git a/app/components/app-links.imba b/app/components/app-links.imba index 23cad9f..189b211 100644 --- a/app/components/app-links.imba +++ b/app/components/app-links.imba @@ -27,8 +27,9 @@ tag app-links catch no - def toggle_effective_names - config.enable_effective_names = !config.enable_effective_names + def handle_input + selection_index = 0 + sort_links! def render @@ -100,7 +101,7 @@ tag app-links <.header> - <.side.left@click=toggle_effective_names> + <.side.left@click=api.toggle_effective_names> if config.enable_effective_names else @@ -109,7 +110,7 @@ tag app-links config.enable_buttons ? "DISABLE BUTTONS" : "ENABLE BUTTONS" + <.settings-container> <.settings-button @click=handle_click_toggle_search_on_paste > config.enable_search_on_paste ? "DISABLE SEARCH ON PASTE" : "ENABLE SEARCH ON PASTE" - <.settings-button - @click=handle_click_toggle_effective_names - > - config.enable_effective_names ? "DISABLE EFFECTIVE NAMES" : "ENABLE EFFECTIVE NAMES" + <.settings-container> <.settings-button @click.if(!loading)=handle_toggle_light_theme