7
0
forked from yvv/decision

Menu : Boîte à outils en premier + sidebar collapsible icônes

- Boîte à outils (/tools) en 1ère position dans la nav (desktop + mobile)
- Sidebar desktop repliable (toggle pictos-only, 14rem → 3.75rem)
  - labels masqués par transition CSS fluide (max-width + opacity)
  - état persisté en localStorage (libred-sidebar-collapsed)
- Page document : toggle Vue structurée / Aperçu document
  - sous-toggle En vigueur / Selon les votes
  - composant DocumentPreview (rendu PDF-like)
    - filigrane discret, items ordonnés par sort_order
    - mode projection : proposed_text substitu + encadrement orange
    - footer horodaté, print-friendly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-03-17 04:21:21 +01:00
parent 73c5bf148c
commit feaf4de7e0
4 changed files with 671 additions and 8 deletions

View File

@@ -68,6 +68,8 @@ interface DocumentsState {
current: Document | null
items: DocumentItem[]
versions: ItemVersion[]
allItemVersions: Record<string, ItemVersion[]>
loadingVersions: boolean
loading: boolean
error: string | null
}
@@ -78,6 +80,8 @@ export const useDocumentsStore = defineStore('documents', {
current: null,
items: [],
versions: [],
allItemVersions: {},
loadingVersions: false,
loading: false,
error: null,
}),
@@ -247,6 +251,28 @@ export const useDocumentsStore = defineStore('documents', {
}
},
/**
* Fetch all versions for every item in a document (parallel).
* Used to compute the "projected" view (document as-if all active votes passed).
*/
async fetchAllItemVersions(slug: string, itemIds: string[]) {
this.loadingVersions = true
try {
const { $api } = useApi()
const results = await Promise.allSettled(
itemIds.map(id => $api<ItemVersion[]>(`/documents/${slug}/items/${id}/versions`)),
)
const map: Record<string, ItemVersion[]> = {}
itemIds.forEach((id, i) => {
const r = results[i]
map[id] = r.status === 'fulfilled' ? r.value : []
})
this.allItemVersions = map
} finally {
this.loadingVersions = false
}
},
/**
* Archive a document into the Sanctuary.
*/
@@ -280,6 +306,8 @@ export const useDocumentsStore = defineStore('documents', {
this.current = null
this.items = []
this.versions = []
this.allItemVersions = {}
this.loadingVersions = false
},
},
})