The verify pipeline carried two scripts whose targets no longer
exist after the vanilla deletion at commit 25a9c4c:
test/calc-math.test.js — required public/js/calc-math.js (gone);
every assertion is now covered by shared/clinical/
calculators.test.ts (vitest).
scripts/lint-references.js — scans public/js/*.js for DOM id
references and checks each target exists in public/components/
*.html. Those trees are gone; TypeScript + knip + vite build
cover the equivalent dead-reference class for the React tree.
package.json:
• `verify` drops `test:node` and `lint:refs`; now runs
typecheck + vitest + knip + client vite build.
• `test:node` script removed (test/ directory empty).
public/app/assets/ — fresh vite build so the bundle hashes match
the current source (new chunks for ByVisitAge, Cms, DxPicker,
EditableResult, LabsList, Milestones, OutputActions, Recorder,
Shadess, SlideEditor, VisitNote — all features landed in the
preceding commits).
Verified locally on node 20: tsc + 9 test files / 177 tests pass,
knip finds nothing, vite builds 35 chunks, client bundle is 343 kB
initial / 106 kB gzipped (Cms is the biggest lazy chunk at 402 kB
due to Tiptap/ProseMirror).
1 line
No EOL
3.9 KiB
JavaScript
1 line
No EOL
3.9 KiB
JavaScript
import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{i as r}from"./index-C9wKWOAN.js";var i=e(t(),1),a=n();function o({text:e,onUpdate:t,sourceContext:n,exportLabel:o,exportType:s}){let[c,l]=(0,i.useState)(``),[u,d]=(0,i.useState)(null),[f,p]=(0,i.useState)(null),m=(0,i.useRef)(null),h=(0,i.useRef)(null);async function g(){try{await navigator.clipboard.writeText(e),p({kind:`ok`,text:`Copied`})}catch{p({kind:`err`,text:`Copy failed`})}}async function _(){if(!e.trim()){p({kind:`err`,text:`Nothing to read`});return}if(m.current&&!m.current.paused){m.current.pause(),m.current=null,h.current&&=(URL.revokeObjectURL(h.current),null);return}d(`tts`),p(null);try{let t=await fetch(`/api/text-to-speech`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e})});if(!t.ok){let e=(t.headers.get(`content-type`)||``).includes(`json`)&&(await t.json()).error||`TTS failed`;throw Error(e)}let n=await t.blob(),r=URL.createObjectURL(n);h.current=r;let i=new Audio(r);m.current=i,i.onended=()=>{URL.revokeObjectURL(r),h.current===r&&(h.current=null),m.current===i&&(m.current=null)},await i.play()}catch(e){p({kind:`err`,text:e.message})}finally{d(null)}}async function v(){if(!e.trim()){p({kind:`err`,text:`Nothing to export`});return}d(`export`),p(null);try{let t=o+`-`+Date.now();p({kind:`ok`,text:(await r.post(`/api/nextcloud/export`,{content:e,filename:t,type:s})).message||`Exported`})}catch(e){p({kind:`err`,text:e.message||`Nextcloud not connected`})}finally{d(null)}}async function y(){if(!e.trim()){p({kind:`err`,text:`No document to refine`});return}if(!c.trim()){p({kind:`err`,text:`Enter instructions`});return}d(`refine`),p(null);try{t((await r.post(`/api/refine`,{currentDocument:e,instructions:c.trim(),sourceContext:n||void 0})).refined),l(``),p({kind:`ok`,text:`Refined`})}catch(e){p({kind:`err`,text:e.message||`Refine failed`})}finally{d(null)}}async function b(){if(!e.trim()){p({kind:`err`,text:`Nothing to shorten`});return}d(`shorten`),p(null);try{t((await r.post(`/api/shorten`,{document:e})).shortened),p({kind:`ok`,text:`Shortened`})}catch(e){p({kind:`err`,text:e.message||`Shorten failed`})}finally{d(null)}}let x=`inline-flex items-center gap-1 rounded-md border border-border bg-background px-3 py-1.5 text-xs font-medium hover:bg-muted disabled:opacity-50`,S=`inline-flex items-center gap-1 rounded-md bg-primary text-primary-foreground px-3 py-1.5 text-xs font-medium disabled:opacity-50`;return(0,a.jsxs)(`div`,{className:`space-y-2`,"data-testid":`output-actions-`+s,children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:g,className:S,"data-testid":`out-copy`,children:`📋 Copy`}),(0,a.jsx)(`button`,{type:`button`,onClick:_,disabled:u===`tts`,className:x,"data-testid":`out-read`,children:u===`tts`?`⌛ Loading…`:m.current&&!m.current.paused?`⏹ Stop`:`🔊 Read`}),(0,a.jsx)(`button`,{type:`button`,onClick:v,disabled:u===`export`,className:x,"data-testid":`out-export`,children:u===`export`?`⌛ Exporting…`:`☁️ Export to Nextcloud`})]}),(0,a.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,a.jsx)(`textarea`,{className:`flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm min-h-[60px]`,placeholder:`Tell AI how to modify (e.g., 'make it shorter', 'add that patient has asthma history')`,value:c,onChange:e=>l(e.target.value),"data-testid":`out-refine-input`}),(0,a.jsxs)(`div`,{className:`flex sm:flex-col gap-2`,children:[(0,a.jsx)(`button`,{type:`button`,onClick:y,disabled:u===`refine`||!c.trim(),className:S,"data-testid":`out-refine`,children:u===`refine`?`⌛ Refining…`:`✏️ Refine`}),(0,a.jsx)(`button`,{type:`button`,onClick:b,disabled:u===`shorten`,className:x,"data-testid":`out-shorten`,children:u===`shorten`?`⌛ Shortening…`:`📏 Shorter`})]})]}),f&&(0,a.jsx)(`div`,{className:`text-xs `+(f.kind===`ok`?`text-green-600`:`text-destructive`),children:f.text})]})}export{o as t}; |