mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-20 15:51:23 +02:00
Fix multipart tab value
This commit is contained in:
@@ -56,10 +56,10 @@ export function MultipartViewer({ data, boundary, idPrefix = 'multipart' }: Prop
|
|||||||
addBorders
|
addBorders
|
||||||
label="Multipart"
|
label="Multipart"
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
tabListClassName="border-r border-r-border"
|
tabListClassName="border-r border-r-border -ml-3"
|
||||||
tabs={parts.map((part) => ({
|
tabs={parts.map((part, i) => ({
|
||||||
label: part.name ?? '',
|
label: part.name ?? '',
|
||||||
value: part.name ?? '',
|
value: tabValue(part, i),
|
||||||
rightSlot:
|
rightSlot:
|
||||||
part.filename && part.headers.contentType.mediaType?.startsWith('image/') ? (
|
part.filename && part.headers.contentType.mediaType?.startsWith('image/') ? (
|
||||||
<div className="h-5 w-5 overflow-auto flex items-center justify-end">
|
<div className="h-5 w-5 overflow-auto flex items-center justify-end">
|
||||||
@@ -77,7 +77,7 @@ export function MultipartViewer({ data, boundary, idPrefix = 'multipart' }: Prop
|
|||||||
<TabContent
|
<TabContent
|
||||||
// biome-ignore lint/suspicious/noArrayIndexKey: Nothing else to key on
|
// biome-ignore lint/suspicious/noArrayIndexKey: Nothing else to key on
|
||||||
key={idPrefix + part.name + i}
|
key={idPrefix + part.name + i}
|
||||||
value={part.name ?? ''}
|
value={tabValue(part, i)}
|
||||||
className="pl-3 !pt-0"
|
className="pl-3 !pt-0"
|
||||||
>
|
>
|
||||||
<Part part={part} />
|
<Part part={part} />
|
||||||
@@ -115,7 +115,7 @@ function Part({ part }: { part: MultipartPart }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mimeType?.match(/csv|tab-separated/i)) {
|
if (mimeType?.match(/csv|tab-separated/i)) {
|
||||||
return <CsvViewer text={content} />;
|
return <CsvViewer text={content} className="bg-primary h-10 w-10" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mimeType?.match(/^text\/html/i) || detectedLanguage === 'html') {
|
if (mimeType?.match(/^text\/html/i) || detectedLanguage === 'html') {
|
||||||
@@ -132,3 +132,7 @@ function Part({ part }: { part: MultipartPart }) {
|
|||||||
|
|
||||||
return <TextViewer text={content} language={detectedLanguage} stateKey={null} />;
|
return <TextViewer text={content} language={detectedLanguage} stateKey={null} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tabValue(part: MultipartPart, i: number) {
|
||||||
|
return `${part.name ?? ''}::${i}`;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user