mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 10:21:15 +01:00
Switch to BiomeJS (#306)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { convertFileSrc } from '@tauri-apps/api/core';
|
||||
import React from 'react';
|
||||
|
||||
interface Props {
|
||||
bodyPath: string;
|
||||
@@ -8,6 +7,6 @@ interface Props {
|
||||
export function AudioViewer({ bodyPath }: Props) {
|
||||
const src = convertFileSrc(bodyPath);
|
||||
|
||||
// eslint-disable-next-line jsx-a11y/media-has-caption
|
||||
return <audio className="w-full" controls src={src}></audio>;
|
||||
// biome-ignore lint/a11y/useMediaCaption: none
|
||||
return <audio className="w-full" controls src={src} />;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import classNames from 'classnames';
|
||||
import Papa from 'papaparse';
|
||||
import { useMemo } from 'react';
|
||||
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
|
||||
interface Props {
|
||||
response: HttpResponse;
|
||||
@@ -24,8 +24,10 @@ export function CsvViewer({ response, className }: Props) {
|
||||
<table className={classNames(className, 'text-sm')}>
|
||||
<tbody>
|
||||
{parsed.data.map((row, i) => (
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: none
|
||||
<tr key={i} className={classNames('border-l border-t', i > 0 && 'border-b')}>
|
||||
{row.map((col, j) => (
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: none
|
||||
<td key={j} className="border-r px-1.5">
|
||||
{col}
|
||||
</td>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import type { ServerSentEvent } from '@yaakapp-internal/sse';
|
||||
import classNames from 'classnames';
|
||||
import React, { Fragment, useMemo, useState } from 'react';
|
||||
import { Fragment, useMemo, useState } from 'react';
|
||||
import { useFormatText } from '../../hooks/useFormatText';
|
||||
import { useResponseBodyEventSource } from '../../hooks/useResponseBodyEventSource';
|
||||
import { isJSON } from '../../lib/contentType';
|
||||
@@ -144,6 +144,7 @@ function EventRow({
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
className={classNames(
|
||||
className,
|
||||
|
||||
@@ -23,18 +23,18 @@ export function HTMLOrTextViewer({ response, pretty, textViewerClassName }: Prop
|
||||
|
||||
if (language === 'html' && pretty) {
|
||||
return <WebPageViewer response={response} />;
|
||||
} else if (rawTextBody.data == null) {
|
||||
return <EmptyStateText>Empty response</EmptyStateText>;
|
||||
} else {
|
||||
return (
|
||||
<TextViewer
|
||||
language={language}
|
||||
text={rawTextBody.data}
|
||||
pretty={pretty}
|
||||
className={textViewerClassName}
|
||||
response={response}
|
||||
requestId={response.requestId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (rawTextBody.data == null) {
|
||||
return <EmptyStateText>Empty response</EmptyStateText>;
|
||||
}
|
||||
return (
|
||||
<TextViewer
|
||||
language={language}
|
||||
text={rawTextBody.data}
|
||||
pretty={pretty}
|
||||
className={textViewerClassName}
|
||||
response={response}
|
||||
requestId={response.requestId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { convertFileSrc } from '@tauri-apps/api/core';
|
||||
import React from 'react';
|
||||
|
||||
interface Props {
|
||||
bodyPath: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import classNames from 'classnames';
|
||||
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import { JsonAttributeTree } from '../core/JsonAttributeTree';
|
||||
|
||||
interface Props {
|
||||
@@ -16,8 +16,7 @@ export function JsonViewer({ response, className }: Props) {
|
||||
let parsed = {};
|
||||
try {
|
||||
parsed = JSON.parse(rawBody.data);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// Nothing yet
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'react-pdf/dist/Page/AnnotationLayer.css';
|
||||
import { convertFileSrc } from '@tauri-apps/api/core';
|
||||
import './PdfViewer.css';
|
||||
import type { PDFDocumentProxy } from 'pdfjs-dist';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { useRef, useState } from 'react';
|
||||
import { Document, Page } from 'react-pdf';
|
||||
import { useContainerSize } from '../../hooks/useContainerQuery';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -7,8 +7,8 @@ import { useDebouncedValue } from '../../hooks/useDebouncedValue';
|
||||
import { useFormatText } from '../../hooks/useFormatText';
|
||||
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
|
||||
import type { EditorProps } from '../core/Editor/Editor';
|
||||
import { Editor } from '../core/Editor/LazyEditor';
|
||||
import { hyperlink } from '../core/Editor/hyperlink/extension';
|
||||
import { Editor } from '../core/Editor/LazyEditor';
|
||||
import { IconButton } from '../core/IconButton';
|
||||
import { Input } from '../core/Input';
|
||||
|
||||
@@ -107,7 +107,7 @@ export function TextViewer({ language, text, response, requestId, pretty, classN
|
||||
return null;
|
||||
}
|
||||
|
||||
let body;
|
||||
let body: string;
|
||||
if (isSearching && filterText?.length > 0) {
|
||||
if (filteredResponse.error) {
|
||||
body = '';
|
||||
@@ -133,7 +133,7 @@ export function TextViewer({ language, text, response, requestId, pretty, classN
|
||||
actions={actions}
|
||||
extraExtensions={extraExtensions}
|
||||
// State key for storing fold state
|
||||
stateKey={'response.body.' + response.id}
|
||||
stateKey={`response.body.${response.id}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ export function TextViewer({ language, text, response, requestId, pretty, classN
|
||||
/** Convert \uXXXX to actual Unicode characters */
|
||||
function decodeUnicodeLiterals(text: string): string {
|
||||
return text.replace(/\\u([0-9a-fA-F]{4})/g, (_, hex) => {
|
||||
const charCode = parseInt(hex, 16);
|
||||
const charCode = Number.parseInt(hex, 16);
|
||||
return String.fromCharCode(charCode);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { convertFileSrc } from '@tauri-apps/api/core';
|
||||
import React from 'react';
|
||||
|
||||
interface Props {
|
||||
bodyPath: string;
|
||||
@@ -8,6 +7,6 @@ interface Props {
|
||||
export function VideoViewer({ bodyPath }: Props) {
|
||||
const src = convertFileSrc(bodyPath);
|
||||
|
||||
// eslint-disable-next-line jsx-a11y/media-has-caption
|
||||
return <video className="w-full" controls src={src}></video>;
|
||||
// biome-ignore lint/a11y/useMediaCaption: none
|
||||
return <video className="w-full" controls src={src} />;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import { useMemo } from 'react';
|
||||
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
|
||||
interface Props {
|
||||
response: HttpResponse;
|
||||
|
||||
Reference in New Issue
Block a user