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