feat: image
This commit is contained in:
@@ -3,7 +3,7 @@ import {FC} from "react";
|
|||||||
import useProductsList from "../../pages/ProductsPage/hooks/useProductsList.tsx";
|
import useProductsList from "../../pages/ProductsPage/hooks/useProductsList.tsx";
|
||||||
import {omit} from "lodash";
|
import {omit} from "lodash";
|
||||||
import ObjectSelect, {ObjectSelectProps} from "../ObjectSelect/ObjectSelect.tsx";
|
import ObjectSelect, {ObjectSelectProps} from "../ObjectSelect/ObjectSelect.tsx";
|
||||||
import {ComboboxItem, OptionsFilter, SelectProps, Text, Tooltip} from "@mantine/core";
|
import {ComboboxItem, OptionsFilter, SelectProps, Text, Tooltip, Image, rem} from "@mantine/core";
|
||||||
import {getProductFields} from "../../types/utils.ts";
|
import {getProductFields} from "../../types/utils.ts";
|
||||||
|
|
||||||
type RestProps = {
|
type RestProps = {
|
||||||
@@ -20,14 +20,28 @@ const ProductSelect: FC<Props> = (props: Props) => {
|
|||||||
const product = products.find(product => product.id == parseInt(item.option.value));
|
const product = products.find(product => product.id == parseInt(item.option.value));
|
||||||
if (!product) return item.option.label;
|
if (!product) return item.option.label;
|
||||||
const productFields = getProductFields(product);
|
const productFields = getProductFields(product);
|
||||||
|
const imageUrl = product.images && product.images[0] ? product.images[0].imageUrl : undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
style={{whiteSpace: "pre-line"}}
|
style={{whiteSpace: "pre-line"}}
|
||||||
multiline
|
multiline
|
||||||
disabled={productFields.length === 0}
|
disabled={productFields.length === 0}
|
||||||
label={productFields.map(([key, value]) => {
|
label={
|
||||||
|
<>
|
||||||
|
{productFields.map(([key, value]) => {
|
||||||
return `${key.toString()}: ${value.toString()}`;
|
return `${key.toString()}: ${value.toString()}`;
|
||||||
}).join('\n')}>
|
}).join('\n')}
|
||||||
|
{imageUrl && <Image
|
||||||
|
src={imageUrl}
|
||||||
|
alt={product.name}
|
||||||
|
maw={rem(250)}
|
||||||
|
/>}
|
||||||
|
|
||||||
|
</>
|
||||||
|
|
||||||
|
|
||||||
|
}>
|
||||||
<div>
|
<div>
|
||||||
{product.name}<br/>
|
{product.name}<br/>
|
||||||
{product.barcodes && <Text size={"xs"}>{product.barcodes[0]}</Text>}
|
{product.barcodes && <Text size={"xs"}>{product.barcodes[0]}</Text>}
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ const MarketplaceAuthDataInput: FC<Props> = (props: Props) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
const getOzonInputs = () => {
|
const getOzonInputs = () => {
|
||||||
// return input that sets record "Client-Id" and "Api-Key" to value
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
Reference in New Issue
Block a user