Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions app/components-react/pages/AILanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ export default function AILanding() {
UsageStatisticsService,
VisionService,
} = Services;
function trackEvent(type: string, data?: Record<string, any>) {
UsageStatisticsService.actions.recordAnalyticsEvent('AiFeature', {
type,
source: 'AiLanding',
...(data ?? {}),
});
}

const visionActions = VisionService.actions;
const visionState = useRealmObject(VisionService.state);

Expand All @@ -76,17 +84,20 @@ export default function AILanding() {
useEffect(() => {
let active = true;
let processing = false;

void loadProductionApps();
trackEvent('impression');

return () => {
active = false;
};

async function loadProductionApps() {
if (getOS() !== OS.Windows) return;
if (processing) return;

processing = true;
setIsAgentAppInstalled(false);

if (getOS() !== OS.Windows) return;
await PlatformAppsService.actions.return.loadProductionApps();

// Bail early if the component unmounted while we were loading.
Expand All @@ -98,14 +109,6 @@ export default function AILanding() {
}
}, []);

function trackEvent(type: string, data?: Record<string, any>) {
UsageStatisticsService.actions.recordAnalyticsEvent('AiFeature', {
type,
source: 'AiLanding',
...(data ?? {}),
});
}

function onToggleAiClick(isEnabled?: boolean) {
const newIsEnabled = isEnabled ?? !enabled;
trackEvent('enabled', { enabled: String(newIsEnabled) });
Expand Down
7 changes: 6 additions & 1 deletion app/components-react/pages/onboarding/ThemeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export function ThemeSelector() {

function previewImages(theme: IThemeMetadata) {
if (!theme?.data) return [];
return Object.values(theme.data.custom_images).slice(0, 3);
const customImages = Object.values(theme.data.custom_images).slice(0, 3);
if (customImages.length > 0) {
return customImages;
} else {
return theme.data.preview_images;
}
}

function focusTheme(theme: IThemeMetadata | null) {
Expand Down
Loading