create-bluecopa-react-app 1.0.0
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 -0
- package/bin/create-bluecopa-react-app.js +171 -0
- package/package.json +40 -0
- package/templates/basic/.editorconfig +12 -0
- package/templates/basic/.env.example +10 -0
- package/templates/basic/README.md +213 -0
- package/templates/basic/index.html +13 -0
- package/templates/basic/package-lock.json +6343 -0
- package/templates/basic/package.json +68 -0
- package/templates/basic/postcss.config.js +6 -0
- package/templates/basic/setup.sh +46 -0
- package/templates/basic/src/App.tsx +95 -0
- package/templates/basic/src/components/dashboard/AdvancedAnalytics.tsx +351 -0
- package/templates/basic/src/components/dashboard/MetricsOverview.tsx +150 -0
- package/templates/basic/src/components/dashboard/TransactionCharts.tsx +215 -0
- package/templates/basic/src/components/dashboard/TransactionTable.tsx +172 -0
- package/templates/basic/src/components/ui/button.tsx +64 -0
- package/templates/basic/src/components/ui/card.tsx +79 -0
- package/templates/basic/src/components/ui/tabs.tsx +53 -0
- package/templates/basic/src/index.css +59 -0
- package/templates/basic/src/lib/utils.ts +6 -0
- package/templates/basic/src/main.tsx +9 -0
- package/templates/basic/src/pages/Dashboard.tsx +135 -0
- package/templates/basic/src/types/index.ts +94 -0
- package/templates/basic/tailwind.config.js +77 -0
- package/templates/basic/tsconfig.json +31 -0
- package/templates/basic/tsconfig.node.json +10 -0
- package/templates/basic/vite.config.ts +13 -0
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Create BlueCopa React App
|
|
2
|
+
|
|
3
|
+
A CLI tool to bootstrap modern React applications for BlueCopa with built-in UI components, data visualization capabilities, and development best practices.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Modern React Stack**: React 18, TypeScript, Vite
|
|
8
|
+
- 📊 **Data Visualization**: Integration ready for charts and analytics
|
|
9
|
+
- 🎨 **UI Components**: shadcn/ui with Radix UI primitives
|
|
10
|
+
- 📡 **BlueCopa React Components**: Pre-configured @bluecopa/react package
|
|
11
|
+
- 🎯 **Type Safety**: Full TypeScript support
|
|
12
|
+
- 📱 **Responsive Design**: Tailwind CSS with mobile-first approach
|
|
13
|
+
- 🛠️ **Development Tools**: ESLint, TypeScript checking, and modern build tools
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Install the CLI tool globally
|
|
19
|
+
npm install -g create-bluecopa-react-app
|
|
20
|
+
|
|
21
|
+
# Create a new BlueCopa React app
|
|
22
|
+
create-bluecopa-react-app my-dashboard
|
|
23
|
+
|
|
24
|
+
# Or use npx (no global installation needed)
|
|
25
|
+
npx create-bluecopa-react-app my-dashboard
|
|
26
|
+
|
|
27
|
+
# Navigate to the project
|
|
28
|
+
cd my-dashboard
|
|
29
|
+
|
|
30
|
+
# Install dependencies (if not auto-installed)
|
|
31
|
+
npm install
|
|
32
|
+
|
|
33
|
+
# Start development server
|
|
34
|
+
npm run dev
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Template Included
|
|
38
|
+
|
|
39
|
+
### BlueCopa Basic Template
|
|
40
|
+
|
|
41
|
+
A foundational template that provides:
|
|
42
|
+
|
|
43
|
+
- **Modern React Setup**: React 18 with TypeScript and Vite
|
|
44
|
+
- **BlueCopa Components**: Pre-configured @bluecopa/react component library
|
|
45
|
+
- **UI Foundation**: Complete shadcn/ui component suite with Radix UI primitives
|
|
46
|
+
- **Styling System**: Tailwind CSS with BlueCopa design tokens
|
|
47
|
+
- **Development Setup**: ESLint, TypeScript configuration, and build optimization
|
|
48
|
+
- **Environment Configuration**: Ready-to-use environment variable setup
|
|
49
|
+
|
|
50
|
+
#### Key Dependencies Included
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// Core BlueCopa and React ecosystem
|
|
54
|
+
"@bluecopa/react": "^0.1.3"
|
|
55
|
+
"react": "^18.2.0"
|
|
56
|
+
"typescript": "^5.0.2"
|
|
57
|
+
|
|
58
|
+
// UI and Styling
|
|
59
|
+
"@radix-ui/*": "Latest versions"
|
|
60
|
+
"tailwindcss": "^3.3.0"
|
|
61
|
+
"lucide-react": "^0.263.1"
|
|
62
|
+
|
|
63
|
+
// Development and Build
|
|
64
|
+
"vite": "^4.4.5"
|
|
65
|
+
"@vitejs/plugin-react": "^4.0.3"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Project Structure
|
|
69
|
+
|
|
70
|
+
The generated project follows a clean, scalable structure:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
my-bluecopa-app/
|
|
74
|
+
├── src/
|
|
75
|
+
│ ├── components/
|
|
76
|
+
│ │ └── ui/ # shadcn/ui components
|
|
77
|
+
│ ├── lib/ # Utilities and helpers
|
|
78
|
+
│ ├── App.tsx # Main application component
|
|
79
|
+
│ ├── main.tsx # Application entry point
|
|
80
|
+
│ ├── index.css # Global styles and Tailwind imports
|
|
81
|
+
│ └── vite-env.d.ts # Vite type declarations
|
|
82
|
+
├── public/ # Static assets
|
|
83
|
+
├── .env.example # Environment variables template
|
|
84
|
+
├── package.json # Dependencies and scripts
|
|
85
|
+
├── tailwind.config.js # Tailwind CSS configuration
|
|
86
|
+
├── tsconfig.json # TypeScript configuration
|
|
87
|
+
├── vite.config.ts # Vite build configuration
|
|
88
|
+
└── README.md # Project documentation
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Getting Started with Development
|
|
92
|
+
|
|
93
|
+
### Adding BlueCopa Components
|
|
94
|
+
|
|
95
|
+
The template includes @bluecopa/react components. Start building by importing and using them:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { SomeBlueCopaComponent } from '@bluecopa/react';
|
|
99
|
+
|
|
100
|
+
function MyComponent() {
|
|
101
|
+
return (
|
|
102
|
+
<div>
|
|
103
|
+
<SomeBlueCopaComponent />
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Adding UI Components
|
|
110
|
+
|
|
111
|
+
Use the included shadcn/ui components for consistent styling:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { Button } from '@/components/ui/button';
|
|
115
|
+
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
116
|
+
|
|
117
|
+
function Dashboard() {
|
|
118
|
+
return (
|
|
119
|
+
<Card>
|
|
120
|
+
<CardHeader>
|
|
121
|
+
<CardTitle>My Dashboard</CardTitle>
|
|
122
|
+
</CardHeader>
|
|
123
|
+
<CardContent>
|
|
124
|
+
<Button>Click me</Button>
|
|
125
|
+
</CardContent>
|
|
126
|
+
</Card>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Styling and Theming
|
|
132
|
+
|
|
133
|
+
- Modify `tailwind.config.js` for custom design tokens
|
|
134
|
+
- Update CSS variables in `src/index.css` for theme customization
|
|
135
|
+
- All shadcn/ui components support dark/light mode automatically
|
|
136
|
+
|
|
137
|
+
## Environment Configuration
|
|
138
|
+
|
|
139
|
+
Copy the included `.env.example` to `.env` and configure as needed:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
cp .env.example .env
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Available Scripts
|
|
146
|
+
|
|
147
|
+
- `npm run dev` - Start development server with hot reload
|
|
148
|
+
- `npm run build` - Build for production (TypeScript compilation + Vite build)
|
|
149
|
+
- `npm run preview` - Preview production build locally
|
|
150
|
+
- `npm run lint` - Run ESLint for code quality
|
|
151
|
+
- `npm run type-check` - Run TypeScript type checking without emitting files
|
|
152
|
+
|
|
153
|
+
## Technologies Used
|
|
154
|
+
|
|
155
|
+
- **React 18** - Modern React with concurrent features
|
|
156
|
+
- **TypeScript** - Full type safety and developer experience
|
|
157
|
+
- **Vite** - Fast build tool and development server
|
|
158
|
+
- **@bluecopa/react** - BlueCopa-specific React components
|
|
159
|
+
- **shadcn/ui** - High-quality, accessible component library
|
|
160
|
+
- **Radix UI** - Unstyled, accessible UI primitives
|
|
161
|
+
- **Tailwind CSS** - Utility-first CSS framework
|
|
162
|
+
- **Lucide React** - Beautiful, customizable icons
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { Command } = require('commander');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs-extra');
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const inquirer = require('inquirer');
|
|
8
|
+
const ora = require('ora');
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
const validatePackageName = require('validate-npm-package-name');
|
|
11
|
+
|
|
12
|
+
const program = new Command();
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.version('1.0.0')
|
|
16
|
+
.name('create-bluecopa-react-app')
|
|
17
|
+
.description('Create a new Bluecopa React application')
|
|
18
|
+
.argument('[project-name]', 'Name of the project')
|
|
19
|
+
.option('--typescript', 'Use TypeScript template', true)
|
|
20
|
+
.option('--no-typescript', 'Use JavaScript template')
|
|
21
|
+
.option('--skip-install', 'Skip package installation')
|
|
22
|
+
.action(async (projectName, options) => {
|
|
23
|
+
try {
|
|
24
|
+
await createApp(projectName, options);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error(chalk.red('Error creating app:'), error.message);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
async function createApp(projectName, options) {
|
|
32
|
+
let appName = projectName;
|
|
33
|
+
|
|
34
|
+
// If no project name provided, prompt for it
|
|
35
|
+
if (!appName) {
|
|
36
|
+
const answers = await inquirer.prompt([
|
|
37
|
+
{
|
|
38
|
+
type: 'input',
|
|
39
|
+
name: 'projectName',
|
|
40
|
+
message: 'What is your project name?',
|
|
41
|
+
validate: (input) => {
|
|
42
|
+
if (!input) return 'Project name is required';
|
|
43
|
+
const validation = validatePackageName(input);
|
|
44
|
+
if (!validation.validForNewPackages) {
|
|
45
|
+
return validation.errors?.[0] || validation.warnings?.[0] || 'Invalid package name';
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]);
|
|
51
|
+
appName = answers.projectName;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Validate project name
|
|
55
|
+
const validation = validatePackageName(appName);
|
|
56
|
+
if (!validation.validForNewPackages) {
|
|
57
|
+
console.error(chalk.red('Invalid project name:'), validation.errors?.[0] || validation.warnings?.[0]);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const targetDir = path.resolve(process.cwd(), appName);
|
|
62
|
+
|
|
63
|
+
// Check if directory already exists
|
|
64
|
+
if (fs.existsSync(targetDir)) {
|
|
65
|
+
const answers = await inquirer.prompt([
|
|
66
|
+
{
|
|
67
|
+
type: 'confirm',
|
|
68
|
+
name: 'overwrite',
|
|
69
|
+
message: `Directory ${appName} already exists. Overwrite?`,
|
|
70
|
+
default: false
|
|
71
|
+
}
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
if (!answers.overwrite) {
|
|
75
|
+
console.log(chalk.yellow('Operation cancelled.'));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
await fs.remove(targetDir);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log(chalk.blue(`Creating a new Bluecopa React app in ${chalk.green(targetDir)}`));
|
|
83
|
+
console.log();
|
|
84
|
+
|
|
85
|
+
// Create app
|
|
86
|
+
const spinner = ora('Creating project structure...').start();
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
await createProjectStructure(targetDir, appName, options);
|
|
90
|
+
spinner.succeed('Project structure created');
|
|
91
|
+
|
|
92
|
+
if (!options.skipInstall) {
|
|
93
|
+
spinner.start('Installing dependencies...');
|
|
94
|
+
await installDependencies(targetDir);
|
|
95
|
+
spinner.succeed('Dependencies installed');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
spinner.succeed(chalk.green('Success! Created ' + appName + ' at ' + targetDir));
|
|
99
|
+
|
|
100
|
+
console.log();
|
|
101
|
+
console.log('Inside that directory, you can run several commands:');
|
|
102
|
+
console.log();
|
|
103
|
+
console.log(chalk.cyan(' npm start'));
|
|
104
|
+
console.log(' Starts the development server.');
|
|
105
|
+
console.log();
|
|
106
|
+
console.log(chalk.cyan(' npm run build'));
|
|
107
|
+
console.log(' Bundles the app into static files for production.');
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(chalk.cyan(' npm test'));
|
|
110
|
+
console.log(' Starts the test runner.');
|
|
111
|
+
console.log();
|
|
112
|
+
console.log('We suggest that you begin by typing:');
|
|
113
|
+
console.log();
|
|
114
|
+
console.log(chalk.cyan(' cd'), appName);
|
|
115
|
+
console.log(chalk.cyan(' npm start'));
|
|
116
|
+
console.log();
|
|
117
|
+
console.log('Happy coding with Bluecopa! 🚀');
|
|
118
|
+
|
|
119
|
+
} catch (error) {
|
|
120
|
+
spinner.fail('Failed to create project');
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function createProjectStructure(targetDir, appName, options) {
|
|
126
|
+
const templateDir = path.join(__dirname, '../templates/basic');
|
|
127
|
+
|
|
128
|
+
// Create base directory
|
|
129
|
+
await fs.ensureDir(targetDir);
|
|
130
|
+
|
|
131
|
+
// Copy template files
|
|
132
|
+
await fs.copy(templateDir, targetDir);
|
|
133
|
+
|
|
134
|
+
// Update package.json with project name
|
|
135
|
+
const packageJsonPath = path.join(targetDir, 'package.json');
|
|
136
|
+
const packageJson = await fs.readJson(packageJsonPath);
|
|
137
|
+
packageJson.name = appName;
|
|
138
|
+
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
139
|
+
|
|
140
|
+
// Update index.html title if it exists
|
|
141
|
+
const indexHtmlPath = path.join(targetDir, 'public/index.html');
|
|
142
|
+
if (await fs.pathExists(indexHtmlPath)) {
|
|
143
|
+
let indexHtml = await fs.readFile(indexHtmlPath, 'utf8');
|
|
144
|
+
indexHtml = indexHtml.replace(/{{APP_NAME}}/g, appName);
|
|
145
|
+
await fs.writeFile(indexHtmlPath, indexHtml);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async function installDependencies(targetDir) {
|
|
150
|
+
try {
|
|
151
|
+
// Change to target directory and install
|
|
152
|
+
process.chdir(targetDir);
|
|
153
|
+
|
|
154
|
+
// Check if yarn is available, otherwise use npm
|
|
155
|
+
let packageManager = 'npm';
|
|
156
|
+
try {
|
|
157
|
+
execSync('yarn --version', { stdio: 'ignore' });
|
|
158
|
+
packageManager = 'yarn';
|
|
159
|
+
} catch {
|
|
160
|
+
// yarn not available, use npm
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const installCommand = packageManager === 'yarn' ? 'yarn install' : 'npm install';
|
|
164
|
+
execSync(installCommand, { stdio: 'inherit' });
|
|
165
|
+
|
|
166
|
+
} catch (error) {
|
|
167
|
+
throw new Error('Failed to install dependencies: ' + error.message);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-bluecopa-react-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI tool to create bluecopa React applications",
|
|
5
|
+
"main": "./bin/create-bluecopa-react-app.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-bluecopa-react-app": "./bin/create-bluecopa-react-app.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"bluecopa",
|
|
11
|
+
"react",
|
|
12
|
+
"cli",
|
|
13
|
+
"boilerplate",
|
|
14
|
+
"data-visualization",
|
|
15
|
+
"charts",
|
|
16
|
+
"tables"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"commander": "^11.1.0",
|
|
23
|
+
"fs-extra": "^11.2.0",
|
|
24
|
+
"chalk": "^4.1.2",
|
|
25
|
+
"inquirer": "^8.2.6",
|
|
26
|
+
"ora": "^5.4.1",
|
|
27
|
+
"validate-npm-package-name": "^5.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {},
|
|
30
|
+
"author": "Bluecopa UI Team",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/bluecopa/blui.git",
|
|
35
|
+
"directory": "packages/boilerplate/react"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# BlueCopa API Configuration
|
|
2
|
+
REACT_APP_API_BASE_URL=https://api.bluecopa.com
|
|
3
|
+
REACT_APP_API_KEY=your_api_key_here
|
|
4
|
+
|
|
5
|
+
# Environment
|
|
6
|
+
NODE_ENV=development
|
|
7
|
+
|
|
8
|
+
# Optional: Analytics and Monitoring
|
|
9
|
+
REACT_APP_SENTRY_DSN=your_sentry_dsn
|
|
10
|
+
REACT_APP_ANALYTICS_ID=your_analytics_id
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# BlueCopa Dashboard Template
|
|
2
|
+
|
|
3
|
+
A modern React dashboard template for BlueCopa applications built with TanStack Query, shadcn/ui, and Recharts.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Modern Tech Stack**: React 18, TypeScript, Vite
|
|
8
|
+
- 📊 **Data Fetching**: TanStack Query for server state management
|
|
9
|
+
- 🎨 **UI Components**: shadcn/ui with Radix UI primitives
|
|
10
|
+
- 📈 **Charts**: Recharts for beautiful data visualizations
|
|
11
|
+
- 🎯 **Type Safety**: Full TypeScript support
|
|
12
|
+
- 🔄 **Real-time Updates**: Automatic data refetching and caching
|
|
13
|
+
- 📱 **Responsive Design**: Mobile-first responsive layout
|
|
14
|
+
- 🌙 **Dark Mode**: Built-in dark mode support
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
1. **Install dependencies**:
|
|
19
|
+
```bash
|
|
20
|
+
npm install
|
|
21
|
+
# or
|
|
22
|
+
yarn install
|
|
23
|
+
# or
|
|
24
|
+
pnpm install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. **Start the development server**:
|
|
28
|
+
```bash
|
|
29
|
+
npm run dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. **Open your browser** and navigate to `http://localhost:5173`
|
|
33
|
+
|
|
34
|
+
## Project Structure
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
src/
|
|
38
|
+
├── components/ # Reusable UI components
|
|
39
|
+
│ ├── ui/ # shadcn/ui components
|
|
40
|
+
│ └── dashboard/ # Dashboard-specific components
|
|
41
|
+
├── lib/ # Utilities and helpers
|
|
42
|
+
├── pages/ # Page components
|
|
43
|
+
├── services/ # API services and data fetching
|
|
44
|
+
├── types/ # TypeScript type definitions
|
|
45
|
+
├── App.tsx # Main application component
|
|
46
|
+
└── main.tsx # Application entry point
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Components Overview
|
|
50
|
+
|
|
51
|
+
### Dashboard Components
|
|
52
|
+
|
|
53
|
+
- **MetricsOverview**: Key performance indicators and metrics cards
|
|
54
|
+
- **TransactionCharts**: Interactive charts showing sales data, payment methods, and analytics
|
|
55
|
+
- **TransactionTable**: Data table with transaction details and filters
|
|
56
|
+
|
|
57
|
+
### Features Demonstrated
|
|
58
|
+
|
|
59
|
+
1. **TanStack Query Integration**:
|
|
60
|
+
- Automatic caching and background updates
|
|
61
|
+
- Loading states and error handling
|
|
62
|
+
- Query invalidation and refetching
|
|
63
|
+
|
|
64
|
+
2. **Data Visualization**:
|
|
65
|
+
- Bar charts for category sales and state analytics
|
|
66
|
+
- Pie charts for payment method distribution
|
|
67
|
+
- Line charts for trend analysis
|
|
68
|
+
|
|
69
|
+
3. **Real Transaction Data**:
|
|
70
|
+
- Based on actual BlueCopa transaction dataset
|
|
71
|
+
- Proper data typing with TypeScript
|
|
72
|
+
- Mock API responses for development
|
|
73
|
+
|
|
74
|
+
## API Integration
|
|
75
|
+
|
|
76
|
+
The template includes a mock API service (`src/services/api.ts`) that demonstrates:
|
|
77
|
+
|
|
78
|
+
- Dataset queries for transaction data
|
|
79
|
+
- Metric queries for aggregated data
|
|
80
|
+
- User authentication and organization data
|
|
81
|
+
- Proper error handling and loading states
|
|
82
|
+
|
|
83
|
+
### Replacing Mock Data
|
|
84
|
+
|
|
85
|
+
To use real APIs, update the `BlueCOPAApi` service:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// In src/services/api.ts
|
|
89
|
+
export const BlueCOPAApi = {
|
|
90
|
+
getDataset: async (datasetId: string) => {
|
|
91
|
+
const response = await apiClient.get(`/datasets/${datasetId}`);
|
|
92
|
+
return response.data;
|
|
93
|
+
},
|
|
94
|
+
// ... other methods
|
|
95
|
+
};
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Customization
|
|
99
|
+
|
|
100
|
+
### Adding New Charts
|
|
101
|
+
|
|
102
|
+
1. Create a new component in `src/components/dashboard/`
|
|
103
|
+
2. Use Recharts components for visualization
|
|
104
|
+
3. Add TanStack Query for data fetching
|
|
105
|
+
4. Include proper TypeScript types
|
|
106
|
+
|
|
107
|
+
### Extending the API
|
|
108
|
+
|
|
109
|
+
1. Add new types to `src/types/index.ts`
|
|
110
|
+
2. Extend the API service in `src/services/api.ts`
|
|
111
|
+
3. Create corresponding UI components
|
|
112
|
+
4. Add new routes if needed
|
|
113
|
+
|
|
114
|
+
### Styling
|
|
115
|
+
|
|
116
|
+
The template uses Tailwind CSS with shadcn/ui design system:
|
|
117
|
+
|
|
118
|
+
- Modify `tailwind.config.js` for custom themes
|
|
119
|
+
- Update CSS variables in `src/index.css` for color schemes
|
|
120
|
+
- Use the `cn()` utility for conditional styling
|
|
121
|
+
|
|
122
|
+
## Data Types
|
|
123
|
+
|
|
124
|
+
The template includes comprehensive TypeScript types for BlueCopa data:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
interface TransactionRecord {
|
|
128
|
+
transaction_id: string;
|
|
129
|
+
transaction_day: string;
|
|
130
|
+
city: string;
|
|
131
|
+
category: string;
|
|
132
|
+
total_amount: number;
|
|
133
|
+
payment_method: string;
|
|
134
|
+
// ... other fields
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Development
|
|
139
|
+
|
|
140
|
+
### Available Scripts
|
|
141
|
+
|
|
142
|
+
- `npm run dev` - Start development server
|
|
143
|
+
- `npm run build` - Build for production
|
|
144
|
+
- `npm run preview` - Preview production build
|
|
145
|
+
- `npm run lint` - Run ESLint
|
|
146
|
+
- `npm run type-check` - Run TypeScript compiler
|
|
147
|
+
|
|
148
|
+
### Environment Variables
|
|
149
|
+
|
|
150
|
+
Create a `.env` file for configuration:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
REACT_APP_API_BASE_URL=https://api.bluecopa.com
|
|
154
|
+
REACT_APP_API_KEY=your_api_key
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Deployment
|
|
158
|
+
|
|
159
|
+
### Build for Production
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npm run build
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The built files will be in the `dist/` directory.
|
|
166
|
+
|
|
167
|
+
### Deploy to Vercel
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
vercel --prod
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Deploy to Netlify
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
netlify deploy --prod --dir=dist
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Technologies Used
|
|
180
|
+
|
|
181
|
+
- **React 18** - UI framework
|
|
182
|
+
- **TypeScript** - Type safety
|
|
183
|
+
- **Vite** - Build tool and dev server
|
|
184
|
+
- **TanStack Query** - Server state management
|
|
185
|
+
- **shadcn/ui** - UI component library
|
|
186
|
+
- **Radix UI** - Headless UI primitives
|
|
187
|
+
- **Recharts** - Chart library
|
|
188
|
+
- **Tailwind CSS** - Utility-first CSS framework
|
|
189
|
+
- **React Router** - Client-side routing
|
|
190
|
+
- **Axios** - HTTP client
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
1. Fork the repository
|
|
195
|
+
2. Create a feature branch
|
|
196
|
+
3. Make your changes
|
|
197
|
+
4. Add tests if applicable
|
|
198
|
+
5. Submit a pull request
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
This template is part of the BlueCopa platform and follows the project's licensing terms.
|
|
203
|
+
|
|
204
|
+
## Support
|
|
205
|
+
|
|
206
|
+
For questions and support:
|
|
207
|
+
- Check the [BlueCopa documentation](https://docs.bluecopa.com)
|
|
208
|
+
- Open an issue in the repository
|
|
209
|
+
- Contact the BlueCopa team
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
Built with ❤️ by the BlueCopa team
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>BlueCopa Dashboard</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|