add doctor feedback
This commit is contained in:
@@ -41,7 +41,10 @@ const AIBlocks = async ({
|
||||
return (
|
||||
<Suspense fallback={<RecommendationsSkeleton />}>
|
||||
<LifeStyleCard account={account} analysisResponses={analysisResponses} />
|
||||
<Recommendations account={account} />
|
||||
<Recommendations
|
||||
account={account}
|
||||
analysisResponses={analysisResponses}
|
||||
/>
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -12,6 +12,8 @@ import { Trans } from '@kit/ui/makerkit/trans';
|
||||
import { Button } from '@kit/ui/shadcn/button';
|
||||
import { Card, CardHeader } from '@kit/ui/shadcn/card';
|
||||
|
||||
import { getLatestResponseTime } from '~/lib/utils';
|
||||
|
||||
import { loadLifeStyle } from '../../_lib/server/load-life-style';
|
||||
import { AnalysisResponses } from './types';
|
||||
|
||||
@@ -22,21 +24,31 @@ const LifeStyleCard = async ({
|
||||
account: AccountWithParams;
|
||||
analysisResponses?: AnalysisResponses;
|
||||
}) => {
|
||||
const data = await loadLifeStyle(account, analysisResponses);
|
||||
const aiResponseTimestamp = getLatestResponseTime(analysisResponses);
|
||||
const { response, dateCreated } = await loadLifeStyle({
|
||||
account,
|
||||
analysisResponses,
|
||||
aiResponseTimestamp,
|
||||
});
|
||||
|
||||
return (
|
||||
<Card variant="gradient-success" className="flex flex-col justify-between">
|
||||
<CardHeader className="flex-row justify-between">
|
||||
<h5>
|
||||
<Trans i18nKey="dashboard:heroCard.lifeStyle.title" />
|
||||
</h5>
|
||||
<div>
|
||||
<span className="text-xs">
|
||||
{new Date(dateCreated).toLocaleString()}
|
||||
</span>
|
||||
<h5 className="flex flex-col">
|
||||
<Trans i18nKey="dashboard:heroCard.lifeStyle.title" />
|
||||
</h5>
|
||||
</div>
|
||||
<Link href={pathsConfig.app.lifeStyle}>
|
||||
<Button size="icon" variant="outline" className="px-2 text-black">
|
||||
<ChevronRight className="size-4 stroke-2" />
|
||||
</Button>
|
||||
</Link>
|
||||
</CardHeader>
|
||||
<span className="text-primary p-4 text-sm">{data.summary}</span>
|
||||
<span className="text-primary p-4 text-sm">{response.summary}</span>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,18 +4,29 @@ import React from 'react';
|
||||
|
||||
import { AccountWithParams } from '@/packages/features/accounts/src/types/accounts';
|
||||
|
||||
import { getLatestResponseTime } from '~/lib/utils';
|
||||
|
||||
import { loadAnalyses } from '../../_lib/server/load-analyses';
|
||||
import { loadRecommendations } from '../../_lib/server/load-recommendations';
|
||||
import OrderAnalysesCards from '../order-analyses-cards';
|
||||
import { AnalysisResponses } from './types';
|
||||
|
||||
export default async function Recommendations({
|
||||
account,
|
||||
analysisResponses,
|
||||
}: {
|
||||
account: AccountWithParams;
|
||||
analysisResponses?: AnalysisResponses;
|
||||
}) {
|
||||
const { analyses, countryCode } = await loadAnalyses();
|
||||
|
||||
const analysisRecommendations = await loadRecommendations(account);
|
||||
const currentAIResponseTimestamp = getLatestResponseTime(analysisResponses);
|
||||
const analysisRecommendations = await loadRecommendations({
|
||||
account,
|
||||
analyses,
|
||||
analysisResponses,
|
||||
aiResponseTimestamp: currentAIResponseTimestamp,
|
||||
});
|
||||
const orderAnalyses = analyses.filter((analysis) =>
|
||||
analysisRecommendations.includes(analysis.title),
|
||||
);
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface ILifeStyleResponse {
|
||||
export enum PROMPT_NAME {
|
||||
LIFE_STYLE = 'Life Style',
|
||||
ANALYSIS_RECOMMENDATIONS = 'Analysis Recommendations',
|
||||
FEEDBACK = 'Doctor Feedback',
|
||||
}
|
||||
|
||||
export type AnalysisResponses =
|
||||
|
||||
Reference in New Issue
Block a user