Refactor code structure and remove redundant sections for improved readability and maintainability

This commit is contained in:
Danel Kungla
2025-08-11 17:51:12 +03:00
parent 9298abe354
commit 99ba14bab2
10 changed files with 7838 additions and 2810 deletions

View File

@@ -42,7 +42,7 @@ const Level = ({
export const AnalysisLevelBarSkeleton = () => {
return (
<div className="mt-4 flex h-3 max-w-[360px] w-[35%] gap-1 sm:mt-0">
<div className="mt-4 flex h-3 w-[35%] max-w-[360px] gap-1 sm:mt-0">
<Level color="gray-200" />
</div>
);
@@ -58,7 +58,7 @@ const AnalysisLevelBar = ({
level: AnalysisResultLevel;
}) => {
return (
<div className="mt-4 flex h-3 max-w-[360px] w-[35%] gap-1 sm:mt-0">
<div className="mt-4 flex h-3 w-[35%] max-w-[360px] gap-1 sm:mt-0">
{normLowerIncluded && (
<>
<Level

View File

@@ -1,16 +1,20 @@
'use client';
import React, { useState } from 'react';
import { format } from 'date-fns';
import { UserAnalysisElement } from '@/packages/features/accounts/src/types/accounts';
import { format } from 'date-fns';
import { Info } from 'lucide-react';
import { Trans } from '@kit/ui/trans';
import { cn } from '@kit/ui/utils';
import AnalysisLevelBar, { AnalysisLevelBarSkeleton, AnalysisResultLevel } from './analysis-level-bar';
import { UserAnalysisElement } from '@/packages/features/accounts/src/types/accounts';
import { AnalysisElement } from '~/lib/services/analysis-element.service';
import { Trans } from '@kit/ui/trans';
import AnalysisLevelBar, {
AnalysisLevelBarSkeleton,
AnalysisResultLevel,
} from './analysis-level-bar';
export enum AnalysisStatus {
NORMAL = 0,
@@ -59,7 +63,7 @@ const Analysis = ({
};
return (
<div className="border-border items-center justify-between rounded-lg border px-5 py-3 sm:h-[65px] flex flex-col sm:flex-row px-12 gap-2 sm:gap-0">
<div className="border-border flex flex-col items-center justify-between gap-2 rounded-lg border px-5 px-12 py-3 sm:h-[65px] sm:flex-row sm:gap-0">
<div className="flex items-center gap-2 font-semibold">
{name}
{results?.response_time && (
@@ -75,7 +79,9 @@ const Analysis = ({
{ block: showTooltip },
)}
>
<Trans i18nKey="analysis-results:analysisDate" />{': '}{format(new Date(results.response_time), 'dd.MM.yyyy HH:mm')}
<Trans i18nKey="analysis-results:analysisDate" />
{': '}
{format(new Date(results.response_time), 'dd.MM.yyyy HH:mm')}
</div>
</div>
)}
@@ -86,7 +92,7 @@ const Analysis = ({
<div className="font-semibold">{value}</div>
<div className="text-muted-foreground text-sm">{unit}</div>
</div>
<div className="text-muted-foreground flex flex-col-reverse gap-2 text-center text-sm sm:block sm:gap-0 mx-8">
<div className="text-muted-foreground mx-8 flex flex-col-reverse gap-2 text-center text-sm sm:block sm:gap-0">
{normLower} - {normUpper}
<div>
<Trans i18nKey="analysis-results:results.range.normal" />
@@ -105,7 +111,7 @@ const Analysis = ({
<Trans i18nKey="analysis-results:waitingForResults" />
</div>
</div>
<div className="w-[60px] mx-8"></div>
<div className="mx-8 w-[60px]"></div>
<AnalysisLevelBarSkeleton />
</>
)}

View File

@@ -223,6 +223,7 @@ export default function Dashboard({ account }: { account: AccountWithParams }) {
) => {
return (
<div className="flex justify-between" key={index}>
<div className="mr-4 flex flex-row items-center gap-4">
<div className="mr-4 flex flex-row items-center gap-4">
<div
className={cn(