From: Daniel Karbach Date: Fri, 15 Mar 2024 11:02:15 +0000 (+0100) Subject: set channel on GG controls open X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=b537f5570f85af14f7b7d64b34aa1a7946efee23;p=alttp.git set channel on GG controls open --- diff --git a/app/Http/Controllers/ChannelController.php b/app/Http/Controllers/ChannelController.php index f7d57c0..dec17e9 100644 --- a/app/Http/Controllers/ChannelController.php +++ b/app/Http/Controllers/ChannelController.php @@ -13,12 +13,17 @@ class ChannelController extends Controller { public function search(Request $request) { $validatedData = $request->validate([ + 'id' => 'array', + 'id.*' => 'integer|numeric', 'joinable' => 'boolean|nullable', 'manageable' => 'boolean|nullable', 'phrase' => 'string|nullable', ]); $channels = Channel::query(); + if (!empty($validatedData['id'])) { + $channels = $channels->whereIn('id', $validatedData['id']); + } if (isset($validatedData['joinable']) && $validatedData['joinable']) { $channels = $channels->where('twitch_chat', '!=', ''); } diff --git a/resources/js/app/Routes.js b/resources/js/app/Routes.js index 6391af1..b7269e2 100644 --- a/resources/js/app/Routes.js +++ b/resources/js/app/Routes.js @@ -136,7 +136,7 @@ const router = createBrowserRouter( /> import( /* webpackChunkName: "guessing" */ '../pages/GuessingGameControls' diff --git a/resources/js/components/common/ChannelSelect.js b/resources/js/components/common/ChannelSelect.js index 2fbb2c1..a69662f 100644 --- a/resources/js/components/common/ChannelSelect.js +++ b/resources/js/components/common/ChannelSelect.js @@ -7,7 +7,14 @@ import { useTranslation } from 'react-i18next'; import Icon from './Icon'; import debounce from '../../helpers/debounce'; -const ChannelSelect = ({ autoSelect, joinable, manageable, onChange, value }) => { +const ChannelSelect = ({ + autoSelect, + joinable, + manageable, + onChange, + readOnly, + value, +}) => { const [resolved, setResolved] = useState(null); const [results, setResults] = useState([]); const [search, setSearch] = useState(''); @@ -78,14 +85,16 @@ const ChannelSelect = ({ autoSelect, joinable, manageable, onChange, value }) => if (value) { return
{resolved ? resolved.title : value} - + {!readOnly ? + + : null}
; } return
@@ -94,6 +103,7 @@ const ChannelSelect = ({ autoSelect, joinable, manageable, onChange, value }) => name={Math.random().toString(20).substr(2, 10)} onChange={e => setSearch(e.target.value)} onFocus={() => setShowResults(true)} + readOnly={readOnly} type="search" value={search} /> @@ -127,6 +137,7 @@ ChannelSelect.propTypes = { joinable: PropTypes.bool, manageable: PropTypes.bool, onChange: PropTypes.func, + readOnly: PropTypes.bool, value: PropTypes.oneOfType([ PropTypes.number, PropTypes.string, diff --git a/resources/js/components/twitch-bot/Controls.js b/resources/js/components/twitch-bot/Controls.js index 54f4dec..3093d90 100644 --- a/resources/js/components/twitch-bot/Controls.js +++ b/resources/js/components/twitch-bot/Controls.js @@ -235,11 +235,8 @@ const Controls = () => {
{channel.access_key ?