Add photobooth uploader download email
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { RefreshCcw, PlugZap, RefreshCw, ShieldCheck, Copy, Power, Clock3 } from 'lucide-react';
|
||||
import { RefreshCcw, PlugZap, RefreshCw, ShieldCheck, Copy, Power, Clock3, Mail } from 'lucide-react';
|
||||
import { YStack, XStack } from '@tamagui/stacks';
|
||||
import { SizableText as Text } from '@tamagui/text';
|
||||
import { Switch } from '@tamagui/switch';
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
disableEventPhotobooth,
|
||||
rotateEventPhotobooth,
|
||||
createEventPhotoboothConnectCode,
|
||||
sendEventPhotoboothUploaderEmail,
|
||||
PhotoboothStatus,
|
||||
TenantEvent,
|
||||
} from '../api';
|
||||
@@ -41,6 +42,7 @@ export default function MobileEventPhotoboothPage() {
|
||||
const [connectCode, setConnectCode] = React.useState<string | null>(null);
|
||||
const [connectExpiresAt, setConnectExpiresAt] = React.useState<string | null>(null);
|
||||
const [connectLoading, setConnectLoading] = React.useState(false);
|
||||
const [sendingEmail, setSendingEmail] = React.useState(false);
|
||||
const [showCredentials, setShowCredentials] = React.useState(false);
|
||||
const back = useBackNavigation(slug ? adminPath(`/mobile/events/${slug}`) : adminPath('/mobile/events'));
|
||||
|
||||
@@ -138,6 +140,23 @@ export default function MobileEventPhotoboothPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleSendDownloadEmail = async () => {
|
||||
if (!slug) return;
|
||||
setSendingEmail(true);
|
||||
try {
|
||||
await sendEventPhotoboothUploaderEmail(slug);
|
||||
toast.success(t('photobooth.uploaderDownload.emailSuccess', 'Download-Links wurden per E-Mail gesendet.'));
|
||||
} catch (err) {
|
||||
if (!isAuthError(err)) {
|
||||
toast.error(
|
||||
getApiErrorMessage(err, t('photobooth.uploaderDownload.emailFailed', 'E-Mail konnte nicht gesendet werden.'))
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
setSendingEmail(false);
|
||||
}
|
||||
};
|
||||
|
||||
const spark = status?.sparkbooth ?? null;
|
||||
const metrics = spark?.metrics ?? null;
|
||||
const expiresAt = spark?.expires_at ?? status?.expires_at;
|
||||
@@ -261,6 +280,17 @@ export default function MobileEventPhotoboothPage() {
|
||||
'Die Fotospiel Uploader App ist verpflichtend, damit Uploads stabil laufen, die Zugangsdaten geschützt bleiben und keine Dateien verloren gehen.'
|
||||
)}
|
||||
</Text>
|
||||
<CTAButton
|
||||
label={
|
||||
sendingEmail
|
||||
? t('common.processing', '...')
|
||||
: t('photobooth.uploaderDownload.emailAction', 'Download-Links per E-Mail senden')
|
||||
}
|
||||
tone="ghost"
|
||||
onPress={handleSendDownloadEmail}
|
||||
iconLeft={<Mail size={14} color={text} />}
|
||||
disabled={sendingEmail}
|
||||
/>
|
||||
<CTAButton
|
||||
label={t('photobooth.uploaderDownload.actionWindows', 'Uploader herunterladen (Windows)')}
|
||||
onPress={() => {
|
||||
|
||||
Reference in New Issue
Block a user