achievements didn't load correctly
This commit is contained in:
@@ -675,7 +675,7 @@ class EventPublicController extends BaseController
|
|||||||
return max(1, (int) $seed);
|
return max(1, (int) $seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildAchievementsPayload(int $eventId, ?string $guestIdentifier, array $fallbacks): array
|
private function buildAchievementsPayload(int $eventId, string $token, ?string $guestIdentifier, array $fallbacks): array
|
||||||
{
|
{
|
||||||
$totalPhotos = (int) DB::table('photos')->where('event_id', $eventId)->count();
|
$totalPhotos = (int) DB::table('photos')->where('event_id', $eventId)->count();
|
||||||
$uniqueGuests = (int) DB::table('photos')->where('event_id', $eventId)->distinct('guest_name')->count('guest_name');
|
$uniqueGuests = (int) DB::table('photos')->where('event_id', $eventId)->distinct('guest_name')->count('guest_name');
|
||||||
@@ -3004,8 +3004,8 @@ class EventPublicController extends BaseController
|
|||||||
$guestIdentifier ? sha1($guestIdentifier) : 'public'
|
$guestIdentifier ? sha1($guestIdentifier) : 'public'
|
||||||
);
|
);
|
||||||
|
|
||||||
$cached = Cache::remember($cacheKey, now()->addSeconds(60), function () use ($eventId, $guestIdentifier, $fallbacks) {
|
$cached = Cache::remember($cacheKey, now()->addSeconds(60), function () use ($eventId, $identifier, $guestIdentifier, $fallbacks) {
|
||||||
$payload = $this->buildAchievementsPayload($eventId, $guestIdentifier, $fallbacks);
|
$payload = $this->buildAchievementsPayload($eventId, $identifier, $guestIdentifier, $fallbacks);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'payload' => $payload,
|
'payload' => $payload,
|
||||||
|
|||||||
@@ -151,15 +151,6 @@ export default function Header({ eventToken, title = '' }: { eventToken?: string
|
|||||||
const [statusFilter, setStatusFilter] = React.useState<'new' | 'read' | 'dismissed' | 'all'>('new');
|
const [statusFilter, setStatusFilter] = React.useState<'new' | 'read' | 'dismissed' | 'all'>('new');
|
||||||
const taskProgress = useGuestTaskProgress(eventToken);
|
const taskProgress = useGuestTaskProgress(eventToken);
|
||||||
const panelRef = React.useRef<HTMLDivElement | null>(null);
|
const panelRef = React.useRef<HTMLDivElement | null>(null);
|
||||||
const checklistItems = React.useMemo(
|
|
||||||
() => [
|
|
||||||
t('home.checklist.steps.first'),
|
|
||||||
t('home.checklist.steps.second'),
|
|
||||||
t('home.checklist.steps.third'),
|
|
||||||
],
|
|
||||||
[t],
|
|
||||||
);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!notificationsOpen) {
|
if (!notificationsOpen) {
|
||||||
return;
|
return;
|
||||||
@@ -253,7 +244,6 @@ export default function Header({ eventToken, title = '' }: { eventToken?: string
|
|||||||
open={notificationsOpen}
|
open={notificationsOpen}
|
||||||
onToggle={() => setNotificationsOpen((prev) => !prev)}
|
onToggle={() => setNotificationsOpen((prev) => !prev)}
|
||||||
panelRef={panelRef}
|
panelRef={panelRef}
|
||||||
checklistItems={checklistItems}
|
|
||||||
taskProgress={taskProgress?.hydrated ? taskProgress : undefined}
|
taskProgress={taskProgress?.hydrated ? taskProgress : undefined}
|
||||||
t={t}
|
t={t}
|
||||||
/>
|
/>
|
||||||
@@ -271,14 +261,13 @@ type NotificationButtonProps = {
|
|||||||
open: boolean;
|
open: boolean;
|
||||||
onToggle: () => void;
|
onToggle: () => void;
|
||||||
panelRef: React.RefObject<HTMLDivElement | null>;
|
panelRef: React.RefObject<HTMLDivElement | null>;
|
||||||
checklistItems: string[];
|
|
||||||
taskProgress?: ReturnType<typeof useGuestTaskProgress>;
|
taskProgress?: ReturnType<typeof useGuestTaskProgress>;
|
||||||
t: TranslateFn;
|
t: TranslateFn;
|
||||||
};
|
};
|
||||||
|
|
||||||
type PushState = ReturnType<typeof usePushSubscription>;
|
type PushState = ReturnType<typeof usePushSubscription>;
|
||||||
|
|
||||||
function NotificationButton({ center, eventToken, open, onToggle, panelRef, checklistItems, taskProgress, t }: NotificationButtonProps) {
|
function NotificationButton({ center, eventToken, open, onToggle, panelRef, taskProgress, t }: NotificationButtonProps) {
|
||||||
const badgeCount = center.unreadCount;
|
const badgeCount = center.unreadCount;
|
||||||
const progressRatio = taskProgress
|
const progressRatio = taskProgress
|
||||||
? Math.min(1, taskProgress.completedCount / TASK_BADGE_TARGET)
|
? Math.min(1, taskProgress.completedCount / TASK_BADGE_TARGET)
|
||||||
@@ -493,16 +482,6 @@ function NotificationButton({ center, eventToken, open, onToggle, panelRef, chec
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="my-3 h-px w-full bg-slate-100" />
|
|
||||||
<p className="text-[11px] uppercase tracking-[0.3em] text-slate-400">{t('header.notifications.checklistTitle', 'So funktioniert’s')}</p>
|
|
||||||
<ul className="mt-2 space-y-2 text-sm text-slate-600">
|
|
||||||
{checklistItems.map((item) => (
|
|
||||||
<li key={item} className="flex gap-2">
|
|
||||||
<span className="mt-0.5 h-1.5 w-1.5 rounded-full bg-pink-500" />
|
|
||||||
<span>{item}</span>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</div>,
|
</div>,
|
||||||
typeof document !== 'undefined' ? document.body : undefined
|
typeof document !== 'undefined' ? document.body : undefined
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user