chore(react): fix editorconfig

This commit is contained in:
Elian Doran 2025-08-30 17:06:21 +03:00
parent 49b189e7a9
commit 4891721cc0
No known key found for this signature in database
3 changed files with 7 additions and 16 deletions

View File

@ -1,6 +1,6 @@
root = true root = true
[*.{js,ts,.tsx}] [*.{js,ts,tsx}]
charset = utf-8 charset = utf-8
end_of_line = lf end_of_line = lf
indent_size = 4 indent_size = 4

View File

@ -33,10 +33,10 @@ export function Pager({ page, pageSize, setPage, pageCount, totalNotes }: Omit<P
title={t("pagination.page_title", { startIndex, endIndex })} title={t("pagination.page_title", { startIndex, endIndex })}
onClick={() => setPage(i)} onClick={() => setPage(i)}
> >
{i} {i}
</a> </a>
)) ))
} else { } else {
// Current page // Current page
children.push(<span className="current-page">{i}</span>) children.push(<span className="current-page">{i}</span>)
} }
@ -52,6 +52,7 @@ export function Pager({ page, pageSize, setPage, pageCount, totalNotes }: Omit<P
<div class="note-list-pager"> <div class="note-list-pager">
{children} {children}
// no need to distinguish "note" vs "notes" since in case of one result, there's no paging at all
<span className="note-list-pager-total-count">({t("pagination.total_notes", { count: totalNotes })})</span> <span className="note-list-pager-total-count">({t("pagination.total_notes", { count: totalNotes })})</span>
</div> </div>
) )
@ -59,7 +60,7 @@ export function Pager({ page, pageSize, setPage, pageCount, totalNotes }: Omit<P
export function usePagination(note: FNote, noteIds: string[]): PaginationContext { export function usePagination(note: FNote, noteIds: string[]): PaginationContext {
const [ page, setPage ] = useState(1); const [ page, setPage ] = useState(1);
const [ pageNotes, setPageNotes ] = useState<FNote[]>(); const [ pageNotes, setPageNotes ] = useState<FNote[]>();
// Parse page size. // Parse page size.
const [ pageSize ] = useNoteLabel(note, "pageSize"); const [ pageSize ] = useNoteLabel(note, "pageSize");
@ -72,7 +73,7 @@ export function usePagination(note: FNote, noteIds: string[]): PaginationContext
const pageCount = Math.ceil(noteIds.length / normalizedPageSize); const pageCount = Math.ceil(noteIds.length / normalizedPageSize);
// Obtain notes within the range. // Obtain notes within the range.
const pageNoteIds = noteIds.slice(startIdx, Math.min(endIdx, noteIds.length)); const pageNoteIds = noteIds.slice(startIdx, Math.min(endIdx, noteIds.length));
useEffect(() => { useEffect(() => {
froca.getNotes(pageNoteIds).then(setPageNotes); froca.getNotes(pageNoteIds).then(setPageNotes);
@ -83,4 +84,4 @@ export function usePagination(note: FNote, noteIds: string[]): PaginationContext
pageSize: normalizedPageSize, pageSize: normalizedPageSize,
totalNotes: noteIds.length totalNotes: noteIds.length
}; };
} }

View File

@ -39,19 +39,9 @@ class ListOrGridView extends ViewMode<{}> {
this.$noteList.show(); this.$noteList.show();
this.renderPager();
return this.$noteList; return this.$noteList;
} }
renderPager() {
// no need to distinguish "note" vs "notes" since in case of one result, there's no paging at all
$pager.append(`<span class=""></span>`);
}
async renderNote(note: FNote, expand: boolean = false) { async renderNote(note: FNote, expand: boolean = false) {
const { $renderedAttributes } = await attributeRenderer.renderNormalAttributes(note); const { $renderedAttributes } = await attributeRenderer.renderNormalAttributes(note);