]> git.localhorst.tv Git - alttp.git/commitdiff
sort channels on restream add form
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 6 Oct 2023 11:58:52 +0000 (13:58 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 6 Oct 2023 11:58:52 +0000 (13:58 +0200)
resources/js/components/episodes/RestreamAddForm.js

index 7cbb87d538e17b2102ebe95df68edfe9c78bba23..97fb1226ae4decddce32995b51f6d43dc8ff3979 100644 (file)
@@ -9,6 +9,8 @@ import ToggleSwitch from '../common/ToggleSwitch';
 import laravelErrorsToFormik from '../../helpers/laravelErrorsToFormik';
 import { withUser } from '../../helpers/UserContext';
 
+const channelCompare = (a, b) => a.channel.title.localeCompare(b.channel.title);
+
 const RestreamAddForm = ({
        episode,
        errors,
@@ -35,7 +37,7 @@ const RestreamAddForm = ({
                                        value={values.channel_id || 0}
                                >
                                        <option disabled value={0}>{t('general.pleaseSelect')}</option>
-                                       {((user && user.channel_crews) || []).map(c =>
+                                       {((user && user.channel_crews) || []).sort(channelCompare).map(c =>
                                                <option key={c.id} value={c.channel_id}>
                                                        {c.channel.title}
                                                </option>