auramaxx 0.0.1
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/LICENSE +26 -0
- package/README.md +77 -0
- package/apps/desktop-electron/main.js +428 -0
- package/bin/auramaxx.js +1063 -0
- package/docs/ADAPTERS.md +466 -0
- package/docs/AGENT_SETUP.md +159 -0
- package/docs/API.md +127 -0
- package/docs/APPS.md +199 -0
- package/docs/ARCHITECTURE.md +235 -0
- package/docs/AUTH.md +318 -0
- package/docs/BEST-PRACTICES.md +82 -0
- package/docs/CLI.md +141 -0
- package/docs/DESKTOP_ELECTRON.md +26 -0
- package/docs/DEVELOPING-APPS.md +453 -0
- package/docs/MCP.md +122 -0
- package/docs/PACKAGING_POLICY.md +19 -0
- package/docs/PERMISSION.md +137 -0
- package/docs/PROTOCOL.md +142 -0
- package/docs/README.md +50 -0
- package/docs/SKILLS.md +132 -0
- package/docs/TROUBLESHOOTING.md +376 -0
- package/docs/WORKSPACE.md +673 -0
- package/docs/agent-auth.md +14 -0
- package/docs/api/authentication.md +79 -0
- package/docs/api/secrets/api-keys.md +28 -0
- package/docs/api/secrets/credentials.md +80 -0
- package/docs/api/secrets/sharing.md +48 -0
- package/docs/api/system.md +41 -0
- package/docs/api/wallets/apps-strategies.md +66 -0
- package/docs/api/wallets/core.md +46 -0
- package/docs/api/wallets/data-portfolio.md +42 -0
- package/docs/aura-file.md +48 -0
- package/docs/core-concepts/FEATURES.md +114 -0
- package/docs/credentials.md +120 -0
- package/docs/external/HOW_TO_AURAMAXX/GETTING_SECRETS.md +33 -0
- package/docs/external/HOW_TO_AURAMAXX/README.md +45 -0
- package/docs/external/getting-started.md +10 -0
- package/docs/external/overview.md +19 -0
- package/docs/external/persona-paths.md +7 -0
- package/docs/external/share-secret.md +76 -0
- package/docs/external/why-aura.md +7 -0
- package/docs/security.md +227 -0
- package/docs/templates/RELEASE_NOTES_TEMPLATE.md +22 -0
- package/docs/wallet/AI.md +508 -0
- package/docs/wallet/DEVELOPING-STRATEGIES.md +713 -0
- package/docs/wallet/README.md +47 -0
- package/docs/wallet/STRATEGY.md +89 -0
- package/next.config.ts +28 -0
- package/package.json +167 -0
- package/postcss.config.mjs +8 -0
- package/prisma/migrations/20260214170000_baseline/migration.sql +511 -0
- package/prisma/migrations/20260216214537_add_passkey_model/migration.sql +18 -0
- package/prisma/migrations/20260217150500_add_credential_access_audit/migration.sql +31 -0
- package/prisma/migrations/20260222090000_update_admin_ttl_default/migration.sql +10 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +447 -0
- package/public/logo.webp +0 -0
- package/scripts/add-app.js +245 -0
- package/server/abi/SwapHelper.json +438 -0
- package/server/cli/approval.ts +447 -0
- package/server/cli/commands/actions.ts +474 -0
- package/server/cli/commands/api.ts +220 -0
- package/server/cli/commands/apikey.ts +277 -0
- package/server/cli/commands/app.ts +204 -0
- package/server/cli/commands/auth.ts +464 -0
- package/server/cli/commands/cron.ts +24 -0
- package/server/cli/commands/diary.ts +274 -0
- package/server/cli/commands/doctor.ts +1247 -0
- package/server/cli/commands/env.ts +476 -0
- package/server/cli/commands/experimental.ts +69 -0
- package/server/cli/commands/init.ts +798 -0
- package/server/cli/commands/lock.ts +157 -0
- package/server/cli/commands/mcp.ts +285 -0
- package/server/cli/commands/quickhack.ts +86 -0
- package/server/cli/commands/release-check.ts +231 -0
- package/server/cli/commands/restore.ts +314 -0
- package/server/cli/commands/service.ts +320 -0
- package/server/cli/commands/shell-hook.ts +512 -0
- package/server/cli/commands/skill.ts +216 -0
- package/server/cli/commands/start.ts +139 -0
- package/server/cli/commands/status.ts +59 -0
- package/server/cli/commands/stop.ts +36 -0
- package/server/cli/commands/token.ts +180 -0
- package/server/cli/commands/unlock.ts +50 -0
- package/server/cli/commands/vault.ts +1323 -0
- package/server/cli/commands/wallet.ts +209 -0
- package/server/cli/index.ts +280 -0
- package/server/cli/lib/approval-poll.ts +94 -0
- package/server/cli/lib/aura-parser.ts +64 -0
- package/server/cli/lib/credential-create.ts +74 -0
- package/server/cli/lib/credential-resolve.ts +280 -0
- package/server/cli/lib/dotenv-migrate.ts +116 -0
- package/server/cli/lib/dotenv-parser.ts +146 -0
- package/server/cli/lib/escalation.ts +57 -0
- package/server/cli/lib/http.ts +91 -0
- package/server/cli/lib/init-steps.ts +76 -0
- package/server/cli/lib/local-agent-trust.ts +45 -0
- package/server/cli/lib/lock-unlock-helper.ts +71 -0
- package/server/cli/lib/process.ts +162 -0
- package/server/cli/lib/prompt.ts +294 -0
- package/server/cli/lib/theme.ts +240 -0
- package/server/cli/socket.ts +579 -0
- package/server/cli/transport-client.ts +50 -0
- package/server/cron/index.ts +137 -0
- package/server/cron/job.ts +31 -0
- package/server/cron/jobs/balance-sync.ts +436 -0
- package/server/cron/jobs/incoming-scan.ts +506 -0
- package/server/cron/jobs/native-price.ts +70 -0
- package/server/cron/jobs/orphan-cleanup.ts +40 -0
- package/server/cron/jobs/strategy-runner.ts +175 -0
- package/server/cron/scheduler.ts +125 -0
- package/server/index.ts +420 -0
- package/server/lib/adapters/factory.ts +119 -0
- package/server/lib/adapters/index.ts +19 -0
- package/server/lib/adapters/router.ts +297 -0
- package/server/lib/adapters/telegram.ts +645 -0
- package/server/lib/adapters/types.ts +89 -0
- package/server/lib/adapters/webhook.ts +95 -0
- package/server/lib/address.ts +49 -0
- package/server/lib/agent-auth/contracts.ts +1194 -0
- package/server/lib/agent-profiles.ts +419 -0
- package/server/lib/ai.ts +285 -0
- package/server/lib/api-registry/contracts.ts +86 -0
- package/server/lib/api-registry/validation.ts +172 -0
- package/server/lib/apikey-migration.ts +258 -0
- package/server/lib/app-installer.ts +505 -0
- package/server/lib/app-tokens.ts +247 -0
- package/server/lib/approval-link.ts +27 -0
- package/server/lib/auth.ts +314 -0
- package/server/lib/auto-execute.ts +160 -0
- package/server/lib/batch.ts +242 -0
- package/server/lib/cold.ts +1048 -0
- package/server/lib/config.ts +408 -0
- package/server/lib/credential-access-audit.ts +85 -0
- package/server/lib/credential-access-policy.ts +111 -0
- package/server/lib/credential-health.ts +343 -0
- package/server/lib/credential-import.ts +608 -0
- package/server/lib/credential-scope.ts +102 -0
- package/server/lib/credential-shares.ts +190 -0
- package/server/lib/credential-transport.ts +533 -0
- package/server/lib/credential-vault.ts +77 -0
- package/server/lib/credentials.ts +422 -0
- package/server/lib/crypto.ts +8 -0
- package/server/lib/db.ts +58 -0
- package/server/lib/defaults.ts +386 -0
- package/server/lib/dex/index.ts +80 -0
- package/server/lib/dex/relay.ts +235 -0
- package/server/lib/dex/types.ts +59 -0
- package/server/lib/dex/uniswap.ts +370 -0
- package/server/lib/diary.ts +34 -0
- package/server/lib/dont-ask-again-policy.ts +41 -0
- package/server/lib/e2e-agent/artifacts.ts +36 -0
- package/server/lib/e2e-agent/contracts.ts +112 -0
- package/server/lib/e2e-agent/validation.ts +135 -0
- package/server/lib/encrypt.ts +114 -0
- package/server/lib/error.ts +20 -0
- package/server/lib/events.ts +217 -0
- package/server/lib/feature-flags.ts +93 -0
- package/server/lib/hot.ts +357 -0
- package/server/lib/human-action-summary.ts +80 -0
- package/server/lib/key-fingerprint.ts +28 -0
- package/server/lib/logger.ts +340 -0
- package/server/lib/network.ts +137 -0
- package/server/lib/notifications.ts +230 -0
- package/server/lib/oauth2-refresh.ts +241 -0
- package/server/lib/oursecret.ts +71 -0
- package/server/lib/passkey-credential.ts +360 -0
- package/server/lib/passkey.ts +68 -0
- package/server/lib/permissions.ts +299 -0
- package/server/lib/pino.ts +24 -0
- package/server/lib/policy-preview.ts +138 -0
- package/server/lib/price.ts +338 -0
- package/server/lib/prices.ts +34 -0
- package/server/lib/project-scope.ts +297 -0
- package/server/lib/resolve-action.ts +328 -0
- package/server/lib/resolve.ts +36 -0
- package/server/lib/secret-gist-share.ts +296 -0
- package/server/lib/sessions.ts +634 -0
- package/server/lib/socket-path.ts +56 -0
- package/server/lib/solana/connection.ts +26 -0
- package/server/lib/solana/jupiter.ts +128 -0
- package/server/lib/solana/transfer.ts +108 -0
- package/server/lib/solana/wallet.ts +136 -0
- package/server/lib/strategy/emits.ts +21 -0
- package/server/lib/strategy/engine.ts +1305 -0
- package/server/lib/strategy/executor.ts +115 -0
- package/server/lib/strategy/hook-context.ts +159 -0
- package/server/lib/strategy/hooks.ts +990 -0
- package/server/lib/strategy/index.ts +28 -0
- package/server/lib/strategy/installer.ts +305 -0
- package/server/lib/strategy/loader.ts +256 -0
- package/server/lib/strategy/message.ts +237 -0
- package/server/lib/strategy/repository.ts +218 -0
- package/server/lib/strategy/session-logger.ts +693 -0
- package/server/lib/strategy/sources.ts +288 -0
- package/server/lib/strategy/state.ts +189 -0
- package/server/lib/strategy/templates.ts +403 -0
- package/server/lib/strategy/tick.ts +404 -0
- package/server/lib/strategy/types.ts +230 -0
- package/server/lib/swap.ts +3 -0
- package/server/lib/temp.ts +86 -0
- package/server/lib/token-metadata.ts +86 -0
- package/server/lib/token-safety.ts +200 -0
- package/server/lib/token-search.ts +444 -0
- package/server/lib/totp.ts +194 -0
- package/server/lib/transactions.ts +123 -0
- package/server/lib/transport.ts +84 -0
- package/server/lib/txhistory/decoder.ts +262 -0
- package/server/lib/txhistory/enricher.ts +652 -0
- package/server/lib/txhistory/index.ts +391 -0
- package/server/lib/txhistory/signatures.ts +59 -0
- package/server/lib/update-check.ts +35 -0
- package/server/lib/verified-summary.ts +414 -0
- package/server/lib/view-registry.ts +80 -0
- package/server/mcp/profile-policy.ts +30 -0
- package/server/mcp/server.ts +1589 -0
- package/server/mcp/tools.ts +276 -0
- package/server/middleware/auth.ts +119 -0
- package/server/middleware/requestLogger.ts +84 -0
- package/server/routes/actions.ts +539 -0
- package/server/routes/adapters.ts +711 -0
- package/server/routes/addressbook.ts +113 -0
- package/server/routes/ai.ts +34 -0
- package/server/routes/apikeys.ts +343 -0
- package/server/routes/apps.ts +601 -0
- package/server/routes/auth.ts +406 -0
- package/server/routes/backup.ts +404 -0
- package/server/routes/batch.ts +270 -0
- package/server/routes/bookmarks.ts +162 -0
- package/server/routes/credential-shares.ts +380 -0
- package/server/routes/credential-vaults.ts +159 -0
- package/server/routes/credentials.ts +1782 -0
- package/server/routes/dashboard.ts +97 -0
- package/server/routes/defaults.ts +124 -0
- package/server/routes/flags.ts +11 -0
- package/server/routes/fund.ts +225 -0
- package/server/routes/heartbeat.ts +375 -0
- package/server/routes/import.ts +364 -0
- package/server/routes/launch.ts +665 -0
- package/server/routes/lock.ts +54 -0
- package/server/routes/logs.ts +68 -0
- package/server/routes/nuke.ts +111 -0
- package/server/routes/passkey-credentials.ts +99 -0
- package/server/routes/passkey.ts +366 -0
- package/server/routes/portfolio.ts +217 -0
- package/server/routes/price.ts +63 -0
- package/server/routes/resolve.ts +31 -0
- package/server/routes/security.ts +45 -0
- package/server/routes/send-evm.ts +241 -0
- package/server/routes/send-solana.ts +281 -0
- package/server/routes/send.ts +178 -0
- package/server/routes/setup.ts +210 -0
- package/server/routes/strategy.ts +894 -0
- package/server/routes/swap-evm.ts +352 -0
- package/server/routes/swap-solana.ts +176 -0
- package/server/routes/swap.ts +356 -0
- package/server/routes/token.ts +247 -0
- package/server/routes/unlock.ts +467 -0
- package/server/routes/views.ts +41 -0
- package/server/routes/wallet-assets.ts +361 -0
- package/server/routes/wallet-transactions.ts +515 -0
- package/server/routes/wallet.ts +709 -0
- package/server/types.ts +146 -0
- package/shared/credential-field-schema.ts +248 -0
- package/skills/auramaxx/HEARTBEAT.md +78 -0
- package/skills/auramaxx/SKILL.md +745 -0
- package/skills/auramaxx/docs/AGENT_SETUP.md +155 -0
- package/skills/auramaxx/docs/API.md +127 -0
- package/skills/auramaxx/docs/AUTH.md +318 -0
- package/skills/auramaxx/docs/CLI.md +130 -0
- package/skills/auramaxx/docs/MCP.md +122 -0
- package/skills/auramaxx/docs/TROUBLESHOOTING.md +357 -0
- package/skills/auramaxx/docs/WORKSPACE.md +673 -0
- package/skills/auramaxx/docs/security.md +227 -0
- package/skills/task-lifecycle/SKILL.md +378 -0
- package/src/app/api/[...doc]/page.tsx +36 -0
- package/src/app/api/agent-requests/route.ts +30 -0
- package/src/app/api/apps/install/route.ts +132 -0
- package/src/app/api/apps/manifests/route.ts +16 -0
- package/src/app/api/apps/static/[...path]/route.ts +57 -0
- package/src/app/api/docs/plain/route.ts +74 -0
- package/src/app/api/events/route.ts +92 -0
- package/src/app/api/page.tsx +290 -0
- package/src/app/api/workspace/[id]/apps/[wid]/route.ts +119 -0
- package/src/app/api/workspace/[id]/apps/route.ts +81 -0
- package/src/app/api/workspace/[id]/export/route.ts +67 -0
- package/src/app/api/workspace/[id]/route.ts +168 -0
- package/src/app/api/workspace/auth.ts +40 -0
- package/src/app/api/workspace/config/route.ts +121 -0
- package/src/app/api/workspace/import/route.ts +127 -0
- package/src/app/api/workspace/route.ts +116 -0
- package/src/app/app-legacy-do-not-use/page.tsx +2245 -0
- package/src/app/apple-icon.png +0 -0
- package/src/app/approve/[actionId]/page.tsx +409 -0
- package/src/app/docs/DocsPageContent.tsx +269 -0
- package/src/app/docs/[...doc]/page.tsx +41 -0
- package/src/app/docs/page.tsx +38 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +819 -0
- package/src/app/health/page.tsx +5 -0
- package/src/app/hello/page.tsx +102 -0
- package/src/app/icon.png +0 -0
- package/src/app/layout.tsx +39 -0
- package/src/app/page.tsx +1964 -0
- package/src/app/privacy/page.tsx +63 -0
- package/src/app/providers.tsx +87 -0
- package/src/app/share/[token]/page.tsx +295 -0
- package/src/app/terms/page.tsx +80 -0
- package/src/components/ChainSelector.tsx +44 -0
- package/src/components/HumanActionBar.tsx +697 -0
- package/src/components/NotificationDrawer.tsx +387 -0
- package/src/components/PasskeyEnrollmentPrompt.tsx +235 -0
- package/src/components/apps/AgentKeysApp.tsx +490 -0
- package/src/components/apps/App.tsx +153 -0
- package/src/components/apps/AppGrid.tsx +15 -0
- package/src/components/apps/DetailedAddressDrawer.tsx +325 -0
- package/src/components/apps/DraggableApp.tsx +562 -0
- package/src/components/apps/IFrameApp.tsx +73 -0
- package/src/components/apps/LogsApp.tsx +360 -0
- package/src/components/apps/SendApp.tsx +394 -0
- package/src/components/apps/SetupWizardApp.tsx +1004 -0
- package/src/components/apps/SystemDefaultsApp.tsx +845 -0
- package/src/components/apps/ThirdPartyApp.tsx +428 -0
- package/src/components/apps/TokenApp.tsx +319 -0
- package/src/components/apps/TransactionsApp.tsx +438 -0
- package/src/components/apps/WalletDetailApp.tsx +1505 -0
- package/src/components/apps/index.ts +13 -0
- package/src/components/design-system/Button.tsx +88 -0
- package/src/components/design-system/ChainIndicator.tsx +65 -0
- package/src/components/design-system/ChainSelector.tsx +147 -0
- package/src/components/design-system/ConfirmationModal.tsx +107 -0
- package/src/components/design-system/ConfirmationPopover.tsx +81 -0
- package/src/components/design-system/DownloadButton.tsx +149 -0
- package/src/components/design-system/Drawer.tsx +133 -0
- package/src/components/design-system/FilterDropdown.tsx +183 -0
- package/src/components/design-system/ItemPicker.tsx +157 -0
- package/src/components/design-system/Modal.tsx +296 -0
- package/src/components/design-system/Popover.tsx +142 -0
- package/src/components/design-system/TextInput.tsx +85 -0
- package/src/components/design-system/Toggle.tsx +65 -0
- package/src/components/design-system/TyvekCollapsibleSection.tsx +55 -0
- package/src/components/design-system/index.ts +14 -0
- package/src/components/docs/ClientSideMarkdown.tsx +51 -0
- package/src/components/docs/DocsSearchBar.tsx +118 -0
- package/src/components/docs/DocsThemeToggle.tsx +38 -0
- package/src/components/docs/PersistentDocGroup.tsx +91 -0
- package/src/components/docs/ShareUrlButton.tsx +33 -0
- package/src/components/docs/SidebarScrollMemory.tsx +56 -0
- package/src/components/health/CredentialHealthDashboard.tsx +214 -0
- package/src/components/icons/ChainIcons.tsx +72 -0
- package/src/components/layout/AppStoreDrawer.tsx +369 -0
- package/src/components/layout/ContentArea.tsx +21 -0
- package/src/components/layout/CreateViewModal.tsx +88 -0
- package/src/components/layout/LeftRail.tsx +114 -0
- package/src/components/layout/TabBar.tsx +284 -0
- package/src/components/layout/WalletSidebar.tsx +1030 -0
- package/src/components/layout/index.ts +6 -0
- package/src/components/marketing/AuraMaxxSpecOverlay.tsx +653 -0
- package/src/components/marketing/DeviceMorphExperience.tsx +216 -0
- package/src/components/vault/ApiKeysConsole.tsx +1272 -0
- package/src/components/vault/AuditConsole.tsx +600 -0
- package/src/components/vault/CredentialDetail.tsx +625 -0
- package/src/components/vault/CredentialEmpty.tsx +55 -0
- package/src/components/vault/CredentialField.tsx +583 -0
- package/src/components/vault/CredentialForm.tsx +1484 -0
- package/src/components/vault/CredentialList.tsx +265 -0
- package/src/components/vault/CredentialRow.tsx +130 -0
- package/src/components/vault/CredentialShareModal.tsx +273 -0
- package/src/components/vault/CredentialVault.tsx +1662 -0
- package/src/components/vault/CredentialWalletWidget.tsx +103 -0
- package/src/components/vault/DocsConsole.tsx +113 -0
- package/src/components/vault/ImportCredentialsModal.tsx +578 -0
- package/src/components/vault/LargeTypeModal.tsx +88 -0
- package/src/components/vault/PasswordGenerator.tsx +232 -0
- package/src/components/vault/TOTPDisplay.tsx +108 -0
- package/src/components/vault/TotpSetupPanel.tsx +198 -0
- package/src/components/vault/VaultSidebar.tsx +881 -0
- package/src/components/vault/credentialFormName.ts +91 -0
- package/src/components/vault/hooks/useVaultKeyboardShortcuts.ts +69 -0
- package/src/components/vault/types.ts +56 -0
- package/src/context/AuthContext.tsx +365 -0
- package/src/context/PriceContext.tsx +113 -0
- package/src/context/ThemeContext.tsx +164 -0
- package/src/context/WebSocketContext.tsx +269 -0
- package/src/context/WorkspaceContext.tsx +668 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useAgentActions.ts +552 -0
- package/src/hooks/useBalance.ts +103 -0
- package/src/hooks/useBalances.ts +129 -0
- package/src/hooks/useTheme.ts +156 -0
- package/src/instrumentation.ts +12 -0
- package/src/lib/api-docs.ts +154 -0
- package/src/lib/api.ts +474 -0
- package/src/lib/app-loader.ts +148 -0
- package/src/lib/app-registry.ts +178 -0
- package/src/lib/app-sdk.ts +157 -0
- package/src/lib/audit-console-adapter.ts +151 -0
- package/src/lib/auth-client.ts +75 -0
- package/src/lib/config.ts +74 -0
- package/src/lib/credential-field-schema.ts +11 -0
- package/src/lib/crypto.ts +112 -0
- package/src/lib/db.ts +21 -0
- package/src/lib/docs.ts +544 -0
- package/src/lib/events.ts +363 -0
- package/src/lib/pino.ts +24 -0
- package/src/lib/theme-handlers.ts +168 -0
- package/src/lib/theme.ts +351 -0
- package/src/lib/tokenData.ts +378 -0
- package/src/lib/totp-import.ts +57 -0
- package/src/lib/vault-crypto.ts +129 -0
- package/src/lib/view-registry.ts +57 -0
- package/src/lib/websocket-server.ts +302 -0
- package/src/lib/websocket-setup.ts +79 -0
- package/src/lib/wordlist.ts +2050 -0
- package/src/lib/workspace-handlers.ts +285 -0
- package/start.sh +170 -0
- package/tailwind.config.ts +99 -0
- package/tsconfig.json +42 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState, useMemo } from 'react';
|
|
4
|
+
import { Box, Plus, Loader2, Shield, Check, Download } from 'lucide-react';
|
|
5
|
+
import { Drawer, Button, Popover, TextInput } from '@/components/design-system';
|
|
6
|
+
import { APP_TYPES, type AppDefinition } from '@/lib/app-registry';
|
|
7
|
+
import type { AppManifest } from '@/lib/app-loader';
|
|
8
|
+
import { api, Api } from '@/lib/api';
|
|
9
|
+
|
|
10
|
+
interface AppStoreDrawerProps {
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
onAddApp: (appType: string, config?: Record<string, unknown>) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const CATEGORIES = [
|
|
17
|
+
{ id: 'all', label: 'ALL' },
|
|
18
|
+
{ id: 'builtin', label: 'BUILT-IN' },
|
|
19
|
+
{ id: 'installed', label: 'INSTALLED' },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export function AppStoreDrawer({ isOpen, onClose, onAddApp }: AppStoreDrawerProps) {
|
|
23
|
+
const [manifests, setManifests] = useState<AppManifest[]>([]);
|
|
24
|
+
const [loading, setLoading] = useState(false);
|
|
25
|
+
const [activeCategory, setActiveCategory] = useState('all');
|
|
26
|
+
|
|
27
|
+
// Install from URL state
|
|
28
|
+
const [installSource, setInstallSource] = useState('');
|
|
29
|
+
const [installing, setInstalling] = useState(false);
|
|
30
|
+
const [installError, setInstallError] = useState<string | null>(null);
|
|
31
|
+
const [installSuccess, setInstallSuccess] = useState<string | null>(null);
|
|
32
|
+
|
|
33
|
+
// Approval popover state
|
|
34
|
+
const [approvalApp, setApprovalApp] = useState<AppManifest | null>(null);
|
|
35
|
+
const [approvalAnchor, setApprovalAnchor] = useState<HTMLElement | null>(null);
|
|
36
|
+
const [approving, setApproving] = useState(false);
|
|
37
|
+
const [approvalError, setApprovalError] = useState<string | null>(null);
|
|
38
|
+
|
|
39
|
+
// Fetch third-party app manifests when drawer opens
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!isOpen) return;
|
|
42
|
+
|
|
43
|
+
setLoading(true);
|
|
44
|
+
api.get<{ success: boolean; manifests: AppManifest[] }>(Api.Workspace, '/apps/manifests')
|
|
45
|
+
.then(data => {
|
|
46
|
+
if (data.success) setManifests(data.manifests);
|
|
47
|
+
})
|
|
48
|
+
.catch(err => console.error('Failed to load app manifests:', err))
|
|
49
|
+
.finally(() => setLoading(false));
|
|
50
|
+
}, [isOpen]);
|
|
51
|
+
|
|
52
|
+
// Close approval popover when drawer closes
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!isOpen) {
|
|
55
|
+
setApprovalApp(null);
|
|
56
|
+
setApprovalAnchor(null);
|
|
57
|
+
}
|
|
58
|
+
}, [isOpen]);
|
|
59
|
+
|
|
60
|
+
const refreshManifests = () => {
|
|
61
|
+
api.get<{ success: boolean; manifests: AppManifest[] }>(Api.Workspace, '/apps/manifests')
|
|
62
|
+
.then(data => {
|
|
63
|
+
if (data.success) setManifests(data.manifests);
|
|
64
|
+
})
|
|
65
|
+
.catch(() => {});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleInstall = async () => {
|
|
69
|
+
if (!installSource.trim()) return;
|
|
70
|
+
setInstalling(true);
|
|
71
|
+
setInstallError(null);
|
|
72
|
+
setInstallSuccess(null);
|
|
73
|
+
try {
|
|
74
|
+
const result = await api.post<{ success: boolean; error?: string; app?: { id: string; name: string } }>(
|
|
75
|
+
Api.Workspace, '/apps/install', { source: installSource.trim() }
|
|
76
|
+
);
|
|
77
|
+
if (!result.success) {
|
|
78
|
+
setInstallError(result.error || 'Install failed');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
setInstallSuccess(`Installed "${result.app?.name || result.app?.id}"`);
|
|
82
|
+
setInstallSource('');
|
|
83
|
+
refreshManifests();
|
|
84
|
+
} catch (err) {
|
|
85
|
+
setInstallError((err as Error).message);
|
|
86
|
+
} finally {
|
|
87
|
+
setInstalling(false);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const handleApprove = async () => {
|
|
92
|
+
if (!approvalApp) return;
|
|
93
|
+
setApproving(true);
|
|
94
|
+
setApprovalError(null);
|
|
95
|
+
try {
|
|
96
|
+
const result = await api.post<{ success: boolean; error?: string }>(
|
|
97
|
+
Api.Wallet, `/apps/${approvalApp.id}/approve`
|
|
98
|
+
);
|
|
99
|
+
if (!result.success) {
|
|
100
|
+
setApprovalError(result.error || 'Approval failed');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const appId = approvalApp.id;
|
|
104
|
+
const appName = approvalApp.name;
|
|
105
|
+
setApprovalApp(null);
|
|
106
|
+
setApprovalAnchor(null);
|
|
107
|
+
onAddApp(`installed:${appId}`, { appPath: appId, appName });
|
|
108
|
+
} catch (err) {
|
|
109
|
+
setApprovalError((err as Error).message);
|
|
110
|
+
} finally {
|
|
111
|
+
setApproving(false);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Built-in apps as store cards
|
|
116
|
+
const builtinCards = useMemo(() => {
|
|
117
|
+
return Object.entries(APP_TYPES).map(([key, def]: [string, AppDefinition]) => ({
|
|
118
|
+
id: key,
|
|
119
|
+
name: def.title,
|
|
120
|
+
icon: def.icon,
|
|
121
|
+
description: def.description || `Built-in ${def.title.toLowerCase()} app`,
|
|
122
|
+
category: 'builtin' as const,
|
|
123
|
+
color: def.color,
|
|
124
|
+
permissions: [] as string[],
|
|
125
|
+
manifest: null as AppManifest | null,
|
|
126
|
+
onAdd: () => onAddApp(key),
|
|
127
|
+
}));
|
|
128
|
+
}, [onAddApp]);
|
|
129
|
+
|
|
130
|
+
// Installed (third-party) app cards
|
|
131
|
+
const installedCards = useMemo(() => {
|
|
132
|
+
return manifests.map(m => ({
|
|
133
|
+
id: `installed:${m.id}`,
|
|
134
|
+
name: m.name,
|
|
135
|
+
icon: Box,
|
|
136
|
+
description: m.description || `Installed app`,
|
|
137
|
+
category: 'installed' as const,
|
|
138
|
+
color: 'gray' as const,
|
|
139
|
+
permissions: Array.isArray(m.permissions) ? m.permissions : [],
|
|
140
|
+
manifest: m as AppManifest | null,
|
|
141
|
+
onAdd: () => onAddApp(`installed:${m.id}`, { appPath: m.id, appName: m.name }),
|
|
142
|
+
}));
|
|
143
|
+
}, [manifests, onAddApp]);
|
|
144
|
+
|
|
145
|
+
const allCards = useMemo(() => {
|
|
146
|
+
if (activeCategory === 'builtin') return builtinCards;
|
|
147
|
+
if (activeCategory === 'installed') return installedCards;
|
|
148
|
+
return [...builtinCards, ...installedCards];
|
|
149
|
+
}, [activeCategory, builtinCards, installedCards]);
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<Drawer
|
|
153
|
+
isOpen={isOpen}
|
|
154
|
+
onClose={onClose}
|
|
155
|
+
title="APP STORE"
|
|
156
|
+
subtitle="Add apps to workspace"
|
|
157
|
+
>
|
|
158
|
+
<div className="space-y-4">
|
|
159
|
+
{/* Category Filters */}
|
|
160
|
+
<div className="flex gap-1">
|
|
161
|
+
{CATEGORIES.map(cat => (
|
|
162
|
+
<button
|
|
163
|
+
key={cat.id}
|
|
164
|
+
onClick={() => setActiveCategory(cat.id)}
|
|
165
|
+
className={`px-2.5 py-1 font-mono text-[9px] tracking-widest border transition-colors ${
|
|
166
|
+
activeCategory === cat.id
|
|
167
|
+
? 'bg-[var(--color-text,#0a0a0a)] text-[var(--color-accent,#ccff00)] border-[var(--color-text,#0a0a0a)]'
|
|
168
|
+
: 'bg-[var(--color-surface,#fff)] text-[var(--color-text-muted,#6b7280)] border-[var(--color-border,#d4d4d8)] hover:border-[var(--color-text,#0a0a0a)]'
|
|
169
|
+
}`}
|
|
170
|
+
>
|
|
171
|
+
{cat.label}
|
|
172
|
+
</button>
|
|
173
|
+
))}
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
{/* Install from URL */}
|
|
177
|
+
{(activeCategory === 'all' || activeCategory === 'installed') && (
|
|
178
|
+
<div className="p-2.5 border border-[var(--color-border,#d4d4d8)] bg-[var(--color-surface,#fff)]">
|
|
179
|
+
<div className="font-mono text-[8px] text-[var(--color-text-muted,#6b7280)] mb-1.5 tracking-wider">
|
|
180
|
+
INSTALL FROM URL
|
|
181
|
+
</div>
|
|
182
|
+
<div className="flex gap-1.5">
|
|
183
|
+
<div className="flex-1">
|
|
184
|
+
<TextInput
|
|
185
|
+
value={installSource}
|
|
186
|
+
onChange={(e) => setInstallSource(e.target.value)}
|
|
187
|
+
placeholder="github.com/user/app or URL"
|
|
188
|
+
compact
|
|
189
|
+
onKeyDown={(e: React.KeyboardEvent) => {
|
|
190
|
+
if (e.key === 'Enter') handleInstall();
|
|
191
|
+
}}
|
|
192
|
+
disabled={installing}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
<Button
|
|
196
|
+
variant="primary"
|
|
197
|
+
size="sm"
|
|
198
|
+
onClick={handleInstall}
|
|
199
|
+
loading={installing}
|
|
200
|
+
disabled={installing || !installSource.trim()}
|
|
201
|
+
icon={<Download size={10} />}
|
|
202
|
+
>
|
|
203
|
+
INSTALL
|
|
204
|
+
</Button>
|
|
205
|
+
</div>
|
|
206
|
+
{installError && (
|
|
207
|
+
<div className="font-mono text-[8px] text-[var(--color-warning,#ff4d00)] mt-1.5">
|
|
208
|
+
{installError}
|
|
209
|
+
</div>
|
|
210
|
+
)}
|
|
211
|
+
{installSuccess && (
|
|
212
|
+
<div className="font-mono text-[8px] text-[var(--color-success,#22c55e)] mt-1.5">
|
|
213
|
+
{installSuccess}
|
|
214
|
+
</div>
|
|
215
|
+
)}
|
|
216
|
+
</div>
|
|
217
|
+
)}
|
|
218
|
+
|
|
219
|
+
{/* Loading */}
|
|
220
|
+
{loading && (
|
|
221
|
+
<div className="py-8 flex items-center justify-center">
|
|
222
|
+
<Loader2 size={16} className="animate-spin text-[var(--color-text-muted,#6b7280)]" />
|
|
223
|
+
</div>
|
|
224
|
+
)}
|
|
225
|
+
|
|
226
|
+
{/* App Grid */}
|
|
227
|
+
{!loading && allCards.length === 0 && (
|
|
228
|
+
<div className="py-8 text-center border border-dashed border-[var(--color-border,#d4d4d8)]">
|
|
229
|
+
<Box size={20} className="mx-auto mb-2 text-[var(--color-text-faint,#9ca3af)]" />
|
|
230
|
+
<div className="font-mono text-[9px] text-[var(--color-text-muted,#6b7280)]">
|
|
231
|
+
{activeCategory === 'installed'
|
|
232
|
+
? 'No apps installed. Drop app folders into apps/'
|
|
233
|
+
: 'No apps available'}
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
)}
|
|
237
|
+
|
|
238
|
+
{!loading && (
|
|
239
|
+
<div className="space-y-2">
|
|
240
|
+
{allCards.map(card => {
|
|
241
|
+
const IconComponent = card.icon;
|
|
242
|
+
const needsApproval = card.permissions.length > 0;
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<div
|
|
246
|
+
key={card.id}
|
|
247
|
+
className="p-3 border border-[var(--color-border,#d4d4d8)] bg-[var(--color-surface,#fff)] hover:border-[var(--color-border-focus,#0a0a0a)] transition-colors relative"
|
|
248
|
+
>
|
|
249
|
+
{/* Corner accents */}
|
|
250
|
+
<div className="absolute top-1 left-1 w-1.5 h-1.5 border-l border-t border-[var(--color-border-focus,#0a0a0a)] opacity-30" />
|
|
251
|
+
<div className="absolute top-1 right-1 w-1.5 h-1.5 border-r border-t border-[var(--color-border-focus,#0a0a0a)] opacity-30" />
|
|
252
|
+
|
|
253
|
+
<div className="flex items-start gap-3">
|
|
254
|
+
<div className="w-8 h-8 bg-[var(--color-background-alt,#f4f4f5)] flex items-center justify-center shrink-0">
|
|
255
|
+
<IconComponent size={14} className="text-[var(--color-text-muted,#6b7280)]" />
|
|
256
|
+
</div>
|
|
257
|
+
<div className="flex-1 min-w-0">
|
|
258
|
+
<div className="flex items-center gap-2">
|
|
259
|
+
<span className="font-mono text-[10px] font-bold text-[var(--color-text,#0a0a0a)]">
|
|
260
|
+
{card.name}
|
|
261
|
+
</span>
|
|
262
|
+
<span className={`font-mono text-[7px] px-1 py-0.5 ${
|
|
263
|
+
card.category === 'installed'
|
|
264
|
+
? 'bg-[var(--color-accent,#ccff00)]/20 text-[var(--color-accent,#ccff00)]'
|
|
265
|
+
: 'bg-[var(--color-info,#0047ff)]/10 text-[var(--color-info,#0047ff)]'
|
|
266
|
+
}`}>
|
|
267
|
+
{card.category === 'installed' ? 'PLUGIN' : 'BUILT-IN'}
|
|
268
|
+
</span>
|
|
269
|
+
</div>
|
|
270
|
+
<div className="font-mono text-[8px] text-[var(--color-text-muted,#6b7280)] mt-0.5 leading-relaxed">
|
|
271
|
+
{card.description}
|
|
272
|
+
</div>
|
|
273
|
+
{needsApproval && (
|
|
274
|
+
<div className="flex items-center gap-1 mt-1">
|
|
275
|
+
<Shield size={8} className="text-[var(--color-warning,#ff4d00)]" />
|
|
276
|
+
<span className="font-mono text-[7px] text-[var(--color-warning,#ff4d00)]">
|
|
277
|
+
{card.permissions.length} PERMISSION{card.permissions.length > 1 ? 'S' : ''}
|
|
278
|
+
</span>
|
|
279
|
+
</div>
|
|
280
|
+
)}
|
|
281
|
+
</div>
|
|
282
|
+
<Button
|
|
283
|
+
variant={needsApproval ? 'secondary' : 'ghost'}
|
|
284
|
+
size="sm"
|
|
285
|
+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
|
|
286
|
+
if (needsApproval && card.manifest) {
|
|
287
|
+
setApprovalApp(card.manifest);
|
|
288
|
+
setApprovalAnchor(e.currentTarget);
|
|
289
|
+
setApprovalError(null);
|
|
290
|
+
} else {
|
|
291
|
+
card.onAdd();
|
|
292
|
+
}
|
|
293
|
+
}}
|
|
294
|
+
icon={needsApproval ? <Shield size={10} /> : <Plus size={10} />}
|
|
295
|
+
>
|
|
296
|
+
{needsApproval ? 'APPROVE' : 'ADD'}
|
|
297
|
+
</Button>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
);
|
|
301
|
+
})}
|
|
302
|
+
</div>
|
|
303
|
+
)}
|
|
304
|
+
|
|
305
|
+
{/* Approval Popover */}
|
|
306
|
+
<Popover
|
|
307
|
+
isOpen={!!approvalApp}
|
|
308
|
+
onClose={() => { setApprovalApp(null); setApprovalAnchor(null); }}
|
|
309
|
+
title="APP PERMISSIONS"
|
|
310
|
+
anchorEl={approvalAnchor}
|
|
311
|
+
anchor="right"
|
|
312
|
+
>
|
|
313
|
+
{approvalApp && (
|
|
314
|
+
<div className="space-y-3 min-w-[220px]">
|
|
315
|
+
<div>
|
|
316
|
+
<div className="font-mono text-[10px] font-bold text-[var(--color-text,#0a0a0a)]">
|
|
317
|
+
{approvalApp.name}
|
|
318
|
+
</div>
|
|
319
|
+
<div className="font-mono text-[8px] text-[var(--color-text-muted,#6b7280)] mt-0.5">
|
|
320
|
+
This app requests the following permissions:
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
<div className="space-y-1">
|
|
325
|
+
{(Array.isArray(approvalApp.permissions) ? approvalApp.permissions : []).map(perm => (
|
|
326
|
+
<div
|
|
327
|
+
key={perm}
|
|
328
|
+
className="flex items-center gap-1.5 px-2 py-1.5 bg-[var(--color-background-alt,#f4f4f5)]"
|
|
329
|
+
>
|
|
330
|
+
<Shield size={9} className="text-[var(--color-warning,#ff4d00)] shrink-0" />
|
|
331
|
+
<span className="font-mono text-[9px] text-[var(--color-text,#0a0a0a)]">{perm}</span>
|
|
332
|
+
</div>
|
|
333
|
+
))}
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
{approvalError && (
|
|
337
|
+
<div className="font-mono text-[8px] text-[var(--color-warning,#ff4d00)] px-1">
|
|
338
|
+
{approvalError}
|
|
339
|
+
</div>
|
|
340
|
+
)}
|
|
341
|
+
|
|
342
|
+
<div className="flex gap-2 pt-1">
|
|
343
|
+
<Button
|
|
344
|
+
variant="primary"
|
|
345
|
+
size="sm"
|
|
346
|
+
onClick={handleApprove}
|
|
347
|
+
loading={approving}
|
|
348
|
+
disabled={approving}
|
|
349
|
+
icon={<Check size={10} />}
|
|
350
|
+
className="flex-1"
|
|
351
|
+
>
|
|
352
|
+
APPROVE
|
|
353
|
+
</Button>
|
|
354
|
+
<Button
|
|
355
|
+
variant="secondary"
|
|
356
|
+
size="sm"
|
|
357
|
+
onClick={() => { setApprovalApp(null); setApprovalAnchor(null); }}
|
|
358
|
+
disabled={approving}
|
|
359
|
+
>
|
|
360
|
+
CANCEL
|
|
361
|
+
</Button>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
)}
|
|
365
|
+
</Popover>
|
|
366
|
+
</div>
|
|
367
|
+
</Drawer>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
interface ContentAreaProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ContentArea: React.FC<ContentAreaProps> = ({ children }) => {
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex-1 bg-[#f4f4f5] overflow-y-auto relative">
|
|
12
|
+
{/* Subtle Grid Pattern */}
|
|
13
|
+
<div className="absolute inset-0 bg-[linear-gradient(to_right,#e5e5e5_1px,transparent_1px),linear-gradient(to_bottom,#e5e5e5_1px,transparent_1px)] bg-[size:3rem_3rem] opacity-30 pointer-events-none" />
|
|
14
|
+
|
|
15
|
+
{/* Content */}
|
|
16
|
+
<div className="relative z-10 p-6">
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { KeyRound, Flame, Shield, Database } from 'lucide-react';
|
|
5
|
+
import { Modal } from '@/components/design-system';
|
|
6
|
+
import { CREATABLE_VIEWS, type ViewDefinition } from '@/lib/view-registry';
|
|
7
|
+
|
|
8
|
+
const ICON_MAP: Record<string, React.ComponentType<{ size?: number; className?: string }>> = {
|
|
9
|
+
KeyRound,
|
|
10
|
+
Flame,
|
|
11
|
+
Shield,
|
|
12
|
+
Database,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
interface CreateViewModalProps {
|
|
16
|
+
open: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onSelect: (view: ViewDefinition) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function CreateViewModal({ open, onClose, onSelect }: CreateViewModalProps) {
|
|
22
|
+
if (!open) return null;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Modal isOpen={open} title="Create View" onClose={onClose}>
|
|
26
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px', padding: '8px 0' }}>
|
|
27
|
+
{CREATABLE_VIEWS.map((view) => {
|
|
28
|
+
const Icon = ICON_MAP[view.icon] || KeyRound;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<button
|
|
32
|
+
key={view.id}
|
|
33
|
+
onClick={() => {
|
|
34
|
+
onSelect(view);
|
|
35
|
+
onClose();
|
|
36
|
+
}}
|
|
37
|
+
style={{
|
|
38
|
+
display: 'flex',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
gap: '12px',
|
|
41
|
+
padding: '12px 16px',
|
|
42
|
+
borderRadius: '8px',
|
|
43
|
+
border: '1px solid rgba(255,255,255,0.08)',
|
|
44
|
+
background: 'rgba(255,255,255,0.03)',
|
|
45
|
+
color: 'white',
|
|
46
|
+
cursor: 'pointer',
|
|
47
|
+
textAlign: 'left',
|
|
48
|
+
transition: 'all 0.15s ease',
|
|
49
|
+
width: '100%',
|
|
50
|
+
}}
|
|
51
|
+
onMouseEnter={(e) => {
|
|
52
|
+
(e.currentTarget as HTMLElement).style.background = 'rgba(255,255,255,0.06)';
|
|
53
|
+
(e.currentTarget as HTMLElement).style.borderColor = 'rgba(255,255,255,0.15)';
|
|
54
|
+
}}
|
|
55
|
+
onMouseLeave={(e) => {
|
|
56
|
+
(e.currentTarget as HTMLElement).style.background = 'rgba(255,255,255,0.03)';
|
|
57
|
+
(e.currentTarget as HTMLElement).style.borderColor = 'rgba(255,255,255,0.08)';
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
style={{
|
|
62
|
+
width: '36px',
|
|
63
|
+
height: '36px',
|
|
64
|
+
borderRadius: '10px',
|
|
65
|
+
background: 'rgba(99,102,241,0.15)',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
flexShrink: 0,
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
<Icon size={18} />
|
|
73
|
+
</div>
|
|
74
|
+
<div>
|
|
75
|
+
<div style={{ fontWeight: 600, fontSize: '14px' }}>{view.label}</div>
|
|
76
|
+
{view.description && (
|
|
77
|
+
<div style={{ fontSize: '12px', color: 'rgba(255,255,255,0.5)', marginTop: '2px' }}>
|
|
78
|
+
{view.description}
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
</button>
|
|
83
|
+
);
|
|
84
|
+
})}
|
|
85
|
+
</div>
|
|
86
|
+
</Modal>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { KeyRound, Flame, Shield, Database, Plus } from 'lucide-react';
|
|
5
|
+
import type { ViewDefinition } from '@/lib/view-registry';
|
|
6
|
+
|
|
7
|
+
const ICON_MAP: Record<string, React.ComponentType<{ size?: number; className?: string }>> = {
|
|
8
|
+
KeyRound,
|
|
9
|
+
Flame,
|
|
10
|
+
Shield,
|
|
11
|
+
Database,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface LeftRailProps {
|
|
15
|
+
views: ViewDefinition[];
|
|
16
|
+
activeViewId: string;
|
|
17
|
+
onSelectView: (id: string) => void;
|
|
18
|
+
onCreateView: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function LeftRail({ views, activeViewId, onSelectView, onCreateView }: LeftRailProps) {
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
style={{
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
gap: '8px',
|
|
29
|
+
padding: '12px 6px',
|
|
30
|
+
width: '56px',
|
|
31
|
+
minWidth: '56px',
|
|
32
|
+
borderRight: '1px solid var(--border-color, rgba(255,255,255,0.08))',
|
|
33
|
+
background: 'var(--bg-sidebar, rgba(0,0,0,0.15))',
|
|
34
|
+
height: '100%',
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{/* Create view button */}
|
|
38
|
+
<button
|
|
39
|
+
onClick={onCreateView}
|
|
40
|
+
title="Create view"
|
|
41
|
+
style={{
|
|
42
|
+
width: '40px',
|
|
43
|
+
height: '40px',
|
|
44
|
+
borderRadius: '12px',
|
|
45
|
+
border: '1px dashed rgba(255,255,255,0.2)',
|
|
46
|
+
background: 'transparent',
|
|
47
|
+
color: 'rgba(255,255,255,0.5)',
|
|
48
|
+
cursor: 'pointer',
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
transition: 'all 0.15s ease',
|
|
53
|
+
marginBottom: '4px',
|
|
54
|
+
}}
|
|
55
|
+
onMouseEnter={(e) => {
|
|
56
|
+
(e.target as HTMLElement).style.borderColor = 'rgba(255,255,255,0.4)';
|
|
57
|
+
(e.target as HTMLElement).style.color = 'rgba(255,255,255,0.8)';
|
|
58
|
+
}}
|
|
59
|
+
onMouseLeave={(e) => {
|
|
60
|
+
(e.target as HTMLElement).style.borderColor = 'rgba(255,255,255,0.2)';
|
|
61
|
+
(e.target as HTMLElement).style.color = 'rgba(255,255,255,0.5)';
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<Plus size={18} />
|
|
65
|
+
</button>
|
|
66
|
+
|
|
67
|
+
{/* Separator */}
|
|
68
|
+
<div style={{ width: '24px', height: '1px', background: 'rgba(255,255,255,0.08)' }} />
|
|
69
|
+
|
|
70
|
+
{/* View buttons */}
|
|
71
|
+
{views.map((view) => {
|
|
72
|
+
const Icon = ICON_MAP[view.icon] || KeyRound;
|
|
73
|
+
const isActive = view.id === activeViewId;
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<button
|
|
77
|
+
key={view.id}
|
|
78
|
+
onClick={() => onSelectView(view.id)}
|
|
79
|
+
title={view.label}
|
|
80
|
+
style={{
|
|
81
|
+
width: '40px',
|
|
82
|
+
height: '40px',
|
|
83
|
+
borderRadius: '12px',
|
|
84
|
+
border: 'none',
|
|
85
|
+
background: isActive
|
|
86
|
+
? 'var(--accent-color, rgba(99,102,241,0.3))'
|
|
87
|
+
: 'rgba(255,255,255,0.04)',
|
|
88
|
+
color: isActive ? 'white' : 'rgba(255,255,255,0.5)',
|
|
89
|
+
cursor: 'pointer',
|
|
90
|
+
display: 'flex',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
transition: 'all 0.15s ease',
|
|
94
|
+
}}
|
|
95
|
+
onMouseEnter={(e) => {
|
|
96
|
+
if (!isActive) {
|
|
97
|
+
(e.currentTarget as HTMLElement).style.background = 'rgba(255,255,255,0.08)';
|
|
98
|
+
(e.currentTarget as HTMLElement).style.color = 'rgba(255,255,255,0.8)';
|
|
99
|
+
}
|
|
100
|
+
}}
|
|
101
|
+
onMouseLeave={(e) => {
|
|
102
|
+
if (!isActive) {
|
|
103
|
+
(e.currentTarget as HTMLElement).style.background = 'rgba(255,255,255,0.04)';
|
|
104
|
+
(e.currentTarget as HTMLElement).style.color = 'rgba(255,255,255,0.5)';
|
|
105
|
+
}
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<Icon size={20} />
|
|
109
|
+
</button>
|
|
110
|
+
);
|
|
111
|
+
})}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|