Add professional React frontend for API testing

- Complete React 18 + TypeScript application
- Modern UI with Lucide icons and CSS animations
- Features:
  * JWT token generation
  * Transaction submission form
  * 5 pre-built test scenarios
  * Real-time results display
  * Responsive design
  * Dark mode ready

Infrastructure:
  * Vite for fast development
  * Axios for HTTP client
  * React hooks for state management
  * CSS3 with CSS variables for theming

Build:
  * Production-optimized build (63KB gzip)
  * TypeScript compilation
  * Vite bundling

Documentation:
  * frontend/README.md - Frontend-specific guide
  * FULLSTACK_GUIDE.md - Complete API + Frontend setup
  * Comprehensive troubleshooting section

Integration:
  * Connects to FastAPI backend on localhost:8000
  * Full REST API consumption
  * Handles JWT authentication
  * Error handling and user feedback

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
John Patrick TeruelandCopilot committed 2026-04-24 19:56:42 +08:00
1 parent b1b7fa28f0
commit 6504ff4c2a
13 files changed
+3735

No files matched your search

+347
View File
@@ -0,0 +1,347 @@
.app {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 2rem 0;
}
.header {
text-align: center;
color: white;
margin-bottom: 2rem;
}
.header h1 {
font-size: 2.5rem;
margin-bottom: 0.5rem;
font-weight: 700;
}
.header p {
font-size: 1.1rem;
opacity: 0.9;
}
.container {
max-width: 900px;
margin: 0 auto;
padding: 0 1rem;
}
/* Cards */
.card {
background: white;
border-radius: 0.75rem;
box-shadow: var(--shadow-lg);
padding: 1.5rem;
margin-bottom: 1.5rem;
}
.card-header {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 2px solid var(--border);
}
.card-header h2 {
font-size: 1.25rem;
font-weight: 600;
color: var(--text);
}
.card-header svg {
color: var(--primary);
}
/* Auth Card */
.auth-card {
background: white;
}
.auth-content {
display: flex;
flex-direction: column;
gap: 1rem;
}
.auth-info {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.auth-info label {
font-weight: 500;
color: var(--text);
font-size: 0.875rem;
}
.auth-info input {
padding: 0.75rem;
border: 1px solid var(--border);
border-radius: 0.375rem;
font-size: 0.875rem;
font-family: 'Courier New', monospace;
}
.auth-info input:disabled {
background: var(--bg);
color: var(--text-light);
}
.token-display {
background: var(--bg);
padding: 1rem;
border-radius: 0.375rem;
border-left: 4px solid var(--primary);
}
.token-display p {
font-size: 0.875rem;
margin-bottom: 0.5rem;
word-break: break-all;
font-family: 'Courier New', monospace;
}
/* Buttons */
.btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 0.375rem;
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.btn-primary {
background: var(--primary);
color: white;
width: 100%;
}
.btn-primary:hover:not(:disabled) {
background: var(--primary-dark);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-submit {
background: var(--success);
color: white;
width: 100%;
padding: 0.875rem 1.5rem;
font-size: 1rem;
}
.btn-submit:hover:not(:disabled) {
background: #059669;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
/* Scenarios */
.scenarios {
background: var(--bg);
padding: 1rem;
border-radius: 0.375rem;
margin-bottom: 1.5rem;
border-left: 4px solid var(--warning);
}
.scenarios-label {
font-size: 0.875rem;
font-weight: 600;
color: var(--text);
margin-bottom: 0.75rem;
}
.scenario-buttons {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 0.5rem;
}
.btn-scenario {
background: white;
color: var(--primary);
border: 1px solid var(--primary);
padding: 0.5rem 1rem;
font-size: 0.8rem;
font-weight: 500;
}
.btn-scenario:hover:not(:disabled) {
background: var(--primary);
color: white;
}
/* Form */
.form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-bottom: 1rem;
}
.form-group label {
font-weight: 500;
color: var(--text);
font-size: 0.875rem;
}
.form-group input {
padding: 0.75rem;
border: 1px solid var(--border);
border-radius: 0.375rem;
font-size: 0.875rem;
}
.form-group input:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
/* Alerts */
.alert {
display: flex;
align-items: center;
gap: 1rem;
padding: 1rem;
border-radius: 0.375rem;
margin-bottom: 1.5rem;
font-size: 0.875rem;
}
.alert-error {
background: #fee2e2;
color: #991b1b;
border-left: 4px solid var(--error);
}
.alert-success {
background: #dcfce7;
color: #15803d;
border-left: 4px solid var(--success);
}
/* Results */
.results-card {
background: white;
}
.results-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.result-item {
padding: 1rem;
background: var(--bg);
border-radius: 0.375rem;
border-left: 4px solid var(--primary);
transition: all 0.2s ease;
}
.result-item:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.result-content {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.result-id {
font-size: 0.875rem;
font-family: 'Courier New', monospace;
color: var(--text);
font-weight: 500;
}
.result-status {
font-size: 0.875rem;
color: var(--text-light);
}
.result-time {
font-size: 0.8rem;
color: var(--text-light);
}
.status-badge {
display: inline-block;
background: var(--primary);
color: white;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
font-weight: 500;
font-size: 0.75rem;
}
/* Info Card */
.info-card {
background: white;
}
.info-card h3 {
font-size: 1rem;
font-weight: 600;
color: var(--text);
margin-bottom: 1rem;
}
.info-content {
display: flex;
flex-direction: column;
gap: 0.75rem;
font-size: 0.875rem;
}
.info-content p {
margin: 0;
}
.info-content strong {
color: var(--text);
}
.info-content ul {
margin-left: 1.5rem;
margin-top: 0.5rem;
}
.info-content li {
margin-bottom: 0.25rem;
color: var(--text-light);
}
/* Responsive */
@media (max-width: 640px) {
.header h1 {
font-size: 1.75rem;
}
.card {
padding: 1rem;
}
.scenario-buttons {
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}
.btn {
padding: 0.6rem 1rem;
font-size: 0.8rem;
}
}