Refine control room upload settings UI defaults
This commit is contained in:
@@ -2923,7 +2923,7 @@ class EventPublicController extends BaseController
|
||||
$autoApproveUploads = $uploadVisibility === 'immediate';
|
||||
$controlRoom = Arr::get($eventModel->settings ?? [], 'control_room', []);
|
||||
$controlRoom = is_array($controlRoom) ? $controlRoom : [];
|
||||
$autoAddApprovedToLiveSetting = (bool) Arr::get($controlRoom, 'auto_add_approved_to_live', false);
|
||||
$autoAddApprovedToLiveSetting = (bool) Arr::get($controlRoom, 'auto_add_approved_to_live', true);
|
||||
$trustedUploaders = Arr::get($controlRoom, 'trusted_uploaders', []);
|
||||
$forceReviewUploaders = Arr::get($controlRoom, 'force_review_uploaders', []);
|
||||
$autoAddApprovedToLiveDefault = $autoAddApprovedToLiveSetting || $autoApproveUploads;
|
||||
|
||||
@@ -133,7 +133,7 @@ class PhotoController extends Controller
|
||||
$photo->status = $validated['visible'] ? 'approved' : 'hidden';
|
||||
$photo->save();
|
||||
|
||||
$autoRemoveLiveOnHide = (bool) Arr::get($event->settings ?? [], 'control_room.auto_remove_live_on_hide', false);
|
||||
$autoRemoveLiveOnHide = (bool) Arr::get($event->settings ?? [], 'control_room.auto_remove_live_on_hide', true);
|
||||
if ($autoRemoveLiveOnHide && ! $validated['visible']) {
|
||||
$photo->rejectForLiveShow($request->user(), 'hidden');
|
||||
}
|
||||
@@ -537,7 +537,7 @@ class PhotoController extends Controller
|
||||
|
||||
$photo->update($validated);
|
||||
|
||||
$autoRemoveLiveOnHide = (bool) Arr::get($event->settings ?? [], 'control_room.auto_remove_live_on_hide', false);
|
||||
$autoRemoveLiveOnHide = (bool) Arr::get($event->settings ?? [], 'control_room.auto_remove_live_on_hide', true);
|
||||
if ($autoRemoveLiveOnHide && ($validated['status'] ?? null) === 'rejected') {
|
||||
$photo->rejectForLiveShow($request->user());
|
||||
}
|
||||
|
||||
@@ -2484,6 +2484,7 @@
|
||||
},
|
||||
"automation": {
|
||||
"title": "Automatik",
|
||||
"sectionTitle": "Einstellungen für Uploads",
|
||||
"autoApproveHighlights": {
|
||||
"label": "Highlights automatisch freigeben",
|
||||
"help": "Wenn du ein ausstehendes Foto highlightest, wird es automatisch freigegeben."
|
||||
|
||||
@@ -2486,6 +2486,7 @@
|
||||
},
|
||||
"automation": {
|
||||
"title": "Automation",
|
||||
"sectionTitle": "Einstellungen für Uploads",
|
||||
"autoApproveHighlights": {
|
||||
"label": "Auto-approve highlights",
|
||||
"help": "When you highlight a pending photo it will be approved automatically."
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import React from 'react';
|
||||
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Check, Eye, EyeOff, Image as ImageIcon, RefreshCcw, Settings, Sparkles } from 'lucide-react';
|
||||
import { Check, ChevronDown, Eye, EyeOff, Image as ImageIcon, RefreshCcw, Settings, Sparkles } from 'lucide-react';
|
||||
import { YStack, XStack } from '@tamagui/stacks';
|
||||
import { SizableText as Text } from '@tamagui/text';
|
||||
import { Pressable } from '@tamagui/react-native-web-lite';
|
||||
import { Switch } from '@tamagui/switch';
|
||||
import { Accordion } from '@tamagui/accordion';
|
||||
import { MobileShell, HeaderActionButton } from './components/MobileShell';
|
||||
import { MobileCard, CTAButton, SkeletonCard } from './components/Primitives';
|
||||
import { MobileField, MobileSelect } from './components/FormControls';
|
||||
@@ -302,9 +303,9 @@ export default function MobileEventControlRoomPage() {
|
||||
const [liveBusyId, setLiveBusyId] = React.useState<number | null>(null);
|
||||
|
||||
const [controlRoomSettings, setControlRoomSettings] = React.useState<ControlRoomSettings>({
|
||||
auto_approve_highlights: false,
|
||||
auto_add_approved_to_live: false,
|
||||
auto_remove_live_on_hide: false,
|
||||
auto_approve_highlights: true,
|
||||
auto_add_approved_to_live: true,
|
||||
auto_remove_live_on_hide: true,
|
||||
trusted_uploaders: [],
|
||||
force_review_uploaders: [],
|
||||
});
|
||||
@@ -463,10 +464,11 @@ export default function MobileEventControlRoomPage() {
|
||||
|
||||
React.useEffect(() => {
|
||||
const settings = (activeEvent?.settings?.control_room ?? {}) as ControlRoomSettings;
|
||||
const resolveFlag = (value: boolean | undefined) => (typeof value === 'boolean' ? value : true);
|
||||
setControlRoomSettings({
|
||||
auto_approve_highlights: Boolean(settings.auto_approve_highlights),
|
||||
auto_add_approved_to_live: Boolean(settings.auto_add_approved_to_live),
|
||||
auto_remove_live_on_hide: Boolean(settings.auto_remove_live_on_hide),
|
||||
auto_approve_highlights: resolveFlag(settings.auto_approve_highlights),
|
||||
auto_add_approved_to_live: resolveFlag(settings.auto_add_approved_to_live),
|
||||
auto_remove_live_on_hide: resolveFlag(settings.auto_remove_live_on_hide),
|
||||
trusted_uploaders: Array.isArray(settings.trusted_uploaders) ? settings.trusted_uploaders : [],
|
||||
force_review_uploaders: Array.isArray(settings.force_review_uploaders) ? settings.force_review_uploaders : [],
|
||||
});
|
||||
@@ -1018,6 +1020,26 @@ export default function MobileEventControlRoomPage() {
|
||||
</XStack>
|
||||
|
||||
<MobileCard>
|
||||
<Accordion type="single" collapsible defaultValue="upload-settings">
|
||||
<Accordion.Item value="upload-settings">
|
||||
<Accordion.Trigger
|
||||
{...({
|
||||
padding: '$2',
|
||||
borderWidth: 1,
|
||||
borderColor: border,
|
||||
borderRadius: 14,
|
||||
backgroundColor: surfaceMuted,
|
||||
} as any)}
|
||||
>
|
||||
<XStack justifyContent="space-between" alignItems="center" flex={1}>
|
||||
<Text fontSize="$sm" fontWeight="800" color={text}>
|
||||
{t('controlRoom.automation.sectionTitle', 'Einstellungen für Uploads')}
|
||||
</Text>
|
||||
<ChevronDown size={16} color={muted} />
|
||||
</XStack>
|
||||
</Accordion.Trigger>
|
||||
<Accordion.Content {...({ paddingTop: '$2' } as any)}>
|
||||
<YStack space="$3">
|
||||
<YStack space="$2">
|
||||
<Text fontSize="$sm" fontWeight="800" color={text}>
|
||||
{t('controlRoom.automation.title', 'Automation')}
|
||||
@@ -1099,9 +1121,7 @@ export default function MobileEventControlRoomPage() {
|
||||
</Switch>
|
||||
</MobileField>
|
||||
</YStack>
|
||||
</MobileCard>
|
||||
|
||||
<MobileCard>
|
||||
<YStack space="$2">
|
||||
<Text fontSize="$sm" fontWeight="800" color={text}>
|
||||
{t('controlRoom.automation.uploaders.title', 'Uploader overrides')}
|
||||
@@ -1120,11 +1140,10 @@ export default function MobileEventControlRoomPage() {
|
||||
'Uploads from these devices skip the approval queue.',
|
||||
)}
|
||||
>
|
||||
<XStack alignItems="center" space="$2">
|
||||
<YStack space="$2">
|
||||
<MobileSelect
|
||||
value={trustedUploaderSelection}
|
||||
onChange={(event) => setTrustedUploaderSelection(event.target.value)}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<option value="">{t('common.select', 'Select')}</option>
|
||||
{uploaderOptions.map((option) => (
|
||||
@@ -1137,11 +1156,9 @@ export default function MobileEventControlRoomPage() {
|
||||
label={t('controlRoom.automation.uploaders.add', 'Add')}
|
||||
onPress={() => addUploaderRule('trusted')}
|
||||
tone="ghost"
|
||||
fullWidth={false}
|
||||
disabled={controlRoomSaving || !trustedUploaderSelection}
|
||||
style={{ width: 100 }}
|
||||
/>
|
||||
</XStack>
|
||||
</YStack>
|
||||
{trustedUploaders.length ? (
|
||||
<YStack space="$2">
|
||||
{trustedUploaders.map((rule) => (
|
||||
@@ -1195,11 +1212,10 @@ export default function MobileEventControlRoomPage() {
|
||||
'Uploads from these devices always need approval.',
|
||||
)}
|
||||
>
|
||||
<XStack alignItems="center" space="$2">
|
||||
<YStack space="$2">
|
||||
<MobileSelect
|
||||
value={forceReviewSelection}
|
||||
onChange={(event) => setForceReviewSelection(event.target.value)}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<option value="">{t('common.select', 'Select')}</option>
|
||||
{uploaderOptions.map((option) => (
|
||||
@@ -1212,11 +1228,9 @@ export default function MobileEventControlRoomPage() {
|
||||
label={t('controlRoom.automation.uploaders.add', 'Add')}
|
||||
onPress={() => addUploaderRule('force')}
|
||||
tone="ghost"
|
||||
fullWidth={false}
|
||||
disabled={controlRoomSaving || !forceReviewSelection}
|
||||
style={{ width: 100 }}
|
||||
/>
|
||||
</XStack>
|
||||
</YStack>
|
||||
{forceReviewUploaders.length ? (
|
||||
<YStack space="$2">
|
||||
{forceReviewUploaders.map((rule) => (
|
||||
@@ -1263,6 +1277,10 @@ export default function MobileEventControlRoomPage() {
|
||||
)}
|
||||
</MobileField>
|
||||
</YStack>
|
||||
</YStack>
|
||||
</Accordion.Content>
|
||||
</Accordion.Item>
|
||||
</Accordion>
|
||||
</MobileCard>
|
||||
|
||||
{activeTab === 'moderation' ? (
|
||||
|
||||
@@ -108,6 +108,17 @@ vi.mock('@tamagui/switch', () => ({
|
||||
),
|
||||
}));
|
||||
|
||||
vi.mock('@tamagui/accordion', () => ({
|
||||
Accordion: Object.assign(
|
||||
({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
||||
{
|
||||
Item: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
||||
Trigger: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
||||
Content: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
||||
},
|
||||
),
|
||||
}));
|
||||
|
||||
vi.mock('@tamagui/react-native-web-lite', () => ({
|
||||
Pressable: ({
|
||||
children,
|
||||
|
||||
Reference in New Issue
Block a user