From f874f2a54ca47c25e3378244603a8ee716352404 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Thu, 15 Apr 2021 11:26:11 +0100 Subject: [PATCH] fix: improvements to quick links --- .../modals/main/scss/settings/_buttons.scss | 3 +-- src/components/widgets/navbar/Notes.jsx | 6 ++++-- .../widgets/quicklinks/QuickLinks.jsx | 19 ++++++++++++++++++- src/modules/default_settings.json | 8 ++++++++ src/modules/helpers/settings.js | 2 +- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/components/modals/main/scss/settings/_buttons.scss b/src/components/modals/main/scss/settings/_buttons.scss index 41210df2..5cbdb822 100644 --- a/src/components/modals/main/scss/settings/_buttons.scss +++ b/src/components/modals/main/scss/settings/_buttons.scss @@ -167,8 +167,7 @@ legend { padding-left: 10px; border-radius: 15px; margin-bottom: 10px; - font-size: 1.5rem; - width: 250px !important; + font-size: 1.325rem; svg { font-size: 1.3rem; diff --git a/src/components/widgets/navbar/Notes.jsx b/src/components/widgets/navbar/Notes.jsx index 2ae3bd5e..afe74414 100644 --- a/src/components/widgets/navbar/Notes.jsx +++ b/src/components/widgets/navbar/Notes.jsx @@ -33,12 +33,14 @@ export default class Notes extends React.PureComponent { } componentDidMount() { + const noteContainer = document.getElementById('noteContainer'); + if (localStorage.getItem('notesPinned') === 'true') { - document.getElementById('noteContainer').classList.toggle('visibilityshow'); + noteContainer.classList.toggle('visibilityshow'); } if (localStorage.getItem('refresh') === 'false') { - document.getElementById('noteContainer').style.marginLeft = '-200px'; + noteContainer.style.marginLeft = '-200px'; } } diff --git a/src/components/widgets/quicklinks/QuickLinks.jsx b/src/components/widgets/quicklinks/QuickLinks.jsx index 4638ade2..3f17e998 100644 --- a/src/components/widgets/quicklinks/QuickLinks.jsx +++ b/src/components/widgets/quicklinks/QuickLinks.jsx @@ -33,9 +33,15 @@ export default class QuickLinks extends React.PureComponent { addLink = () => { let data = JSON.parse(localStorage.getItem('quicklinks')); + let url = this.state.url; + + if (!url.startsWith('http://') && !url.startsWith('https://')) { + url = 'http://' + url; + } + data.push({ name: this.state.name, - url: this.state.url, + url: url, key: Math.random().toString(36).substring(7) + 1 }); @@ -77,6 +83,17 @@ export default class QuickLinks extends React.PureComponent { }); } }); + + const addlink = document.querySelector('.topbarquicklinks'); + + addlink.onkeydown = (e) => { + e = e || window.event; + let code = e.which || e.keyCode; + if (code === 13 && this.state.showAddLink === 'visible') { + this.addLink(); + e.preventDefault(); + } + } } render() { diff --git a/src/modules/default_settings.json b/src/modules/default_settings.json index 25e752b3..84ae40e6 100644 --- a/src/modules/default_settings.json +++ b/src/modules/default_settings.json @@ -178,5 +178,13 @@ { "name": "backgroundVideoMute", "value": true + }, + { + "name": "quicklinkstooltip", + "value": true + }, + { + "name": "notesEnabled", + "value": true } ] diff --git a/src/modules/helpers/settings.js b/src/modules/helpers/settings.js index c8139bc3..f9c06656 100644 --- a/src/modules/helpers/settings.js +++ b/src/modules/helpers/settings.js @@ -36,7 +36,7 @@ export default class SettingsFunctions { if (old !== null && !value) { if (old === 'true') { - val = false; + val = false; } if (old === 'false') {