create-bluecopa-react-app 1.0.16 → 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 +93 -32
- 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 -2
- package/templates/latest/dist/assets/{__federation_expose_App-DK1ZdBX-.js → __federation_expose_App-CcOhEUCE.js} +1 -1
- package/templates/latest/dist/assets/{client-DqBeHjYu.js → client-uh-HfYnI.js} +6673 -5762
- package/templates/latest/dist/assets/{index-B8EMpf6o.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 +11 -11
- package/templates/latest/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
|
@@ -8,6 +8,7 @@ This guide helps AI assistants and developers understand the project structure,
|
|
|
8
8
|
- **React 18** with TypeScript
|
|
9
9
|
- **React Router v7** with SSR support
|
|
10
10
|
- **shadcn/ui** components built on Radix UI
|
|
11
|
+
- **BlueCopa UI** components from `@bluecopa-ui` registry (built on Radix UI)
|
|
11
12
|
- **Tailwind CSS v4** with CSS variables
|
|
12
13
|
- **Vite 6** for build tooling
|
|
13
14
|
- **TanStack Query** (via @bluecopa/react)
|
|
@@ -16,7 +17,7 @@ This guide helps AI assistants and developers understand the project structure,
|
|
|
16
17
|
```
|
|
17
18
|
app/
|
|
18
19
|
├── components/ # Reusable UI components
|
|
19
|
-
│ ├── ui/ # shadcn/ui components
|
|
20
|
+
│ ├── ui/ # BlueCopa UI or shadcn/ui components
|
|
20
21
|
│ ├── app-sidebar.tsx # Main navigation
|
|
21
22
|
│ ├── data-table.tsx # TanStack Table wrapper
|
|
22
23
|
│ └── chart-*.tsx # Recharts components
|
|
@@ -28,14 +29,59 @@ app/
|
|
|
28
29
|
|
|
29
30
|
## 🎨 Component Patterns
|
|
30
31
|
|
|
31
|
-
###
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
34
47
|
- Built on Radix UI primitives
|
|
35
48
|
- Styled with Tailwind CSS
|
|
36
49
|
- Use `cn()` utility for class merging
|
|
37
50
|
- Support dark mode via CSS variables
|
|
38
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.
|
|
84
|
+
|
|
39
85
|
### Custom Components
|
|
40
86
|
- Use TypeScript interfaces for props
|
|
41
87
|
- Follow React best practices (hooks, memo, etc.)
|
|
@@ -82,12 +128,15 @@ A React library providing opinionated custom hooks for TanStack React Query inte
|
|
|
82
128
|
|
|
83
129
|
## Table of Contents
|
|
84
130
|
|
|
85
|
-
- [AI Agent Guide for BlueCopa React
|
|
131
|
+
- [AI Agent Guide for BlueCopa React UI Template](#ai-agent-guide-for-bluecopa-react-ui-template)
|
|
86
132
|
- [🏗️ Project Architecture Overview](#️-project-architecture-overview)
|
|
87
133
|
- [Core Stack](#core-stack)
|
|
88
134
|
- [Key Directories](#key-directories)
|
|
89
135
|
- [🎨 Component Patterns](#-component-patterns)
|
|
90
|
-
- [
|
|
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)
|
|
91
140
|
- [Custom Components](#custom-components)
|
|
92
141
|
- [Example Component Structure](#example-component-structure)
|
|
93
142
|
- [🔧 Development Patterns](#-development-patterns)
|
|
@@ -725,18 +774,25 @@ import {
|
|
|
725
774
|
4. Implement proper TypeScript types
|
|
726
775
|
|
|
727
776
|
### Adding New Components
|
|
728
|
-
1.
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
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
|
|
733
786
|
|
|
734
787
|
### Working with Forms
|
|
735
|
-
1. Use
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
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
|
|
740
796
|
|
|
741
797
|
### API Integration
|
|
742
798
|
1. Use `@bluecopa/react` hooks
|
|
@@ -830,6 +886,7 @@ import {
|
|
|
830
886
|
|
|
831
887
|
### Documentation
|
|
832
888
|
- [React Router v7 Docs](https://reactrouter.com/)
|
|
889
|
+
- [BlueCopa UI Registry](https://blui.vercel.app)
|
|
833
890
|
- [shadcn/ui Components](https://ui.shadcn.com/)
|
|
834
891
|
- [Tailwind CSS v4](https://tailwindcss.com/)
|
|
835
892
|
- [TanStack Table](https://tanstack.com/table)
|
|
@@ -843,26 +900,30 @@ import {
|
|
|
843
900
|
## 🎯 Best Practices Summary
|
|
844
901
|
|
|
845
902
|
1. **Always use TypeScript** - Define proper interfaces and types
|
|
846
|
-
2. **
|
|
847
|
-
3. **
|
|
848
|
-
4. **
|
|
849
|
-
5. **
|
|
850
|
-
6. **
|
|
851
|
-
7. **
|
|
852
|
-
8. **
|
|
853
|
-
9. **
|
|
854
|
-
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
|
|
855
913
|
|
|
856
914
|
## 🔄 Common Workflows
|
|
857
915
|
|
|
858
916
|
### Adding a New Feature
|
|
859
917
|
1. Create feature branch
|
|
860
|
-
2.
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
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
|
|
866
927
|
|
|
867
928
|
### Debugging Issues
|
|
868
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>
|