From c05078c513fd93a11a42e83948cd32eb7278b6eb Mon Sep 17 00:00:00 2001 From: Roland Date: Fri, 4 Oct 2024 12:19:49 -0600 Subject: [PATCH] Fixing Channel page directory selection. --- app/src/components/Channels.js | 33 ++-------------------------- app/src/components/Upload.js | 6 +---- app/src/components/admin/Settings.js | 12 +++++----- app/src/hooks/customHooks.js | 5 +++-- 4 files changed, 12 insertions(+), 44 deletions(-) diff --git a/app/src/components/Channels.js b/app/src/components/Channels.js index 52fe21ee..6a728582 100644 --- a/app/src/components/Channels.js +++ b/app/src/components/Channels.js @@ -118,14 +118,6 @@ function ChannelPage({create, header}) { return ; } - - const handleCheckbox = (e, {name, checked}) => { - if (e) { - e.preventDefault(); - } - changeValue(name, checked); - } - const handleInputChange = (e, {name, value}) => { if (e) { e.preventDefault(); @@ -154,7 +146,6 @@ function ChannelPage({create, header}) { const body = { name: channel.name, directory: channel.directory, - mkdir: channel.mkdir, url: channel.url, }; @@ -372,32 +363,12 @@ function ChannelPage({create, header}) { changeValue('directory', value)} + onSelect={value => changeValue('directory', value)} placeholder='videos/channel directory' /> - { - create !== undefined && - - {/* Empty field*/} - - - { - handleCheckbox(null, {name: 'mkdir', checked: i}) - }} - /> - - - - } + { - setDestination(value); - } - let progressBars; if (!_.isEmpty(progresses)) { progressBars = Object.entries(progresses).map(([name, value]) => { @@ -71,7 +67,7 @@ export function Upload({disabled}) { setDestination(i)} disabled={disabled} style={{marginBottom: '0.5em'}} /> diff --git a/app/src/components/admin/Settings.js b/app/src/components/admin/Settings.js index 97b63ec4..c21bef0b 100644 --- a/app/src/components/admin/Settings.js +++ b/app/src/components/admin/Settings.js @@ -268,7 +268,7 @@ export function SettingsPage() { setQrOpen(true); } - const qrButton = ; @@ -386,13 +386,13 @@ export function SettingsPage() {
- + setState({...state, navColor: value})} - value={state.navColor} + onChange={(e, {value}) => setState({...state, nav_color: value})} + value={state.nav_color} /> @@ -514,8 +514,8 @@ export function SettingsPage() { -

Configs control a WROLPi, they are the source of truth. Any changes to a config will be applied to the - database when imported (typically at startup).

+

These configs control this WROLPi; they are the source of truth. Any changes to configs will be applied to + the database when imported (typically at startup).

{ const emptyChannel = { name: '', directory: '', - mkdir: false, url: '', download_frequency: '', match_regex: '', @@ -462,7 +461,9 @@ export const useChannel = (channel_id) => { }, [channel_id]) const changeValue = (name, value) => { - setChannel({...channel, [name]: value}); + const newChannel = {...channel, [name]: value}; + console.debug('useChannel.changeValue', newChannel); + setChannel(newChannel); } return {channel, changeValue, original, fetched, fetchChannel: localGetChannel};