Fix bugs (#250)
* lint * fix some lint error * fix window hide error when size zero * toast error when lookup failed * resolve #239
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { LoaderSpin, MeaningCard } from "@renderer/components";
|
||||
import { Button } from "@renderer/components/ui";
|
||||
import { Button, toast } from "@renderer/components/ui";
|
||||
import { t } from "i18next";
|
||||
import { XCircleIcon } from "lucide-react";
|
||||
import { useAiCommand } from "@renderer/hooks";
|
||||
@@ -36,6 +36,9 @@ export const LookupResult = (props: {
|
||||
onResult && onResult(lookup.meaning);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
toast.error(error.message);
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
|
||||
@@ -319,7 +319,7 @@ export const MediaPlayerControls = (props: {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Tooltip id="media-player-controls-tooltip" />
|
||||
<Tooltip className="z-10" id="media-player-controls-tooltip" />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -25,7 +25,8 @@ export const PitchContour = (props: {
|
||||
height: number;
|
||||
id?: string;
|
||||
}) => {
|
||||
let { peaks, sampleRate, frequencies, height, id } = props;
|
||||
const { peaks, sampleRate, height, id } = props;
|
||||
let { frequencies } = props;
|
||||
|
||||
if (!frequencies) {
|
||||
frequencies = extractFrequencies({ peaks, sampleRate });
|
||||
|
||||
@@ -171,7 +171,7 @@ export const RecordingsList = (props: {
|
||||
<div className="z-50 bottom-16 left-1/2 w-0 h-0 absolute flex items-center justify-center">
|
||||
{referenceId !== undefined && Boolean(referenceText) && (
|
||||
<RecordButton
|
||||
disabled={referenceId == undefined || !Boolean(referenceText)}
|
||||
disabled={referenceId == undefined || !referenceText}
|
||||
onRecordEnd={createRecording}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -22,9 +22,9 @@ export const StoryContent = (props: { content: string }) => {
|
||||
{paragraphs.map((sentences, i: number) => (
|
||||
<p key={`paragraph-${i}`} className="">
|
||||
{sentences.map((sentence, i: number) => {
|
||||
if (sentence.text.match(/\!\[\]\(\S+\)/g)) {
|
||||
const [img] = sentence.text.match(/\!\[\]\(\S+\)/g);
|
||||
const src = img.replace(/\!\[\]\(/g, "").replace(/\)/g, "");
|
||||
if (sentence.text.match(/!\[\]\(\S+\)/g)) {
|
||||
const [img] = sentence.text.match(/!\[\]\(\S+\)/g);
|
||||
const src = img.replace(/!\[\]\(/g, "").replace(/\)/g, "");
|
||||
return (
|
||||
<p key={`paragraph-${i}`}>
|
||||
<img src={src} />
|
||||
|
||||
@@ -54,7 +54,7 @@ export const StoryViewer = (props: {
|
||||
const word = selection
|
||||
.toString()
|
||||
.trim()
|
||||
.replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]+$/, "");
|
||||
.replace(/[.,/#!$%^&*;:{}=\-_`~()]+$/, "");
|
||||
if (!word) return;
|
||||
|
||||
const position = {
|
||||
@@ -152,9 +152,9 @@ export const StoryViewer = (props: {
|
||||
{paragraphs.map((sentences, i: number) => (
|
||||
<p key={`paragraph-${i}`} className="">
|
||||
{sentences.map((sentence, j: number) => {
|
||||
if (sentence.text.match(/\!\[\]\(\S+\)/g)) {
|
||||
const [img] = sentence.text.match(/\!\[\]\(\S+\)/g);
|
||||
const src = img.replace(/\!\[\]\(/g, "").replace(/\)/g, "");
|
||||
if (sentence.text.match(/!\[\]\(\S+\)/g)) {
|
||||
const [img] = sentence.text.match(/!\[\]\(\S+\)/g);
|
||||
const src = img.replace(/!\[\]\(/g, "").replace(/\)/g, "");
|
||||
return <img key={`paragraph-${i}-sentence-${j}`} src={src} />;
|
||||
} else {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user