Skip to content

feat: melhorias de leitura, biblioteca e integração com o Windows - #1

Open
MakenRosa wants to merge 14 commits into
mainfrom
feat/ux-melhorias
Open

MakenRosa wants to merge 14 commits into
mainfrom
feat/ux-melhorias

Conversation

@MakenRosa

Copy link
Copy Markdown
Owner

Resumo

Dez melhorias de UI/UX e qualidade de vida. O PR também inclui o trabalho que estava pendente sem commit: metas, histórico, capítulos em nova tela, junção de páginas e as barras da tela cheia.

Leitura

  • Progresso único. O mesmo percentual aparece no leitor (rolagem e Kindle) e na biblioteca, e a página 1 mostra 0%. Depois de algumas páginas, aparece a estimativa "≈ X min no capítulo · Y no livro", calculada pelo ritmo de cada livro.
  • Duas páginas lado a lado na rolagem (tecla L), com a opção de capa separada. No Kindle, volta automaticamente para página única.
  • Barra lateral:
    • destaca a seção atual do sumário, com níveis recolhíveis;
    • nova aba Páginas, com miniaturas carregadas sob demanda;
    • largura redimensionável;
    • estado lembrado entre livros (tecla S).
  • Voltar e avançar após saltos. Funciona com Alt+← / Alt+→, com os botões laterais do mouse e com o botão "Voltar à pág. X". Ctrl+W volta à biblioteca.
  • Realces e notas no texto. Uma barra aparece ao selecionar texto (H realça, N anota). A aba Notas ganhou busca, e as notas podem ser exportadas em Markdown.

Biblioteca

  • Importação:
    • capa, número de páginas e autor gerados em segundo plano;
    • importação de pastas;
    • "Abrir" e "Mostrar" no aviso ao final.
  • Organização:
    • etiquetas, usadas como filtro;
    • seleção múltipla com ações em lote;
    • busca também em etiquetas e notas.
  • Esvaziar Removidos. Pede confirmação e mostra o espaço liberado. O histórico de leitura é mantido.
  • Menus. Cabem na janela, navegam por teclado e abrem também com clique direito ou Shift+F10.
  • Avisos:
    • empilhados (até 3);
    • erros em linguagem simples, com "Detalhes";
    • progresso da importação no próprio botão;
    • dicas exibidas uma só vez.

Windows

  • O instalador registra o Fólio em "Abrir com" para .pdf, sem trocar o leitor padrão do usuário (ganchos NSIS em src-tauri/windows/installer-hooks.nsh).
  • O app abre os arquivos recebidos pelo Explorer, inclusive quando já está aberto.
  • A janela lembra tamanho, posição e se estava maximizada (tauri-plugin-window-state, sem guardar a tela cheia). Se ficar fora da tela, é reajustada.

Testes

  • npm run format:check, npm run typecheck e npm run build
  • npm test: 64 testes unitários
  • npm run test:rust: 13 testes (novos: exclusão definitiva, etiquetas, pastas, realces, exportação em Markdown, argumentos de abertura) e npm run check:rust (clippy com -D warnings)
  • npm run test:ui: 46 cenários no navegador sem janela
  • npm run test:native: 41 testes no app Tauri isolado, incluindo um reinício real do processo
  • Um teste de fumaça avulso cobriu as funções novas: menus, seleção em lote, etiquetas, exclusão definitiva, histórico de saltos, realces e exportação. Ele encontrou e corrigiu dois bugs: realces que não eram desenhados (convertToViewportRectangle não existe no PDF.js 6) e o aviso que cobria um menu aberto.

Não verificado

  • Instalar, atualizar e desinstalar com os ganchos NSIS, e o Fólio aparecendo em "Abrir com". Isso exige gerar um instalador e testar numa máquina.
  • Os botões laterais do mouse no WebView2 real.
  • A geração de capas em segundo plano com PDFs reais e a importação de pastas pelo diálogo.

Reading
- Unified reading progress across reader and library, with estimated
  time left for the chapter and the book.
- Two pages side by side in continuous scrolling (L), with cover alone.
- Sidebar with current outline section, page thumbnails, resizable
  width and remembered state (S).
- Back/forward after jumps (Alt+Left/Right, mouse side buttons, pill);
  Ctrl+W returns to the library.
- Highlights and notes on the text (H/N), notes search and Markdown
  export.

Library
- Background covers, page counts and PDF metadata; folder import;
  "Abrir"/"Mostrar" after importing.
- Tags, multi-selection with batch actions, search in tags and notes,
  permanent deletion from Removidos that keeps reading history.
- Menus that fit the window, keyboard navigation and context menu.
- Stacked toasts, readable errors, import progress on the button and
  one-time hints.

Windows
- "Abrir com" file association without taking over the default PDF
  app, launch arguments and remembered window size and position.

Also includes the pending reading goals, history, chapter breaks and
joined pages work, with unit, headless UI, Rust and native tests.
The native suite timed out starting WebView2 on the Windows runner, on
main as well. Install the runtime only when the image lacks it, give the
first start up to two minutes, and report the last DevTools answer and the
app's stderr when it still does not come up.
…imeout

WebView2 is installed on the runner but its DevTools port never opens.
Collect what the machine shows when that happens, including a screenshot
uploaded with the test evidence, to find why the browser does not start.
On the GitHub Windows runner WebView2 ignores
WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: the browser started without
--remote-debugging-port, so the suite never connected. The test config
now sets additionalBrowserArgs on its windows, keeping Tauri's default
arguments, so the port no longer depends on the environment variable.
The window now fits itself to the screen, and the CI runner's screen is
narrower than the default window, which hides the reader's 'Ler do inicio'
button that several suites click before setting a size. Set the same
viewport for every suite when it connects.
Emulating a viewport also replaces the pixel ratio. On a high-DPI desktop
that made Kindle turns align to the wrong ratio and drift by a pixel per
screen. Only a window narrower than the reader's full toolbar, as on the
CI runner whose ratio is 1, now gets the emulated size.
Five batches from the audit triage:
- Controls and accessibility: AA contrast for secondary text, field and
  switch borders at 3:1, pressed state on toggles, distinct icons for
  removing and deleting, larger hit targets.
- Feedback and visuals: notices out of the reading area, one error for a
  failed save with retries, errors with context, "Abrir pasta" after
  exports, font size, icon stroke and motion tokens.
- Dialogs and keyboard: initial focus in dialogs, Enter saves a rename,
  focus kept when goals and history redraw, confirmation before Esc
  discards a note, arrows scroll sideways when the page is wider than the
  window, visible focus on the reader.
- Text: one term per concept ("documento", "Adicionar nota", "marcas"),
  fixed labels with state in aria-pressed, ellipses on actions that ask
  for more.
- Library and reader bars: two-line card titles, sticky library header,
  clear-search action, goal progress bar, paper button cycling light,
  sepia and dark, progress line and hint in fullscreen, page pairs in the
  footer.

Also updates the native and headless tests whose texts or flows changed.
- Notices raised while a dialog is open now show above it and their
  buttons respond: the notice container moves into the open dialog.
- Files dropped during a copy wait in a queue and are imported next;
  Ctrl+O during a copy says to wait instead of doing nothing.
- A full notice stack drops the oldest plain notice first, then the
  oldest with an action, and never an error.
- New preference to turn off the single-key shortcuts (WCAG 2.1.4).
- Dialogs are named by their title, and library cards describe their
  author and reading state to screen readers.
- Saving, editing, recolouring or deleting a note keeps the focus in
  the notes panel.
- Shift + arrows select text in the reader by word and by line, in both
  modes; H and N act on that selection and explain what to do without one.
- Library cards and history days are one tab stop each, moved with the
  arrow keys (roving tabindex), with Home, End and Page Up/Down.
- "Tentar novamente" on a failed start no longer relies on an inline
  handler the CSP blocks, and closing that dialog retries too.
- The Marcas tab removes a mark with undo; a note's quote leads to it.
- K, L, D and R ignore key repeat, and rotating offers undo.
- Larger sidebar text, the guide from the reader (menu and F1), and Esc
  clears the library search.

Also makes the native brightness suite wait for the reader's fullscreen
state instead of a promise that passed at once.
- Highlighting and saving a note announce the result to screen readers
  without a notice over the page; notices with undo stay.
- The highlight bar opens above the selected line when there is room.
- The sepia page matches the sample in the preferences.
- The outline is one tab stop moved with the arrows; entries without a
  destination look disabled and say so.
- Favourite keeps a fixed name with aria-pressed everywhere.
- "Ordenar por" label and field border on the library sort; Removidos
  shows its count; a clear focus ring on the library search and on the
  thumbnails; "Nenhuma posição anterior." without the Ctrl + W hint.
The goals suite checked a chapter credit 1.4 s after turning to its start,
but a credit lands after the once-a-second sample and the save that waits
for a pause, so the check sometimes ran first (seen on CI and once at the
start of this branch). Wait until the stored day has the credit, up to 5 s,
and let the assertion decide.
The general goal summed only the documents set to use it, so a document
with its own goal left it at zero even after being read. It now counts
every document read that day, including removed and deleted ones, and a
document's own goal is an extra target for that document only.

Each document has two choices: no own goal or its own goal ("Sem meta"
from older catalogs reads as no own goal and is kept as stored). The
history evaluates past days with the same rule against the general goal
that applied on each day.
- Decorative copy goes away: slogans, eyebrows, the sidebar note, the
  library footer and the reader's "Cópia local" label. The library title
  is the filter's name, and the saving status shows only when saving is
  slow or fails.
- "Continuar leitura" is a compact strip with the cover, the page, the
  progress bar under it and a "Continuar" button; the daily goal sits on
  the title row.
- Preferences are split into Aparência, Leitura, Teclado and Biblioteca
  tabs, with the Kindle-only options grouped and disabled in scrolling.
- Reader header: back, title, Concluir leitura, favourite and the menu.
  Toolbar: Kindle and two pages next to zoom, the bookmark, one
  "Aparência" panel for paper, brightness and warmth, and fullscreen.
  Rotate, read from the start and Preferences move to the menu.
- The goals dialog has two parts, the general goal and this document.
- Notices no longer cover a dialog's actions: informative ones are
  dismissed when a dialog opens, and new ones appear at its top.
Main configured the isolated WebView2 debugging port in the test
window options, as this branch already does, and added an English
summary to the README. Keeps this branch's launcher (longer first-start
wait and the launch report) and adds main's handling of a process that
fails to start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant