Refactor Settings and ChatBOX components for improved layout; add Search button and integrate ScrollArea for better content management

This commit is contained in:
ecwu
2024-12-21 14:23:36 +08:00
parent 5535706a26
commit dccddd6c4f
3 changed files with 40 additions and 54 deletions

View File

@@ -79,7 +79,7 @@ export default function Search(props: {
}
const now = Math.floor(
(result.length / resultKeys.length) * 100,
(result.length / resultKeys.length) * 100
);
if (now !== searchingNow) setSearchingNow(now);
@@ -94,7 +94,7 @@ export default function Search(props: {
const beginIndex = msg.content.indexOf(query);
preview = msg.content.slice(
Math.max(0, beginIndex - 100),
Math.min(msg.content.length, beginIndex + 239),
Math.min(msg.content.length, beginIndex + 239)
) as string;
break;
} else if (contentType === "object") {
@@ -105,7 +105,7 @@ export default function Search(props: {
const beginIndex = detail.text.indexOf(query);
preview = detail.text.slice(
Math.max(0, beginIndex - 100),
Math.min(detail.text.length, beginIndex + 239),
Math.min(detail.text.length, beginIndex + 239)
) as string;
break;
}