add doctor feedback
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Circle } from 'lucide-react';
|
||||
import { createUserAnalysesApi } from '@/packages/features/user-analyses/src/server/api';
|
||||
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
|
||||
|
||||
import { cn } from '@kit/ui/lib/utils';
|
||||
import { PageBody } from '@kit/ui/makerkit/page';
|
||||
import { Trans } from '@kit/ui/makerkit/trans';
|
||||
import { Skeleton } from '@kit/ui/shadcn/skeleton';
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
PageViewAction,
|
||||
createPageViewLog,
|
||||
} from '~/lib/services/audit/pageView.service';
|
||||
import { getLatestResponseTime } from '~/lib/utils';
|
||||
|
||||
import { HomeLayoutPageHeader } from '../../_components/home-page-header';
|
||||
import { loadLifeStyle } from '../../_lib/server/load-life-style';
|
||||
@@ -31,14 +32,22 @@ async function LifeStylePage() {
|
||||
if (!account) {
|
||||
return null;
|
||||
}
|
||||
const data = await loadLifeStyle(account);
|
||||
const client = getSupabaseServerClient();
|
||||
const userAnalysesApi = createUserAnalysesApi(client);
|
||||
const analysisResponses = await userAnalysesApi.getAllUserAnalysisResponses();
|
||||
const currentAIResponseTimestamp = getLatestResponseTime(analysisResponses);
|
||||
const { response } = await loadLifeStyle({
|
||||
account,
|
||||
analysisResponses,
|
||||
aiResponseTimestamp: currentAIResponseTimestamp,
|
||||
});
|
||||
|
||||
await createPageViewLog({
|
||||
accountId: account.id,
|
||||
action: PageViewAction.VIEW_LIFE_STYLE,
|
||||
});
|
||||
|
||||
if (!data.lifestyle) {
|
||||
if (!response.lifestyle) {
|
||||
return <Skeleton className="mt-10 h-10 w-full" />;
|
||||
}
|
||||
|
||||
@@ -51,16 +60,10 @@ async function LifeStylePage() {
|
||||
|
||||
<PageBody>
|
||||
<div className="mt-8">
|
||||
{data.lifestyle.map(({ title, description, score }, index) => (
|
||||
{response.lifestyle.map(({ title, description }, index) => (
|
||||
<React.Fragment key={`${index}-${title}`}>
|
||||
<div className="flex items-center gap-2">
|
||||
<h3>{title}</h3>
|
||||
<Circle
|
||||
className={cn('text-success fill-success size-6', {
|
||||
'text-warning fill-warning': score === 1,
|
||||
'text-destructive fill-destructive': score === 2,
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
<p className="font-regular py-4">{description}</p>
|
||||
</React.Fragment>
|
||||
|
||||
Reference in New Issue
Block a user