prettier fix

This commit is contained in:
Danel Kungla
2025-09-19 17:22:36 +03:00
parent efa94b3322
commit 0c2cfe6d18
509 changed files with 17988 additions and 9920 deletions

View File

@@ -1,15 +1,21 @@
"use client"
'use client';
import React from 'react';
import { formatCurrency } from '@/packages/shared/src/utils';
import { StoreOrder } from '@medusajs/types';
import { useTranslation } from 'react-i18next';
import { formatCurrency } from "@/packages/shared/src/utils"
import { StoreOrder } from "@medusajs/types"
import React from "react"
import { useTranslation } from "react-i18next"
import { Trans } from '@kit/ui/trans';
export default function CartTotals({ medusaOrder }: {
medusaOrder: StoreOrder
export default function CartTotals({
medusaOrder,
}: {
medusaOrder: StoreOrder;
}) {
const { i18n: { language } } = useTranslation()
const {
i18n: { language },
} = useTranslation();
const {
currency_code,
total,
@@ -17,29 +23,39 @@ export default function CartTotals({ medusaOrder }: {
tax_total,
discount_total,
gift_card_total,
} = medusaOrder
} = medusaOrder;
return (
<div>
<div className="flex flex-col gap-y-2 txt-medium text-ui-fg-subtle ">
<div className="txt-medium text-ui-fg-subtle flex flex-col gap-y-2">
<div className="flex items-center justify-between">
<span className="flex gap-x-1 items-center">
<span className="flex items-center gap-x-1">
<Trans i18nKey="cart:order.subtotal" />
</span>
<span data-testid="cart-subtotal" data-value={subtotal || 0}>
{formatCurrency({ value: subtotal ?? 0, currencyCode: currency_code, locale: language })}
{formatCurrency({
value: subtotal ?? 0,
currencyCode: currency_code,
locale: language,
})}
</span>
</div>
{!!discount_total && (
<div className="flex items-center justify-between">
<span><Trans i18nKey="cart:order.promotionsTotal" /></span>
<span>
<Trans i18nKey="cart:order.promotionsTotal" />
</span>
<span
className="text-ui-fg-interactive"
data-testid="cart-discount"
data-value={discount_total || 0}
>
-{" "}
{formatCurrency({ value: discount_total ?? 0, currencyCode: currency_code, locale: language })}
-{' '}
{formatCurrency({
value: discount_total ?? 0,
currencyCode: currency_code,
locale: language,
})}
</span>
</div>
)}
@@ -53,30 +69,42 @@ export default function CartTotals({ medusaOrder }: {
</div> */}
{!!gift_card_total && (
<div className="flex items-center justify-between">
<span><Trans i18nKey="cart:order.giftCard" /></span>
<span>
<Trans i18nKey="cart:order.giftCard" />
</span>
<span
className="text-ui-fg-interactive"
data-testid="cart-gift-card-amount"
data-value={gift_card_total || 0}
>
-{" "}
{formatCurrency({ value: gift_card_total ?? 0, currencyCode: currency_code, locale: language })}
-{' '}
{formatCurrency({
value: gift_card_total ?? 0,
currencyCode: currency_code,
locale: language,
})}
</span>
</div>
)}
</div>
<div className="h-px w-full border-b border-gray-200 my-4" />
<div className="flex items-center justify-between text-ui-fg-base mb-2 txt-medium ">
<span className="font-bold"><Trans i18nKey="cart:order.total" /></span>
<div className="my-4 h-px w-full border-b border-gray-200" />
<div className="text-ui-fg-base txt-medium mb-2 flex items-center justify-between">
<span className="font-bold">
<Trans i18nKey="cart:order.total" />
</span>
<span
className="txt-xlarge-plus"
data-testid="cart-total"
data-value={total || 0}
>
{formatCurrency({ value: total ?? 0, currencyCode: currency_code, locale: language })}
{formatCurrency({
value: total ?? 0,
currencyCode: currency_code,
locale: language,
})}
</span>
</div>
<div className="h-px w-full border-b border-gray-200 mt-4" />
<div className="mt-4 h-px w-full border-b border-gray-200" />
</div>
)
);
}

View File

@@ -1,29 +1,25 @@
import { Trans } from '@kit/ui/trans';
import { formatDate } from 'date-fns';
import type { AnalysisOrder } from "~/lib/types/analysis-order";
export default function OrderDetails({ order }: {
order: AnalysisOrder
}) {
import { Trans } from '@kit/ui/trans';
import type { AnalysisOrder } from '~/lib/types/analysis-order';
export default function OrderDetails({ order }: { order: AnalysisOrder }) {
return (
<div className="flex flex-col gap-y-2">
<div>
<span className="font-bold">
<Trans i18nKey="cart:orderConfirmed.orderNumber" />:{" "}
</span>
<span>
{order.medusa_order_id}
<Trans i18nKey="cart:orderConfirmed.orderNumber" />:{' '}
</span>
<span>{order.medusa_order_id}</span>
</div>
<div>
<span className="font-bold">
<Trans i18nKey="cart:orderConfirmed.orderDate" />:{" "}
</span>
<span>
{formatDate(order.created_at, 'dd.MM.yyyy HH:mm')}
<Trans i18nKey="cart:orderConfirmed.orderDate" />:{' '}
</span>
<span>{formatDate(order.created_at, 'dd.MM.yyyy HH:mm')}</span>
</div>
</div>
)
);
}

View File

@@ -1,13 +1,16 @@
import { StoreCartLineItem, StoreOrderLineItem } from "@medusajs/types"
import { TableCell, TableRow } from "@kit/ui/table"
import { StoreCartLineItem, StoreOrderLineItem } from '@medusajs/types';
// import LineItemOptions from "@modules/common/components/line-item-options"
import LineItemPrice from "@modules/common/components/line-item-price"
import LineItemUnitPrice from "@modules/common/components/line-item-unit-price"
import LineItemPrice from '@modules/common/components/line-item-price';
import LineItemUnitPrice from '@modules/common/components/line-item-unit-price';
export default function OrderItem({ item, currencyCode }: {
item: StoreCartLineItem | StoreOrderLineItem
currencyCode: string
import { TableCell, TableRow } from '@kit/ui/table';
export default function OrderItem({
item,
currencyCode,
}: {
item: StoreCartLineItem | StoreOrderLineItem;
currencyCode: string;
}) {
const partnerLocationName = item.metadata?.partner_location_name;
return (
@@ -18,22 +21,21 @@ export default function OrderItem({ item, currencyCode }: {
</div>
</TableCell> */}
<TableCell className="text-left px-6">
<TableCell className="px-6 text-left">
<span
className="txt-medium-plus text-ui-fg-base"
data-testid="product-name"
>
{item.product_title}{` ${partnerLocationName ? `(${partnerLocationName})` : ''}`}
{item.product_title}
{` ${partnerLocationName ? `(${partnerLocationName})` : ''}`}
</span>
{/* <LineItemOptions variant={item.variant} data-testid="product-variant" /> */}
</TableCell>
<TableCell className="px-6">
<span className="flex flex-col items-end h-full justify-center">
<span className="flex gap-x-1 ">
<span className="text-ui-fg-muted">
{item.quantity}x{" "}
</span>
<span className="flex h-full flex-col items-end justify-center">
<span className="flex gap-x-1">
<span className="text-ui-fg-muted">{item.quantity}x </span>
<LineItemUnitPrice
item={item}
style="tight"
@@ -49,5 +51,5 @@ export default function OrderItem({ item, currencyCode }: {
</span>
</TableCell>
</TableRow>
)
);
}

View File

@@ -1,39 +1,44 @@
import repeat from "@lib/util/repeat"
import { StoreOrder } from "@medusajs/types"
import { Table, TableBody } from "@kit/ui/table"
import repeat from '@lib/util/repeat';
import { StoreOrder } from '@medusajs/types';
import SkeletonLineItem from '@modules/skeletons/components/skeleton-line-item';
import SkeletonLineItem from "@modules/skeletons/components/skeleton-line-item"
import OrderItem from "./order-item"
import { Heading } from "@kit/ui/heading"
import { Heading } from '@kit/ui/heading';
import { Table, TableBody } from '@kit/ui/table';
import { Trans } from '@kit/ui/trans';
export default function OrderItems({ medusaOrder }: {
medusaOrder: StoreOrder
import OrderItem from './order-item';
export default function OrderItems({
medusaOrder,
}: {
medusaOrder: StoreOrder;
}) {
const items = medusaOrder.items
const items = medusaOrder.items;
return (
<div className="flex flex-col gap-y-4">
<Heading level={5} className="flex flex-row text-3xl-regular">
<Heading level={5} className="text-3xl-regular flex flex-row">
<Trans i18nKey="cart:orderConfirmed.summary" />
</Heading>
<div className="flex flex-col">
<Table className="rounded-lg border border-separate">
<Table className="border-separate rounded-lg border">
<TableBody data-testid="products-table">
{items?.length
? items
.sort((a, b) => (a.created_at ?? "") > (b.created_at ?? "") ? -1 : 1)
.map((item) => (
<OrderItem
key={item.id}
item={item}
currencyCode={medusaOrder.currency_code}
/>
))
.sort((a, b) =>
(a.created_at ?? '') > (b.created_at ?? '') ? -1 : 1,
)
.map((item) => (
<OrderItem
key={item.id}
item={item}
currencyCode={medusaOrder.currency_code}
/>
))
: repeat(5).map((i) => <SkeletonLineItem key={i} />)}
</TableBody>
</Table>
</div>
</div>
)
);
}