ac-tool/frontend/src/api/sheets.ts
Vadym Samoilenko 72c50b2c92 Initial commit — AC Tool unified application
Merges ac-helper (PHP Activation Calendar) and brief-extractor (Python AI)
into a single Docker app with React/TypeScript frontend.

Features:
- Brief upload → AI extraction → review → Activation Calendar import
- Handsontable v17 spreadsheet with dependent dropdowns (148 categories)
- AI natural language commands via Gemini (YOLO mode, voice input)
- Azure AD MSAL SPA PKCE authentication, user roles (user/admin)
- CSV Activation Calendar export
- Real-time WebSocket job progress
- Admin: user management, dropdown Excel upload
- Multi-stage Dockerfile, docker-compose, nginx proxy instructions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 13:24:46 +00:00

30 lines
1.3 KiB
TypeScript

import api from './client'
import type { SheetMeta, Deliverable } from '../types'
export const listSheets = () => api.get<{ sheets: SheetMeta[] }>('/sheets').then(r => r.data.sheets)
export const createSheet = (name: string, data: Deliverable[] = []) =>
api.post<{ sheet: SheetMeta }>('/sheets', { name, data }).then(r => r.data.sheet)
export const loadSheet = (id: string) =>
api.get<{ data: Deliverable[] }>(`/sheets/${id}`).then(r => r.data.data)
export const updateSheet = (id: string, data: Deliverable[]) =>
api.put(`/sheets/${id}`, { data })
export const deleteSheet = (id: string) => api.delete(`/sheets/${id}`)
export const renameSheet = (id: string, name: string) =>
api.patch(`/sheets/${id}`, { name })
export const duplicateSheet = (id: string) =>
api.post<{ sheet: SheetMeta }>(`/sheets/${id}/duplicate`).then(r => r.data.sheet)
export const importDeliverables = (sheetId: string, deliverables: Deliverable[], mode: 'append' | 'replace' = 'append') =>
api.post(`/sheets/${sheetId}/import`, { deliverables, mode }).then(r => r.data)
export const exportSheet = (id: string) => {
const token = sessionStorage.getItem('ac_access_token')
const query = token ? `?_token=${token}` : ''
window.open(`${import.meta.env.BASE_URL}api/sheets/${id}/export${query}`, '_blank')
}