rearranged tenant admin layout, invite layouts now visible and manageable
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { authorizedFetch } from './auth/tokens';
|
||||
import i18n from './i18n';
|
||||
|
||||
type JsonValue = Record<string, any>;
|
||||
type JsonValue = Record<string, unknown>;
|
||||
|
||||
export type EventQrInviteLayout = {
|
||||
id: string;
|
||||
@@ -40,7 +40,11 @@ export type TenantEvent = {
|
||||
is_active?: boolean;
|
||||
description?: string | null;
|
||||
photo_count?: number;
|
||||
pending_photo_count?: number;
|
||||
like_count?: number;
|
||||
tasks_count?: number;
|
||||
active_invites_count?: number;
|
||||
total_invites_count?: number;
|
||||
engagement_mode?: 'tasks' | 'photo_only';
|
||||
settings?: Record<string, unknown> & { engagement_mode?: 'tasks' | 'photo_only' };
|
||||
package?: {
|
||||
@@ -442,7 +446,26 @@ function normalizeEvent(event: JsonValue): TenantEvent {
|
||||
is_active: typeof event.is_active === 'boolean' ? event.is_active : undefined,
|
||||
description: event.description ?? null,
|
||||
photo_count: event.photo_count !== undefined ? Number(event.photo_count ?? 0) : undefined,
|
||||
like_count: event.like_count !== undefined ? Number(event.like_count ?? 0) : undefined,
|
||||
pending_photo_count: event.pending_photo_count !== undefined ? Number(event.pending_photo_count ?? 0) : undefined,
|
||||
like_count:
|
||||
event.like_count !== undefined
|
||||
? Number(event.like_count ?? 0)
|
||||
: event.likes_sum !== undefined
|
||||
? Number(event.likes_sum ?? 0)
|
||||
: undefined,
|
||||
tasks_count: event.tasks_count !== undefined ? Number(event.tasks_count ?? 0) : undefined,
|
||||
active_invites_count:
|
||||
event.active_invites_count !== undefined
|
||||
? Number(event.active_invites_count ?? 0)
|
||||
: event.active_join_tokens_count !== undefined
|
||||
? Number(event.active_join_tokens_count ?? 0)
|
||||
: undefined,
|
||||
total_invites_count:
|
||||
event.total_invites_count !== undefined
|
||||
? Number(event.total_invites_count ?? 0)
|
||||
: event.total_join_tokens_count !== undefined
|
||||
? Number(event.total_join_tokens_count ?? 0)
|
||||
: undefined,
|
||||
engagement_mode: engagementMode,
|
||||
settings,
|
||||
package: event.package ?? null,
|
||||
@@ -638,9 +661,9 @@ function normalizeMember(member: JsonValue): EventMember {
|
||||
}
|
||||
|
||||
function normalizeQrInvite(raw: JsonValue): EventQrInvite {
|
||||
const rawLayouts = Array.isArray(raw.layouts) ? raw.layouts : [];
|
||||
const rawLayouts = Array.isArray(raw.layouts) ? (raw.layouts as JsonValue[]) : [];
|
||||
const layouts: EventQrInviteLayout[] = rawLayouts
|
||||
.map((layout: any) => {
|
||||
.map((layout: JsonValue) => {
|
||||
const formats = Array.isArray(layout.formats)
|
||||
? layout.formats.map((format: unknown) => String(format ?? '')).filter((format: string) => format.length > 0)
|
||||
: [];
|
||||
|
||||
Reference in New Issue
Block a user