diff --git a/package.json b/package.json index a3d690b..6385ffa 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "license": "MIT", "dependencies": { "@design.estate/dees-element": "^2.2.4", - "@signature.digital/catalog": "^1.5.1", + "@signature.digital/catalog": "^1.6.0", "@signature.digital/interfaces": "file:../interfaces", "@signature.digital/tools": "file:../tools" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 948c3df..f56a9a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^2.2.4 version: 2.2.4 '@signature.digital/catalog': - specifier: ^1.5.1 - version: 1.5.1(@tiptap/pm@2.27.2) + specifier: ^1.6.0 + version: 1.6.0(@tiptap/pm@2.27.2) '@signature.digital/interfaces': specifier: file:../interfaces version: file:../interfaces @@ -1035,8 +1035,8 @@ packages: '@sec-ant/readable-stream@0.4.1': resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} - '@signature.digital/catalog@1.5.1': - resolution: {integrity: sha512-SIvNGbf7H420e/AndQTo3IIYHBhyiQoZNEDT9Pw4v3RjaMuhtWQSPvqqoN2Av2k5It8t75WO+IDWwOoA9HFYhQ==} + '@signature.digital/catalog@1.6.0': + resolution: {integrity: sha512-VS940UUIwms4YRP3djJfdxyeBfJDqlBKemp1xHVlfYG3awGhYV2bRKaHMw5wrBQ8m+zvlEmnG5IakQuRwPE/vg==} '@signature.digital/interfaces@1.2.0': resolution: {integrity: sha512-Aym4CYEJ5TDXshNI/kiBPPjDIkQ+TRXeu5u1d0aVC7aShwHmLj38mWLXHqFnAnQSvpXDRje4vAZML9NTU9Q7sg==} @@ -4512,7 +4512,7 @@ snapshots: '@sec-ant/readable-stream@0.4.1': {} - '@signature.digital/catalog@1.5.1(@tiptap/pm@2.27.2)': + '@signature.digital/catalog@1.6.0(@tiptap/pm@2.27.2)': dependencies: '@design.estate/dees-catalog': 3.81.0(@tiptap/pm@2.27.2) '@design.estate/dees-domtools': 2.5.6 diff --git a/ts_web/index.ts b/ts_web/index.ts index feada85..add88bd 100644 --- a/ts_web/index.ts +++ b/ts_web/index.ts @@ -3,8 +3,25 @@ import { html, render } from '@design.estate/dees-element'; type TWorkspaceView = 'inbox' | 'compose' | 'sign' | 'audit' | 'developers' | 'templates' | 'team' | 'settings'; +type TDocumentRow = { + id: string; + title: string; + status: 'awaiting' | 'signed' | 'draft' | 'declined'; + recipients: Array<{ name: string; initials: string; signed: boolean }>; + updated: string; + sender: string; + pages: number; + deadline?: string; +}; + const workspaceViews: TWorkspaceView[] = ['inbox', 'compose', 'sign', 'audit', 'developers', 'templates', 'team', 'settings']; +const appDocuments: TDocumentRow[] = [ + { id: 'app_doc_001', title: 'Platform Services Agreement - App-owned data', status: 'awaiting', recipients: [{ name: 'Sarah Chen', initials: 'SC', signed: true }, { name: 'David Park', initials: 'DP', signed: false }], updated: 'just now', sender: 'App Service', pages: 14, deadline: 'May 5' }, + { id: 'app_doc_002', title: 'Security Addendum - Catalog Integration', status: 'draft', recipients: [{ name: 'Philipp K.', initials: 'PK', signed: false }], updated: '12 min ago', sender: 'App Service', pages: 5 }, + { id: 'app_doc_003', title: 'Completed Vendor NDA - Signed from App', status: 'signed', recipients: [{ name: 'Lila Brooks', initials: 'LB', signed: true }, { name: 'Philipp K.', initials: 'PK', signed: true }], updated: '1h ago', sender: 'App Service', pages: 3 }, +]; + const isWorkspaceView = (view: string): view is TWorkspaceView => workspaceViews.includes(view as TWorkspaceView); const viewFromLocation = (): TWorkspaceView => { @@ -33,6 +50,18 @@ const handleViewChange = (event: Event) => { } }; +const handleWorkspaceViewRequest = (event: Event) => { + const view = (event as CustomEvent<{ view?: TWorkspaceView }>).detail?.view; + if (!view || !isWorkspaceView(view)) return; + currentView = view; + const nextHash = `#${view}`; + if (globalThis.location.hash !== nextHash) { + globalThis.location.hash = view; + } else { + renderApp(); + } +}; + const handleRouteChange = () => { if (routeChangeFrame !== null) { globalThis.cancelAnimationFrame(routeChangeFrame); @@ -67,7 +96,7 @@ const renderApp = () => { height: 100vh; } - + `, appRoot! ); @@ -76,6 +105,7 @@ const renderApp = () => { const run = async () => { createAppRoot(); document.body.addEventListener('view-change', handleViewChange); + document.body.addEventListener('workspace-view-request', handleWorkspaceViewRequest); globalThis.addEventListener('popstate', handleRouteChange); globalThis.addEventListener('hashchange', handleRouteChange); renderApp();