2026-02-15 15:03:43 +00:00
|
|
|
/**
|
2026-02-19 23:19:58 +00:00
|
|
|
* Developer Dashboard — API Keys & Webhooks (v0.102)
|
|
|
|
|
* Manages API keys and links to Swagger docs. Webhooks at /webhooks.
|
2026-02-15 15:03:43 +00:00
|
|
|
*/
|
2026-02-19 23:19:58 +00:00
|
|
|
import React, { useState, useEffect } from 'react';
|
2026-02-15 15:03:43 +00:00
|
|
|
import { Card, CardContent } from '../ui/card';
|
2026-01-07 09:31:02 +00:00
|
|
|
import { Button } from '../ui/button';
|
2026-02-10 21:59:51 +00:00
|
|
|
import { EmptyState } from '../ui/empty-state';
|
2026-02-19 23:19:58 +00:00
|
|
|
import { SwaggerUIDoc } from './SwaggerUI';
|
|
|
|
|
import { CreateAPIKeyModal } from './modals/CreateAPIKeyModal';
|
|
|
|
|
import { ConfirmationDialog } from '../ui/confirmation-dialog';
|
|
|
|
|
import {
|
|
|
|
|
ExternalLink,
|
|
|
|
|
Key,
|
|
|
|
|
Plus,
|
|
|
|
|
Trash2,
|
|
|
|
|
Loader2,
|
|
|
|
|
} from 'lucide-react';
|
|
|
|
|
import { developerService, type ApiKey } from '@/services/developerService';
|
|
|
|
|
import { useToast } from '@/components/feedback/ToastProvider';
|
2026-01-07 09:31:02 +00:00
|
|
|
|
|
|
|
|
export const DeveloperDashboardView: React.FC = () => {
|
2026-02-19 23:19:58 +00:00
|
|
|
const { addToast } = useToast();
|
|
|
|
|
const [keys, setKeys] = useState<ApiKey[]>([]);
|
|
|
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
|
const [showCreateModal, setShowCreateModal] = useState(false);
|
|
|
|
|
const [revokeId, setRevokeId] = useState<string | null>(null);
|
|
|
|
|
|
|
|
|
|
const fetchKeys = async () => {
|
|
|
|
|
setLoading(true);
|
|
|
|
|
try {
|
|
|
|
|
const list = await developerService.listKeys();
|
|
|
|
|
setKeys(list);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
addToast('Failed to load API keys', 'error');
|
|
|
|
|
setKeys([]);
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
void fetchKeys();
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const handleCreate = async (data: {
|
|
|
|
|
name: string;
|
|
|
|
|
scopes: string[];
|
|
|
|
|
}): Promise<{ key?: string; id: string; name: string; prefix: string }> => {
|
|
|
|
|
const created = await developerService.createKey(data);
|
|
|
|
|
await fetchKeys();
|
|
|
|
|
return {
|
|
|
|
|
key: created.key,
|
|
|
|
|
id: created.id,
|
|
|
|
|
name: created.name,
|
|
|
|
|
prefix: created.prefix,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleRevoke = async (id: string) => {
|
|
|
|
|
try {
|
|
|
|
|
await developerService.deleteKey(id);
|
|
|
|
|
await fetchKeys();
|
|
|
|
|
addToast('API key revoked', 'success');
|
|
|
|
|
} catch {
|
|
|
|
|
addToast('Failed to revoke API key', 'error');
|
|
|
|
|
} finally {
|
|
|
|
|
setRevokeId(null);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
return (
|
|
|
|
|
<div className="space-y-8 animate-fadeIn pb-20">
|
ui(tokens): migrate border-kodo-steel to border-border (86 files, 269 instances)
Replace legacy hardcoded border-kodo-steel (RGB 59,69,84, theme-unaware)
with semantic border-border token across 86 user-facing components.
Covers UI primitives (checkbox, badge, modal, table, textarea, alert,
radio-group, avatar), all modals, settings views, social features,
playlist views, inventory, chat, commerce, and cloud file browser.
Only story/test files retain the legacy token.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 23:07:00 +00:00
|
|
|
<div className="flex flex-col md:flex-row justify-between items-end gap-4 border-b border-border/50 pb-6">
|
2026-01-13 18:47:57 +00:00
|
|
|
<div>
|
2026-02-12 00:49:07 +00:00
|
|
|
<h1 className="text-3xl font-heading font-bold text-foreground mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
DEVELOPER PORTAL
|
|
|
|
|
</h1>
|
ui(tokens): migrate text-kodo-content-dim to text-muted-foreground (35 files, 160 instances)
Replace legacy hardcoded `text-kodo-content-dim` (Gray-400, theme-unaware)
with semantic `text-muted-foreground` across 35 user-facing components.
This ensures all secondary/muted text adapts correctly to light/dark theme
changes instead of staying fixed at a single gray value.
Covers: SearchBar, PlaylistsView, NotificationBell, TrackAnalyticsView,
LiveStreamDetailView, LicenceCard, FilePreviewCard, PasswordStrengthIndicator,
NotificationItem, TrackList, CourseCard, GroupCard, AchievementCard, XPBar,
EquipmentCard, SellerDashboardView, APIPlaygroundView, DeveloperDashboardView,
CreatorModal, AddToPlaylistModal, LicenceDetailsModal, QuizModal,
CertificateModal, FlashSaleModal, CreateAPIKeyModal, LyricsEditorModal,
WatermarkSettingsModal, ProfileXPView, LeaderboardView, PostCard,
ExploreView, FeedView, MessageSearch, TypingIndicator, PlaylistTrackItem.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 23:03:33 +00:00
|
|
|
<p className="text-muted-foreground font-mono text-sm">
|
2026-02-19 23:19:58 +00:00
|
|
|
API Keys & Webhooks — Manage your API keys and explore the docs.
|
2026-01-13 18:47:57 +00:00
|
|
|
</p>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-02-19 23:19:58 +00:00
|
|
|
<div className="flex gap-2">
|
|
|
|
|
<Button
|
|
|
|
|
variant="secondary"
|
|
|
|
|
icon={<ExternalLink className="w-4 h-4" />}
|
|
|
|
|
onClick={() => window.open('/webhooks', '_self')}
|
|
|
|
|
>
|
|
|
|
|
Manage Webhooks
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="default"
|
|
|
|
|
icon={<Plus className="w-4 h-4" />}
|
|
|
|
|
onClick={() => setShowCreateModal(true)}
|
|
|
|
|
>
|
|
|
|
|
Create API Key
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-02-15 15:03:43 +00:00
|
|
|
<Card variant="default">
|
|
|
|
|
<CardContent className="pt-6">
|
2026-02-19 23:19:58 +00:00
|
|
|
<h3 className="text-lg font-bold text-foreground mb-4 flex items-center gap-2">
|
|
|
|
|
<Key className="w-5 h-5" />
|
|
|
|
|
API Keys
|
|
|
|
|
</h3>
|
|
|
|
|
{loading ? (
|
|
|
|
|
<div className="flex items-center justify-center py-12">
|
|
|
|
|
<Loader2 className="w-8 h-8 animate-spin text-muted-foreground" />
|
|
|
|
|
</div>
|
|
|
|
|
) : keys.length === 0 ? (
|
|
|
|
|
<EmptyState
|
|
|
|
|
icon={<Key className="w-12 h-12 text-muted-foreground" />}
|
|
|
|
|
title="No API keys yet"
|
|
|
|
|
description="Create an API key to authenticate your apps and scripts. Use the X-API-Key header or Authorization: Bearer <key>."
|
|
|
|
|
variant="card"
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="space-y-3">
|
|
|
|
|
{keys.map((k) => (
|
|
|
|
|
<div
|
|
|
|
|
key={k.id}
|
fix: stabilize builds, tests, and lint across all stacks
Complete stabilization pass bringing all 3 stacks to green:
Frontend (apps/web/):
- Fix TypeScript nullability in useSeason.ts, useTimeOfDay.ts hooks
- Disable no-undef in ESLint config (TypeScript handles it; JSX misidentified)
- Rename 306 story imports from @storybook/react to @storybook/react-vite
- Fix conditional hook call in useMediaQuery.ts useIsTablet
- Move useQuery to top of LoginPage.tsx component
- Remove useless try/catch in GearFormModal.tsx
- Fix stale closure in ResetPasswordPage.tsx handleChange
- Make Storybook decorators (withRouter, withQueryClient, withToast, withAudio)
no-ops since global StorybookDecorator already provides these — prevents
nested Router / duplicate provider crashes in vitest-browser
- Fix nested MemoryRouter in 3 page stories (TrackDetail, PlaylistDetail, UserProfile)
- Update i18n initialization in test setup (await init before changeLanguage)
- Update ~30 test assertions from English to French to match i18n translations
- Update test assertions to match SUMI V3 design changes (shadow vs border)
- Fix remaining story type errors (PlayerError, PlaylistBatchActions,
TrackFilters, VirtualizedChatMessages)
Backend (veza-backend-api/):
- Fix response_test.go RespondWithAppError signature (2 args, not 3)
- Fix TestErrorContractAuthEndpoints expected error codes
(ErrCodeUnauthorized vs ErrCodeInvalidCredentials)
- Fix TestTrackHandler_GetTrackLikes_Success missing auth middleware setup
- Fix TestPlaybackAnalyticsService_GetTrackStats k-anonymity threshold
(needs 5 unique users, not 1)
- Replace NOW() PostgreSQL function with time.Now() parameter in marketplace
service for SQLite test compatibility
- Add missing AutoMigrate entries in marketplace_test.go
(ProductImage, ProductPreview, ProductLicense, ProductReview)
Results:
- Frontend TypeCheck: 617 errors -> 0 errors
- Frontend ESLint: 349 errors -> 0 errors
- Frontend Vitest: 196 failing tests -> 1 skipped (3396/3397 passing)
- Backend go vet: 1 error -> 0 errors
- Backend tests: 5 failing -> all 13 packages passing
- Rust: 150/150 tests passing (unchanged)
- Storybook audit: 0 errors across 1244 stories
Triage report: docs/TRIAGE_REPORT.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 14:48:07 +00:00
|
|
|
className="flex items-center justify-between p-4 rounded-lg shadow-[0_0_8px_rgba(26,26,30,0.05)] bg-background/30 hover:bg-foreground/5 transition-colors"
|
2026-02-19 23:19:58 +00:00
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
<div className="font-medium text-foreground">{k.name}</div>
|
|
|
|
|
<div className="text-sm font-mono text-muted-foreground">
|
|
|
|
|
{k.prefix}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="text-xs text-muted-foreground mt-1">
|
|
|
|
|
Created {k.created}
|
|
|
|
|
{k.lastUsed !== 'Never' && ` · Last used ${k.lastUsed}`}
|
|
|
|
|
</div>
|
|
|
|
|
{k.scopes.length > 0 && (
|
|
|
|
|
<div className="flex gap-1 mt-2 flex-wrap">
|
|
|
|
|
{k.scopes.map((s) => (
|
|
|
|
|
<span
|
|
|
|
|
key={s}
|
|
|
|
|
className="text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground"
|
|
|
|
|
>
|
|
|
|
|
{s}
|
|
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="icon"
|
|
|
|
|
className="text-destructive hover:bg-destructive/10"
|
|
|
|
|
onClick={() => setRevokeId(k.id)}
|
|
|
|
|
icon={<Trash2 className="w-4 h-4" />}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-15 15:03:43 +00:00
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
<Card variant="default" className="p-0 overflow-hidden bg-background/80">
|
|
|
|
|
<SwaggerUIDoc useIframe={false} />
|
|
|
|
|
</Card>
|
2026-02-19 23:19:58 +00:00
|
|
|
|
|
|
|
|
{showCreateModal && (
|
|
|
|
|
<CreateAPIKeyModal
|
|
|
|
|
onClose={() => setShowCreateModal(false)}
|
|
|
|
|
onCreate={handleCreate}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<ConfirmationDialog
|
|
|
|
|
open={!!revokeId}
|
|
|
|
|
onClose={() => setRevokeId(null)}
|
|
|
|
|
onConfirm={() => revokeId && handleRevoke(revokeId)}
|
|
|
|
|
title="Revoke API key"
|
|
|
|
|
description="This will immediately invalidate the key. Any apps using it will stop working."
|
|
|
|
|
confirmLabel="Revoke"
|
|
|
|
|
variant="destructive"
|
|
|
|
|
/>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|