create-bluecopa-react-app 1.0.0 → 1.0.2
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/README.md +162 -50
- package/bin/create-bluecopa-react-app.js +5 -5
- package/package.json +1 -1
- package/templates/latest/.env.example +14 -0
- package/templates/latest/.eslintrc.cjs +42 -0
- package/templates/latest/Agent.md +259 -0
- package/templates/latest/README.md +281 -0
- package/templates/latest/clean.sh +39 -0
- package/templates/latest/index.html +14 -0
- package/templates/{basic → latest}/package-lock.json +1099 -1084
- package/templates/latest/package.json +61 -0
- package/templates/{basic/postcss.config.js → latest/postcss.config.cjs} +1 -1
- package/templates/latest/public/bluecopa-logo.svg +30 -0
- package/templates/latest/public/favicon-32x32.png +0 -0
- package/templates/latest/public/favicon-96x96.png +0 -0
- package/templates/latest/public/favicon.ico +0 -0
- package/templates/latest/setup.sh +55 -0
- package/templates/latest/src/App.tsx +15 -0
- package/templates/latest/src/components/layout/dashboard-header.tsx +139 -0
- package/templates/latest/src/components/layout/dashboard-layout.tsx +29 -0
- package/templates/latest/src/components/layout/sidebar.tsx +54 -0
- package/templates/latest/src/components/page/dashboard.tsx +1506 -0
- package/templates/latest/src/components/page/navbar.tsx +104 -0
- package/templates/latest/src/components/tables/data-grid.tsx +439 -0
- package/templates/latest/src/components/ui/alert.tsx +59 -0
- package/templates/latest/src/components/ui/avatar.tsx +50 -0
- package/templates/latest/src/components/ui/badge.tsx +36 -0
- package/templates/latest/src/components/ui/bluecopa-logo.tsx +54 -0
- package/templates/{basic → latest}/src/components/ui/button.tsx +5 -11
- package/templates/latest/src/components/ui/dropdown-menu.tsx +200 -0
- package/templates/latest/src/components/ui/input.tsx +24 -0
- package/templates/latest/src/components/ui/label.tsx +23 -0
- package/templates/latest/src/components/ui/select.tsx +29 -0
- package/templates/latest/src/hooks/use-api.ts +55 -0
- package/templates/{basic → latest}/src/index.css +1 -1
- package/templates/{basic → latest}/src/main.tsx +6 -2
- package/templates/latest/src/pages/Dashboard.tsx +13 -0
- package/templates/latest/src/pages/Home.tsx +622 -0
- package/templates/latest/src/providers/query-provider.tsx +48 -0
- package/templates/latest/src/single-spa.tsx +105 -0
- package/templates/{basic/src/types/index.ts → latest/src/types/api.ts} +19 -35
- package/templates/latest/src/vite-env.d.ts +11 -0
- package/templates/{basic → latest}/tailwind.config.js +15 -4
- package/templates/{basic/tsconfig.json → latest/tsconfig.app.json} +5 -10
- package/templates/latest/tsconfig.json +19 -0
- package/templates/latest/vite.config.ts +64 -0
- package/templates/basic/.editorconfig +0 -12
- package/templates/basic/.env.example +0 -10
- package/templates/basic/README.md +0 -213
- package/templates/basic/index.html +0 -13
- package/templates/basic/package.json +0 -68
- package/templates/basic/setup.sh +0 -46
- package/templates/basic/src/App.tsx +0 -95
- package/templates/basic/src/components/dashboard/AdvancedAnalytics.tsx +0 -351
- package/templates/basic/src/components/dashboard/MetricsOverview.tsx +0 -150
- package/templates/basic/src/components/dashboard/TransactionCharts.tsx +0 -215
- package/templates/basic/src/components/dashboard/TransactionTable.tsx +0 -172
- package/templates/basic/src/components/ui/tabs.tsx +0 -53
- package/templates/basic/src/pages/Dashboard.tsx +0 -135
- package/templates/basic/vite.config.ts +0 -13
- /package/templates/{basic → latest}/src/components/ui/card.tsx +0 -0
- /package/templates/{basic → latest}/src/lib/utils.ts +0 -0
- /package/templates/{basic → latest}/tsconfig.node.json +0 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# BlueCopa React App Template
|
|
2
|
+
|
|
3
|
+
A production-ready React template with React Router for building modern BlueCopa dashboard applications with integrated React hooks, beautiful UI components, and comprehensive data visualization capabilities.
|
|
4
|
+
|
|
5
|
+
## 🎨 Design System
|
|
6
|
+
|
|
7
|
+
This template now uses the latest Bluecopa design system with:
|
|
8
|
+
- **Navy Blue Header**: Uses the official Bluecopa navy color (`#041e42`) for headers and navigation
|
|
9
|
+
- **Modern Card Layout**: Clean, borderless cards with subtle shadows
|
|
10
|
+
- **Consistent Spacing**: Improved spacing and layout following the latest app design
|
|
11
|
+
- **User Profile Integration**: Modern user dropdown with avatar and profile information
|
|
12
|
+
- **Search & Notifications**: Built-in search bar and notification system
|
|
13
|
+
- **Responsive Design**: Mobile-first approach with proper responsive breakpoints
|
|
14
|
+
|
|
15
|
+
## 🚀 Quick Start
|
|
16
|
+
|
|
17
|
+
> **Note**: This template is typically generated using the `create-bluecopa-react-app` CLI tool. If you're using this template directly, follow the manual setup instructions below.
|
|
18
|
+
|
|
19
|
+
### Using the CLI Tool (Recommended)
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Install globally
|
|
23
|
+
npm install -g create-bluecopa-react-app
|
|
24
|
+
|
|
25
|
+
# Create new app
|
|
26
|
+
create-bluecopa-react-app my-dashboard
|
|
27
|
+
|
|
28
|
+
# Or use npx
|
|
29
|
+
npx create-bluecopa-react-app my-dashboard
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Manual Setup
|
|
33
|
+
|
|
34
|
+
### Prerequisites
|
|
35
|
+
- Node.js 18+
|
|
36
|
+
- npm or pnpm
|
|
37
|
+
- Access to Bluecopa workspace
|
|
38
|
+
|
|
39
|
+
### Installation
|
|
40
|
+
|
|
41
|
+
1. **Clone or copy the template**:
|
|
42
|
+
```bash
|
|
43
|
+
# If using as part of the blui monorepo
|
|
44
|
+
cd packages/boilerplate/react/templates/react-router
|
|
45
|
+
|
|
46
|
+
# Or copy the template to your project location
|
|
47
|
+
cp -r packages/boilerplate/react/templates/react-router my-bluecopa-app
|
|
48
|
+
cd my-bluecopa-app
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
2. **Install dependencies**:
|
|
52
|
+
```bash
|
|
53
|
+
# Recommended: Use pnpm (consistent with monorepo)
|
|
54
|
+
pnpm install
|
|
55
|
+
|
|
56
|
+
# Alternative: Use npm
|
|
57
|
+
npm install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
3. **Set up environment variables**:
|
|
61
|
+
```bash
|
|
62
|
+
# Automated setup (recommended)
|
|
63
|
+
./setup.sh
|
|
64
|
+
|
|
65
|
+
# Manual setup
|
|
66
|
+
cp .env.example .env.local
|
|
67
|
+
# Edit .env.local with your Bluecopa credentials from dashboard -> Settings -> API Tokens
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
4. **Start development server**:
|
|
71
|
+
```bash
|
|
72
|
+
npm run dev
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
5. **Open your browser**: Navigate to [http://localhost:3000](http://localhost:3000)
|
|
76
|
+
|
|
77
|
+
## ✨ Features
|
|
78
|
+
|
|
79
|
+
### 🎯 Core Capabilities
|
|
80
|
+
- **React 18** with TypeScript
|
|
81
|
+
- **React Router v6** for client-side routing
|
|
82
|
+
- **Vite** for fast development and building
|
|
83
|
+
- **@bluecopa/react** - Complete hook library for Bluecopa APIs
|
|
84
|
+
- **TailwindCSS** - Utility-first CSS framework
|
|
85
|
+
- **Radix UI** - Accessible component primitives
|
|
86
|
+
- **Lucide React** - Beautiful icon library
|
|
87
|
+
- **Recharts** - Composable charting library
|
|
88
|
+
|
|
89
|
+
### 🏗️ Architecture
|
|
90
|
+
- **Component-based** architecture with reusable UI components
|
|
91
|
+
- **Custom hooks** for API integration and data management
|
|
92
|
+
- **TypeScript** for type safety and better developer experience
|
|
93
|
+
- **Responsive design** that works on all devices
|
|
94
|
+
- **Modern React patterns** with functional components and hooks
|
|
95
|
+
|
|
96
|
+
### 📊 Bluecopa Integration
|
|
97
|
+
- **Pre-configured hooks** for user data, metrics, and datasets
|
|
98
|
+
- **Real-time data** fetching with TanStack Query
|
|
99
|
+
- **Error handling** and loading states
|
|
100
|
+
- **Authentication** integration
|
|
101
|
+
- **Type-safe** API responses
|
|
102
|
+
|
|
103
|
+
### 🎨 UI Components
|
|
104
|
+
- **Card layouts** for dashboard sections
|
|
105
|
+
- **Data tables** for displaying datasets
|
|
106
|
+
- **Charts and graphs** for data visualization
|
|
107
|
+
- **Form components** with validation
|
|
108
|
+
- **Navigation** components with routing
|
|
109
|
+
- **Responsive grid** layouts
|
|
110
|
+
|
|
111
|
+
## 📁 Project Structure
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
src/
|
|
115
|
+
├── components/ # Reusable UI components
|
|
116
|
+
│ ├── ui/ # Base UI components (buttons, cards, etc.)
|
|
117
|
+
│ └── navbar.tsx # Navigation component
|
|
118
|
+
├── hooks/ # Custom React hooks
|
|
119
|
+
│ └── use-api.ts # Bluecopa API hooks
|
|
120
|
+
├── lib/ # Utility functions
|
|
121
|
+
│ └── utils.ts # Helper functions
|
|
122
|
+
├── pages/ # Route components
|
|
123
|
+
│ ├── Home.tsx # Home page
|
|
124
|
+
│ └── Dashboard.tsx # Dashboard page
|
|
125
|
+
├── providers/ # React context providers
|
|
126
|
+
│ └── query-provider.tsx # TanStack Query provider
|
|
127
|
+
├── types/ # TypeScript type definitions
|
|
128
|
+
├── App.tsx # Main app component with routing
|
|
129
|
+
├── main.tsx # Application entry point
|
|
130
|
+
└── index.css # Global styles
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 🔧 Configuration
|
|
134
|
+
|
|
135
|
+
### Environment Variables
|
|
136
|
+
Create a `.env.local` file in the root directory:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Bluecopa API Configuration
|
|
140
|
+
VITE_BLUECOPA_API_TOKEN=your-bluecopa-api-token
|
|
141
|
+
VITE_BLUECOPA_API_URL=https://develop.bluecopa.com/api/v1
|
|
142
|
+
VITE_BLUECOPA_WORKSPACE_ID=your-workspace-id
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Getting Your Credentials
|
|
146
|
+
1. Log in to your Bluecopa workspace
|
|
147
|
+
2. Navigate to Settings > API Keys
|
|
148
|
+
3. Generate or copy your API token
|
|
149
|
+
4. Note your workspace ID from the URL or settings
|
|
150
|
+
|
|
151
|
+
## 🛠️ Development
|
|
152
|
+
|
|
153
|
+
### Available Scripts
|
|
154
|
+
- `npm run dev` - Start development server
|
|
155
|
+
- `npm run build` - Build for production
|
|
156
|
+
- `npm run preview` - Preview production build
|
|
157
|
+
- `npm run lint` - Run ESLint
|
|
158
|
+
- `npm run type-check` - Run TypeScript compiler
|
|
159
|
+
|
|
160
|
+
### Adding New Routes
|
|
161
|
+
Add new routes in `src/App.tsx`:
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import { Routes, Route } from 'react-router-dom'
|
|
165
|
+
import NewPage from '@/pages/NewPage'
|
|
166
|
+
|
|
167
|
+
export default function App() {
|
|
168
|
+
return (
|
|
169
|
+
<QueryProvider>
|
|
170
|
+
<Routes>
|
|
171
|
+
<Route path="/" element={<Home />} />
|
|
172
|
+
<Route path="/dashboard" element={<Dashboard />} />
|
|
173
|
+
<Route path="/new-page" element={<NewPage />} />
|
|
174
|
+
</Routes>
|
|
175
|
+
</QueryProvider>
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Adding Navigation Links
|
|
181
|
+
Update the navigation in `src/components/navbar.tsx`:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
const navigation = [
|
|
185
|
+
{ name: 'Home', href: '/', icon: Home },
|
|
186
|
+
{ name: 'Dashboard Overview', href: '/dashboard', icon: LayoutDashboard },
|
|
187
|
+
{ name: 'New Page', href: '/new-page', icon: Settings },
|
|
188
|
+
]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 📚 API Integration
|
|
192
|
+
|
|
193
|
+
This template includes pre-configured hooks for common Bluecopa API operations:
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
import { useUserData, useMetricDataDemo, useDatasetDataDemo } from '@/hooks/use-api'
|
|
197
|
+
|
|
198
|
+
function MyComponent() {
|
|
199
|
+
const { data: userData, isLoading, error } = useUserData()
|
|
200
|
+
const { data: metrics } = useMetricDataDemo()
|
|
201
|
+
const { data: datasets } = useDatasetDataDemo()
|
|
202
|
+
|
|
203
|
+
if (isLoading) return <div>Loading...</div>
|
|
204
|
+
if (error) return <div>Error: {error.message}</div>
|
|
205
|
+
|
|
206
|
+
return <div>Welcome, {userData?.user?.firstName}!</div>
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## 🎨 Styling
|
|
211
|
+
|
|
212
|
+
The template uses TailwindCSS for styling with a custom design system:
|
|
213
|
+
|
|
214
|
+
- **Color palette**: Bluecopa brand colors
|
|
215
|
+
- **Typography**: Inter font family
|
|
216
|
+
- **Spacing**: Consistent spacing scale
|
|
217
|
+
- **Components**: Pre-built component styles
|
|
218
|
+
|
|
219
|
+
### Customizing Colors
|
|
220
|
+
Edit `tailwind.config.js` to modify the color scheme:
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
module.exports = {
|
|
224
|
+
theme: {
|
|
225
|
+
extend: {
|
|
226
|
+
colors: {
|
|
227
|
+
bluecopa: {
|
|
228
|
+
50: '#eff6ff',
|
|
229
|
+
// ... other shades
|
|
230
|
+
900: '#1e3a8a',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## 🚀 Deployment
|
|
239
|
+
|
|
240
|
+
### Build for Production
|
|
241
|
+
```bash
|
|
242
|
+
npm run build
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The built files will be in the `dist/` directory.
|
|
246
|
+
|
|
247
|
+
### Deploy to Vercel
|
|
248
|
+
1. Push your code to GitHub
|
|
249
|
+
2. Connect your repository to Vercel
|
|
250
|
+
3. Set environment variables in Vercel dashboard
|
|
251
|
+
4. Deploy
|
|
252
|
+
|
|
253
|
+
### Deploy to Netlify
|
|
254
|
+
1. Build the project locally
|
|
255
|
+
2. Upload the `dist/` folder to Netlify
|
|
256
|
+
3. Set environment variables in Netlify dashboard
|
|
257
|
+
|
|
258
|
+
## 🔒 Environment Security
|
|
259
|
+
|
|
260
|
+
- Never commit `.env.local` files
|
|
261
|
+
- Use environment variables for all sensitive data
|
|
262
|
+
- Rotate API tokens regularly
|
|
263
|
+
- Use different tokens for development and production
|
|
264
|
+
|
|
265
|
+
## 🤝 Contributing
|
|
266
|
+
|
|
267
|
+
1. Fork the repository
|
|
268
|
+
2. Create a feature branch
|
|
269
|
+
3. Make your changes
|
|
270
|
+
4. Add tests if applicable
|
|
271
|
+
5. Submit a pull request
|
|
272
|
+
|
|
273
|
+
## 📄 License
|
|
274
|
+
|
|
275
|
+
This template is part of the Bluecopa ecosystem and follows the project's licensing terms.
|
|
276
|
+
|
|
277
|
+
## 🆘 Support
|
|
278
|
+
|
|
279
|
+
- Check the [Bluecopa documentation](https://docs.bluecopa.com)
|
|
280
|
+
- Review the [React Router documentation](https://reactrouter.com)
|
|
281
|
+
- Open issues in the project repository
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Development helper script for react-router template
|
|
4
|
+
|
|
5
|
+
echo "🧹 Cleaning react-router template..."
|
|
6
|
+
|
|
7
|
+
# Remove build artifacts
|
|
8
|
+
rm -rf dist/
|
|
9
|
+
echo "✅ Removed dist directory"
|
|
10
|
+
|
|
11
|
+
# Remove node_modules and lock files
|
|
12
|
+
rm -rf node_modules/
|
|
13
|
+
rm -f package-lock.json
|
|
14
|
+
rm -f yarn.lock
|
|
15
|
+
echo "✅ Removed node_modules and lock files"
|
|
16
|
+
|
|
17
|
+
# Remove environment files (keeping example)
|
|
18
|
+
rm -f .env.local
|
|
19
|
+
echo "✅ Removed .env.local"
|
|
20
|
+
|
|
21
|
+
# Optionally reinstall dependencies
|
|
22
|
+
if [ "$1" = "--install" ]; then
|
|
23
|
+
echo "📦 Reinstalling dependencies..."
|
|
24
|
+
if command -v pnpm &> /dev/null; then
|
|
25
|
+
pnpm install
|
|
26
|
+
else
|
|
27
|
+
npm install
|
|
28
|
+
fi
|
|
29
|
+
echo "✅ Dependencies reinstalled"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
echo "🎉 Cleanup complete!"
|
|
33
|
+
echo ""
|
|
34
|
+
echo "To reinstall dependencies:"
|
|
35
|
+
echo " pnpm install # recommended"
|
|
36
|
+
echo " npm install # alternative"
|
|
37
|
+
echo ""
|
|
38
|
+
echo "To set up environment:"
|
|
39
|
+
echo " ./setup.sh"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Bluecopa - AI-powered Finance Automation</title>
|
|
8
|
+
<meta name="description" content="AI-powered close automation for modern finance teams. Streamline your order-to-cash, procure-to-pay, and record-to-report processes." />
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|