auto-git:
[change] src/App.tsx
This commit is contained in:
12
src/App.tsx
12
src/App.tsx
@@ -178,7 +178,7 @@ function getErrorMessage(error: unknown, fallback: string) {
|
|||||||
export default function App() {
|
export default function App() {
|
||||||
const [texts, setTexts] = useState<Text[]>([]);
|
const [texts, setTexts] = useState<Text[]>([]);
|
||||||
const [selectedTextId, setSelectedTextId] = useState<string | null>(null);
|
const [selectedTextId, setSelectedTextId] = useState<string | null>(null);
|
||||||
const [search, setSearch] = useState("");
|
const [textSearch, setTextSearch] = useState("");
|
||||||
const [loadingTexts, setLoadingTexts] = useState(true);
|
const [loadingTexts, setLoadingTexts] = useState(true);
|
||||||
const [folders, setFolders] = useState<Folder[]>([]);
|
const [folders, setFolders] = useState<Folder[]>([]);
|
||||||
const [loadingFolders, setLoadingFolders] = useState(true);
|
const [loadingFolders, setLoadingFolders] = useState(true);
|
||||||
@@ -370,7 +370,7 @@ export default function App() {
|
|||||||
const isDirty = !isViewingHistory && body !== lastPersistedBody;
|
const isDirty = !isViewingHistory && body !== lastPersistedBody;
|
||||||
const hasText = body.trim().length > 0;
|
const hasText = body.trim().length > 0;
|
||||||
const showLineNumbersActive = showLineNumbers && (!markdownPreview || splitView);
|
const showLineNumbersActive = showLineNumbers && (!markdownPreview || splitView);
|
||||||
const hasSearch = search.trim().length > 0;
|
const hasSearch = textSearch.trim().length > 0;
|
||||||
const documentStats = useMemo(() => getDocumentStats(body), [body]);
|
const documentStats = useMemo(() => getDocumentStats(body), [body]);
|
||||||
const markdownHtml = useMemo(
|
const markdownHtml = useMemo(
|
||||||
() => (markdownPreview ? markdownToHTML(body) : ""),
|
() => (markdownPreview ? markdownToHTML(body) : ""),
|
||||||
@@ -633,13 +633,13 @@ export default function App() {
|
|||||||
const refreshTexts = useCallback(async () => {
|
const refreshTexts = useCallback(async () => {
|
||||||
setLoadingTexts(true);
|
setLoadingTexts(true);
|
||||||
try {
|
try {
|
||||||
const trimmed = search.trim();
|
const trimmed = textSearch.trim();
|
||||||
const rows = trimmed ? await searchTexts(trimmed) : await listTexts();
|
const rows = trimmed ? await searchTexts(trimmed) : await listTexts();
|
||||||
setTexts(rows);
|
setTexts(rows);
|
||||||
} finally {
|
} finally {
|
||||||
setLoadingTexts(false);
|
setLoadingTexts(false);
|
||||||
}
|
}
|
||||||
}, [search]);
|
}, [textSearch]);
|
||||||
|
|
||||||
const refreshFolders = useCallback(async () => {
|
const refreshFolders = useCallback(async () => {
|
||||||
setLoadingFolders(true);
|
setLoadingFolders(true);
|
||||||
@@ -1798,8 +1798,8 @@ export default function App() {
|
|||||||
<input
|
<input
|
||||||
className="search"
|
className="search"
|
||||||
placeholder="Search texts"
|
placeholder="Search texts"
|
||||||
value={search}
|
value={textSearch}
|
||||||
onChange={(event) => setSearch(event.target.value)}
|
onChange={(event) => setTextSearch(event.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="prompt-list">
|
<div className="prompt-list">
|
||||||
|
|||||||
Reference in New Issue
Block a user