WIP: add lifestyle block
This commit is contained in:
32
app/home/(user)/_components/ai/recommendations.tsx
Normal file
32
app/home/(user)/_components/ai/recommendations.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
'use server';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { AccountWithParams } from '@/packages/features/accounts/src/types/accounts';
|
||||
|
||||
import { loadAnalyses } from '../../_lib/server/load-analyses';
|
||||
import { loadRecommendations } from '../../_lib/server/load-recommendations';
|
||||
import OrderAnalysesCards from '../order-analyses-cards';
|
||||
|
||||
export default async function Recommendations({
|
||||
account,
|
||||
}: {
|
||||
account: AccountWithParams;
|
||||
}) {
|
||||
const { analyses, countryCode } = await loadAnalyses();
|
||||
|
||||
const analysisRecommendations = await loadRecommendations(analyses, account);
|
||||
const orderAnalyses = analyses.filter((analysis) =>
|
||||
analysisRecommendations.includes(analysis.title),
|
||||
);
|
||||
|
||||
if (orderAnalyses.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<OrderAnalysesCards analyses={orderAnalyses} countryCode={countryCode} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user