create-bluecopa-react-app 1.0.14 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/latest/Agent.md +124 -137
- package/templates/latest/README.md +17 -0
- package/templates/latest/app/app.css +1 -2
- package/templates/latest/app/components/app-sidebar.tsx +5 -0
- package/templates/latest/app/components/nav-user.tsx +4 -5
- package/templates/latest/app/routes/statements.tsx +493 -0
- package/templates/latest/app/routes.tsx +2 -0
- package/templates/latest/components.json +1 -1
- package/templates/latest/dist/assets/{__federation_expose_App-BIH7hwj_.js → __federation_expose_App-CcOhEUCE.js} +1 -1
- package/templates/latest/dist/assets/{client-CsvW46cT.js → client-uh-HfYnI.js} +6674 -5765
- package/templates/latest/dist/assets/{index-CFECuPSy.js → index-C1IOBHtM.js} +1 -1
- package/templates/latest/dist/assets/remoteEntry.css +49 -2
- package/templates/latest/dist/assets/remoteEntry.js +1 -1
- package/templates/latest/dist/index.html +2 -2
- package/templates/latest/package-lock.json +16 -90
- package/templates/latest/package.json +2 -2
package/package.json
CHANGED
|
@@ -1,61 +1,23 @@
|
|
|
1
|
-
# AI Agent Guide for BlueCopa React
|
|
1
|
+
# AI Agent Guide for BlueCopa React UI Template
|
|
2
2
|
|
|
3
3
|
This guide helps AI assistants and developers understand the project structure, patterns, and best practices for working with this BlueCopa React application template.
|
|
4
4
|
|
|
5
|
-
---
|
|
6
|
-
|
|
7
5
|
## 🏗️ Project Architecture Overview
|
|
8
6
|
|
|
9
7
|
### Core Stack
|
|
10
8
|
- **React 18** with TypeScript
|
|
11
9
|
- **React Router v7** with SSR support
|
|
12
10
|
- **shadcn/ui** components built on Radix UI
|
|
11
|
+
- **BlueCopa UI** components from `@bluecopa-ui` registry (built on Radix UI)
|
|
13
12
|
- **Tailwind CSS v4** with CSS variables
|
|
14
13
|
- **Vite 6** for build tooling
|
|
15
14
|
- **TanStack Query** (via @bluecopa/react)
|
|
16
15
|
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 💡 UI Components & @bluecopa-ui Registry
|
|
20
|
-
|
|
21
|
-
This project uses [shadcn/ui](https://ui.shadcn.com/) to scaffold and manage UI component libraries, configured with an explicit support for the **@bluecopa-ui** component registry.
|
|
22
|
-
|
|
23
|
-
### About the `@bluecopa-ui` Registry
|
|
24
|
-
|
|
25
|
-
The registry location is defined in your `components.json` file, mapping the registry name to a hosted registry endpoint:
|
|
26
|
-
|
|
27
|
-
```json
|
|
28
|
-
{
|
|
29
|
-
...
|
|
30
|
-
"registries": {
|
|
31
|
-
"@bluecopa-ui": "https://shadcn-ui-henna.vercel.app/r/{name}.json"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
- **@bluecopa-ui** registry extends the standard shadcn/ui workflow and provides a curated set of BlueCopa-centric UI components, patterns, and design tokens.
|
|
37
|
-
- When running any `npx shadcn@latest` CLI commands and passing `add` or `add registry`, you can use `@bluecopa-ui` as the registry source, e.g.:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npx shadcn@latest add @bluecopa-ui/<component>
|
|
41
|
-
```
|
|
42
|
-
- This enables streamlined upgrades, easy addition of company-specific components, and consistency with the BlueCopa Design System.
|
|
43
|
-
|
|
44
|
-
#### Benefits
|
|
45
|
-
|
|
46
|
-
- **Consistency:** Centralizes custom BlueCopa UI patterns and updates.
|
|
47
|
-
- **Discoverability:** Quickly add business-specific primitives, layouts, dashboards, and utilities.
|
|
48
|
-
- **Maintenance:** Receive improvements, fixes, and new patterns from BlueCopa UX engineering.
|
|
49
|
-
|
|
50
|
-
**Tip:** `@bluecopa-ui` can be used alongside the default shadcn registry. Specify which to use with `--registry` CLI flag.
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
16
|
### Key Directories
|
|
55
17
|
```
|
|
56
18
|
app/
|
|
57
19
|
├── components/ # Reusable UI components
|
|
58
|
-
│ ├── ui/ # shadcn/ui
|
|
20
|
+
│ ├── ui/ # BlueCopa UI or shadcn/ui components
|
|
59
21
|
│ ├── app-sidebar.tsx # Main navigation
|
|
60
22
|
│ ├── data-table.tsx # TanStack Table wrapper
|
|
61
23
|
│ └── chart-*.tsx # Recharts components
|
|
@@ -65,25 +27,68 @@ app/
|
|
|
65
27
|
└── dashboard/ # Sample data and components
|
|
66
28
|
```
|
|
67
29
|
|
|
68
|
-
---
|
|
69
|
-
|
|
70
30
|
## 🎨 Component Patterns
|
|
71
31
|
|
|
72
|
-
###
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
32
|
+
### UI Component Registries
|
|
33
|
+
|
|
34
|
+
This project supports components from two registries:
|
|
35
|
+
|
|
36
|
+
1. **BlueCopa UI Registry** (Preferred for BlueCopa-specific components)
|
|
37
|
+
- Registry URL: https://blui.vercel.app
|
|
38
|
+
- Registry JSON: https://blui.vercel.app/r/registry.json
|
|
39
|
+
- Custom BlueCopa components built on Radix UI
|
|
40
|
+
|
|
41
|
+
2. **shadcn/ui Registry** (Standard components)
|
|
42
|
+
- Registry URL: https://ui.shadcn.com
|
|
43
|
+
- Standard shadcn/ui components built on Radix UI
|
|
44
|
+
|
|
45
|
+
Both registries:
|
|
46
|
+
- Located in `app/components/ui/` after installation
|
|
47
|
+
- Built on Radix UI primitives
|
|
48
|
+
- Styled with Tailwind CSS
|
|
49
|
+
- Use `cn()` utility for class merging
|
|
50
|
+
- Support dark mode via CSS variables
|
|
51
|
+
|
|
52
|
+
### Adding Components
|
|
53
|
+
|
|
54
|
+
#### From BlueCopa UI Registry
|
|
55
|
+
|
|
56
|
+
To add a component from the BlueCopa UI registry (preferred for BlueCopa-specific components):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pnpm dlx shadcn@latest add @bluecopa-ui/button
|
|
60
|
+
pnpm dlx shadcn@latest add @bluecopa-ui/card
|
|
61
|
+
pnpm dlx shadcn@latest add @bluecopa-ui/dialog
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### From shadcn/ui Registry
|
|
65
|
+
|
|
66
|
+
To add a component from the standard shadcn/ui registry:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm dlx shadcn@latest add button
|
|
70
|
+
pnpm dlx shadcn@latest add card
|
|
71
|
+
pnpm dlx shadcn@latest add dialog
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The registries are configured in `components.json`:
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"registries": {
|
|
78
|
+
"@bluecopa-ui": "https://blui.vercel.app/r/{name}.json"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Note**: When no registry prefix is specified, components are added from the default shadcn/ui registry. Use `@bluecopa-ui/` prefix for BlueCopa-specific components.
|
|
79
84
|
|
|
80
85
|
### Custom Components
|
|
81
86
|
- Use TypeScript interfaces for props
|
|
82
|
-
- Follow React best practices
|
|
83
|
-
- Implement
|
|
84
|
-
- Use semantic HTML
|
|
87
|
+
- Follow React best practices (hooks, memo, etc.)
|
|
88
|
+
- Implement proper accessibility
|
|
89
|
+
- Use semantic HTML elements
|
|
85
90
|
|
|
86
|
-
|
|
91
|
+
### Example Component Structure
|
|
87
92
|
```tsx
|
|
88
93
|
import { cn } from "~/lib/utils"
|
|
89
94
|
|
|
@@ -101,49 +106,44 @@ export function Component({ className, children }: ComponentProps) {
|
|
|
101
106
|
}
|
|
102
107
|
```
|
|
103
108
|
|
|
104
|
-
---
|
|
105
|
-
|
|
106
109
|
## 🔧 Development Patterns
|
|
107
110
|
|
|
108
111
|
### State Management
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
+
- Use React hooks (useState, useReducer, useContext)
|
|
113
|
+
- TanStack Query for server state
|
|
114
|
+
- Local state for UI interactions
|
|
115
|
+
- Avoid prop drilling with context
|
|
112
116
|
|
|
113
117
|
### Data Fetching
|
|
114
|
-
- Use `@bluecopa/react` hooks for
|
|
115
|
-
- Implement loading and error states
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
|
|
119
|
-
---
|
|
118
|
+
- Use `@bluecopa/react` hooks for API calls
|
|
119
|
+
- Implement loading and error states
|
|
120
|
+
- Use TanStack Query for caching
|
|
121
|
+
- Handle optimistic updates
|
|
120
122
|
|
|
121
123
|
# @bluecopa/react [](https://www.npmjs.com/package/@bluecopa/react) [](https://github.com/bluecopa/blui/blob/main/packages/react/LICENSE)
|
|
122
124
|
|
|
123
|
-
## A Comprehensive React Query Integration for
|
|
124
|
-
|
|
125
|
-
A React library providing opinionated custom hooks for TanStack React Query integration with BlueCopa core API. This package enables efficient data fetching, caching, and synchronization with the BlueCopa platform while maintaining type safety and developer experience.
|
|
125
|
+
## A Comprehensive React Query Integration for Bluecopa
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
A React library providing opinionated custom hooks for TanStack React Query integration with Bluecopa core API. This package enables efficient data fetching, caching, and synchronization with the Bluecopa platform while maintaining type safety and developer experience.
|
|
128
128
|
|
|
129
129
|
## Table of Contents
|
|
130
130
|
|
|
131
|
-
- [AI Agent Guide for BlueCopa React
|
|
131
|
+
- [AI Agent Guide for BlueCopa React UI Template](#ai-agent-guide-for-bluecopa-react-ui-template)
|
|
132
132
|
- [🏗️ Project Architecture Overview](#️-project-architecture-overview)
|
|
133
133
|
- [Core Stack](#core-stack)
|
|
134
|
-
- [💡 UI Components \& @bluecopa-ui Registry](#-ui-components--bluecopa-ui-registry)
|
|
135
|
-
- [About the `@bluecopa-ui` Registry](#about-the-bluecopa-ui-registry)
|
|
136
|
-
- [Benefits](#benefits)
|
|
137
134
|
- [Key Directories](#key-directories)
|
|
138
135
|
- [🎨 Component Patterns](#-component-patterns)
|
|
139
|
-
- [
|
|
136
|
+
- [UI Component Registries](#ui-component-registries)
|
|
137
|
+
- [Adding Components](#adding-components)
|
|
138
|
+
- [From BlueCopa UI Registry](#from-bluecopa-ui-registry)
|
|
139
|
+
- [From shadcn/ui Registry](#from-shadcnui-registry)
|
|
140
140
|
- [Custom Components](#custom-components)
|
|
141
|
-
|
|
141
|
+
- [Example Component Structure](#example-component-structure)
|
|
142
142
|
- [🔧 Development Patterns](#-development-patterns)
|
|
143
143
|
- [State Management](#state-management)
|
|
144
144
|
- [Data Fetching](#data-fetching)
|
|
145
145
|
- [@bluecopa/react ](#bluecopareact--)
|
|
146
|
-
- [A Comprehensive React Query Integration for
|
|
146
|
+
- [A Comprehensive React Query Integration for Bluecopa](#a-comprehensive-react-query-integration-for-bluecopa)
|
|
147
147
|
- [Table of Contents](#table-of-contents)
|
|
148
148
|
- [Features](#features)
|
|
149
149
|
- [Installation](#installation)
|
|
@@ -151,11 +151,11 @@ A React library providing opinionated custom hooks for TanStack React Query inte
|
|
|
151
151
|
- [Usage](#usage)
|
|
152
152
|
- [Query Provider Setup](#query-provider-setup)
|
|
153
153
|
- [Boilerplate Integration](#boilerplate-integration)
|
|
154
|
-
- [Adding a BlueCopa UI Component](#adding-a-bluecopa-ui-component)
|
|
155
154
|
- [Hook Examples](#hook-examples)
|
|
156
155
|
- [`useUser` - Fetch authenticated user](#useuser---fetch-authenticated-user)
|
|
157
156
|
- [`useDataset` - Fetch dataset with query controls](#usedataset---fetch-dataset-with-query-controls)
|
|
158
|
-
- [
|
|
157
|
+
- [API Documentation](#api-documentation)
|
|
158
|
+
- [`useUser(options?)`](#useuseroptions)
|
|
159
159
|
- [`useDataset(datasetId, options?)`](#usedatasetdatasetid-options)
|
|
160
160
|
- [`useDatasetSample(datasetId, options?)`](#usedatasetsampledatasetid-options)
|
|
161
161
|
- [`useMetric(metricId, options?)`](#usemetricmetricid-options)
|
|
@@ -226,9 +226,6 @@ A React library providing opinionated custom hooks for TanStack React Query inte
|
|
|
226
226
|
- 📦 Re-exports of core TanStack React Query utilities
|
|
227
227
|
- 📊 Sample data preview capabilities
|
|
228
228
|
- 🧩 Customizable query parameters (limit, caching, retries)
|
|
229
|
-
- 🪄 Quickly use shadcn/ui and BlueCopa-specific components via `@bluecopa-ui` registry
|
|
230
|
-
|
|
231
|
-
---
|
|
232
229
|
|
|
233
230
|
## Installation
|
|
234
231
|
|
|
@@ -238,24 +235,14 @@ npm install @bluecopa/react
|
|
|
238
235
|
pnpm add @bluecopa/react
|
|
239
236
|
```
|
|
240
237
|
|
|
241
|
-
**To enable shadcn/ui with BlueCopa custom components (from @bluecopa-ui registry):**
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
npx shadcn@latest add @bluecopa-ui/<component>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
This will fetch the component from the "@bluecopa-ui" registry endpoint declared in your `components.json`. This means you automatically get the most up-to-date BlueCopa patterns and design system building blocks.
|
|
248
|
-
|
|
249
238
|
### Peer Dependencies
|
|
250
239
|
|
|
251
|
-
|
|
240
|
+
This package requires the following in your application:
|
|
252
241
|
|
|
253
242
|
```bash
|
|
254
243
|
npm install react@^18.0.0 react-dom@^18.0.0
|
|
255
244
|
```
|
|
256
245
|
|
|
257
|
-
---
|
|
258
|
-
|
|
259
246
|
## Usage
|
|
260
247
|
|
|
261
248
|
### Query Provider Setup
|
|
@@ -286,7 +273,7 @@ function App() {
|
|
|
286
273
|
|
|
287
274
|
### Boilerplate Integration
|
|
288
275
|
|
|
289
|
-
For projects using the
|
|
276
|
+
For projects using the Bluecopa React boilerplate, use the pre-configured `QueryProvider` component that handles API configuration automatically:
|
|
290
277
|
|
|
291
278
|
```tsx
|
|
292
279
|
// src/providers/query-provider.tsx
|
|
@@ -337,7 +324,7 @@ export default function QueryProvider({ children }: { children: React.ReactNode
|
|
|
337
324
|
|
|
338
325
|
| Variable | Description | Example |
|
|
339
326
|
|----------|-------------|---------|
|
|
340
|
-
| `VITE_BLUECOPA_API_URL` | Base URL for
|
|
327
|
+
| `VITE_BLUECOPA_API_URL` | Base URL for Bluecopa API | `https://develop.bluecopa.com` |
|
|
341
328
|
| `VITE_BLUECOPA_WORKSPACE_ID` | Your workspace identifier | `my-workspace-123` |
|
|
342
329
|
| `VITE_BLUECOPA_API_TOKEN` | Base64-encoded JSON string containing `accessToken` | `eyJhY2Nlc3NUb2tlbiI6IjEyMzQ1In0=` |
|
|
343
330
|
|
|
@@ -362,21 +349,7 @@ function App() {
|
|
|
362
349
|
}
|
|
363
350
|
```
|
|
364
351
|
|
|
365
|
-
This setup automatically configures
|
|
366
|
-
|
|
367
|
-
---
|
|
368
|
-
|
|
369
|
-
### Adding a BlueCopa UI Component
|
|
370
|
-
|
|
371
|
-
To add a BlueCopa custom UI primitive (e.g., "copa-card") to your project, use:
|
|
372
|
-
|
|
373
|
-
```bash
|
|
374
|
-
npx shadcn@latest add @bluecopa-ui/pagination-block
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
The CLI pulls the latest [copa-card](https://shadcn-ui-henna.vercel.app/r/copa-card.json) definition from the registry as specified in `components.json`, and installs it to `app/components/ui/`.
|
|
378
|
-
|
|
379
|
-
---
|
|
352
|
+
This setup automatically configures the API client with your environment-specific settings and applies optimal caching defaults.
|
|
380
353
|
|
|
381
354
|
### Hook Examples
|
|
382
355
|
|
|
@@ -414,12 +387,14 @@ function DatasetViewer({ datasetId }) {
|
|
|
414
387
|
}
|
|
415
388
|
```
|
|
416
389
|
|
|
417
|
-
|
|
390
|
+
## API Documentation
|
|
418
391
|
|
|
419
|
-
|
|
392
|
+
### `useUser(options?)`
|
|
420
393
|
|
|
421
|
-
|
|
394
|
+
Fetches authenticated user details with query controls.
|
|
422
395
|
|
|
396
|
+
**Parameters:**
|
|
397
|
+
- `options` (optional): Query options extending TanStack React Query's `UseQueryOptions`
|
|
423
398
|
|
|
424
399
|
**Returns:**
|
|
425
400
|
- `data`: User object or `undefined`
|
|
@@ -799,18 +774,25 @@ import {
|
|
|
799
774
|
4. Implement proper TypeScript types
|
|
800
775
|
|
|
801
776
|
### Adding New Components
|
|
802
|
-
1.
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
777
|
+
1. Add components from either registry:
|
|
778
|
+
- BlueCopa UI: `pnpm dlx shadcn@latest add @bluecopa-ui/component-name`
|
|
779
|
+
- shadcn/ui: `pnpm dlx shadcn@latest add component-name`
|
|
780
|
+
2. Components are installed in `app/components/ui/`
|
|
781
|
+
3. Prefer BlueCopa UI registry for BlueCopa-specific components
|
|
782
|
+
4. Use shadcn/ui registry for standard components not available in BlueCopa UI
|
|
783
|
+
5. Define TypeScript interface for props if extending components
|
|
784
|
+
6. Implement responsive design
|
|
785
|
+
7. Add proper accessibility attributes
|
|
807
786
|
|
|
808
787
|
### Working with Forms
|
|
809
|
-
1. Use
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
788
|
+
1. Use form components from either registry:
|
|
789
|
+
- BlueCopa UI: `pnpm dlx shadcn@latest add @bluecopa-ui/form`
|
|
790
|
+
- shadcn/ui: `pnpm dlx shadcn@latest add form`
|
|
791
|
+
2. Prefer BlueCopa UI form components when available
|
|
792
|
+
3. Implement validation with Zod
|
|
793
|
+
4. Handle form state with React hooks
|
|
794
|
+
5. Show loading and error states
|
|
795
|
+
6. Use proper form semantics
|
|
814
796
|
|
|
815
797
|
### API Integration
|
|
816
798
|
1. Use `@bluecopa/react` hooks
|
|
@@ -904,6 +886,7 @@ import {
|
|
|
904
886
|
|
|
905
887
|
### Documentation
|
|
906
888
|
- [React Router v7 Docs](https://reactrouter.com/)
|
|
889
|
+
- [BlueCopa UI Registry](https://blui.vercel.app)
|
|
907
890
|
- [shadcn/ui Components](https://ui.shadcn.com/)
|
|
908
891
|
- [Tailwind CSS v4](https://tailwindcss.com/)
|
|
909
892
|
- [TanStack Table](https://tanstack.com/table)
|
|
@@ -917,26 +900,30 @@ import {
|
|
|
917
900
|
## 🎯 Best Practices Summary
|
|
918
901
|
|
|
919
902
|
1. **Always use TypeScript** - Define proper interfaces and types
|
|
920
|
-
2. **
|
|
921
|
-
3. **
|
|
922
|
-
4. **
|
|
923
|
-
5. **
|
|
924
|
-
6. **
|
|
925
|
-
7. **
|
|
926
|
-
8. **
|
|
927
|
-
9. **
|
|
928
|
-
10. **
|
|
903
|
+
2. **Use appropriate registry** - Prefer BlueCopa UI (`@bluecopa-ui/component-name`) for BlueCopa-specific components, use shadcn/ui (`component-name`) for standard components
|
|
904
|
+
3. **Follow component patterns** - Use established component structure from both registries
|
|
905
|
+
4. **Implement accessibility** - Use semantic HTML and ARIA attributes
|
|
906
|
+
5. **Optimize for performance** - Use proper React patterns and code splitting
|
|
907
|
+
6. **Test thoroughly** - Write tests for components and user workflows
|
|
908
|
+
7. **Handle errors gracefully** - Implement proper error boundaries and fallbacks
|
|
909
|
+
8. **Follow responsive design** - Mobile-first approach with proper breakpoints
|
|
910
|
+
9. **Use proper state management** - Choose appropriate patterns for different data types
|
|
911
|
+
10. **Implement proper loading states** - Show feedback during async operations
|
|
912
|
+
11. **Follow security best practices** - Validate inputs and secure API calls
|
|
929
913
|
|
|
930
914
|
## 🔄 Common Workflows
|
|
931
915
|
|
|
932
916
|
### Adding a New Feature
|
|
933
917
|
1. Create feature branch
|
|
934
|
-
2.
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
918
|
+
2. Add required UI components from appropriate registry:
|
|
919
|
+
- BlueCopa UI: `pnpm dlx shadcn@latest add @bluecopa-ui/component-name`
|
|
920
|
+
- shadcn/ui: `pnpm dlx shadcn@latest add component-name`
|
|
921
|
+
3. Implement components with TypeScript
|
|
922
|
+
4. Add proper styling with Tailwind
|
|
923
|
+
5. Implement responsive design
|
|
924
|
+
6. Add tests
|
|
925
|
+
7. Update documentation
|
|
926
|
+
8. Test in both light and dark modes
|
|
940
927
|
|
|
941
928
|
### Debugging Issues
|
|
942
929
|
1. Check browser console for errors
|
|
@@ -112,6 +112,23 @@ encoded as base64.
|
|
|
112
112
|
|
|
113
113
|
If the API errors out or is not configured, the application will show "Set Environment" as the user name with email "setenv@email.com" as a fallback.
|
|
114
114
|
|
|
115
|
+
### Statement Hooks Example
|
|
116
|
+
|
|
117
|
+
This template includes a comprehensive example of using BlueCopa statement hooks at `/statements`. The example demonstrates:
|
|
118
|
+
|
|
119
|
+
- **useGetStatementData** - Fetching statement data by statement ID (with optional viewId and runId)
|
|
120
|
+
- **useGetViewsBySheetId** - Fetching all views for a statement sheet
|
|
121
|
+
- **useGetRunsByViewId** - Fetching all runs for a statement view
|
|
122
|
+
- **useGetViewById** - Fetching specific view details
|
|
123
|
+
- **useGetRunResultById** - Fetching specific run results
|
|
124
|
+
- **useCreateStatementRun** - Creating new statement runs with mutations
|
|
125
|
+
|
|
126
|
+
The example includes two pre-configured statement IDs:
|
|
127
|
+
- Example 1: `MDYK9CU8NR1S41AFAOEX` (uses default view)
|
|
128
|
+
- Example 2: `MGIZ7GD08NQJ71SK8RA7` with View ID `MGJ1ZF0JN53B0V0YH10Z`
|
|
129
|
+
|
|
130
|
+
**Note:** The statement hooks require `@bluecopa/react` version 0.1.16 or higher. Update your `package.json` to use the latest version that includes these hooks.
|
|
131
|
+
|
|
115
132
|
## Building for Production
|
|
116
133
|
|
|
117
134
|
Create a production build:
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
@custom-variant dark (&:is(.dark *));
|
|
5
5
|
|
|
6
6
|
@theme {
|
|
7
|
-
--font-sans: "
|
|
8
|
-
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
7
|
+
--font-sans: "Satoshi", ui-sans-serif, system-ui, sans-serif;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
html,
|
|
@@ -31,7 +31,6 @@ import { useBluecopaUser } from "~/hooks/use-bluecopa-user"
|
|
|
31
31
|
export function NavUser() {
|
|
32
32
|
const { isMobile } = useSidebar()
|
|
33
33
|
const { user, isLoading } = useBluecopaUser()
|
|
34
|
-
const { firstName, email } = user?.user || {}
|
|
35
34
|
// Show loading state while fetching user data
|
|
36
35
|
if (isLoading) {
|
|
37
36
|
return (
|
|
@@ -59,9 +58,9 @@ export function NavUser() {
|
|
|
59
58
|
className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
|
60
59
|
>
|
|
61
60
|
<div className="grid flex-1 text-left text-sm leading-tight">
|
|
62
|
-
<span className="truncate font-medium">{
|
|
61
|
+
<span className="truncate font-medium">User ({user?.userId})</span>
|
|
63
62
|
<span className="text-muted-foreground truncate text-xs">
|
|
64
|
-
{email}
|
|
63
|
+
{user?.email}
|
|
65
64
|
</span>
|
|
66
65
|
</div>
|
|
67
66
|
<IconDotsVertical className="ml-auto size-4" />
|
|
@@ -77,9 +76,9 @@ export function NavUser() {
|
|
|
77
76
|
<div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
|
|
78
77
|
|
|
79
78
|
<div className="grid flex-1 text-left text-sm leading-tight">
|
|
80
|
-
<span className="truncate font-medium">{
|
|
79
|
+
<span className="truncate font-medium">User ({user?.userId})</span>
|
|
81
80
|
<span className="text-muted-foreground truncate text-xs">
|
|
82
|
-
{email}
|
|
81
|
+
{user?.email}
|
|
83
82
|
</span>
|
|
84
83
|
</div>
|
|
85
84
|
</div>
|