vibefast-cli 1.1.5 → 1.3.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/CHANGELOG.md +32 -0
- package/README.md +63 -169
- package/dist/__tests__/recipes.test.js +89 -85
- package/dist/__tests__/recipes.test.js.map +1 -1
- package/dist/commands/add.d.ts +1 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +576 -588
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/checklist.d.ts +1 -1
- package/dist/commands/checklist.d.ts.map +1 -1
- package/dist/commands/checklist.js +40 -39
- package/dist/commands/checklist.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.js +22 -22
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env.d.ts +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +58 -53
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/health.d.ts +1 -1
- package/dist/commands/health.d.ts.map +1 -1
- package/dist/commands/health.js +101 -93
- package/dist/commands/health.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +416 -296
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/remove.d.ts +1 -1
- package/dist/commands/remove.d.ts.map +1 -1
- package/dist/commands/remove.js +77 -64
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +15 -14
- package/dist/commands/status.js.map +1 -1
- package/dist/core/__tests__/detect.test.js +68 -34
- package/dist/core/__tests__/detect.test.js.map +1 -1
- package/dist/core/ast.d.ts +14 -0
- package/dist/core/ast.d.ts.map +1 -0
- package/dist/core/ast.js +239 -0
- package/dist/core/ast.js.map +1 -0
- package/dist/core/codemod.d.ts.map +1 -1
- package/dist/core/codemod.js +62 -44
- package/dist/core/codemod.js.map +1 -1
- package/dist/core/config.d.ts +10 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +51 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/detect.d.ts +8 -2
- package/dist/core/detect.d.ts.map +1 -1
- package/dist/core/detect.js +52 -21
- package/dist/core/detect.js.map +1 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +9 -8
- package/dist/core/errors.js.map +1 -1
- package/dist/core/exec.d.ts +16 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +48 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/manualSteps.d.ts +7 -0
- package/dist/core/manualSteps.d.ts.map +1 -0
- package/dist/core/manualSteps.js +59 -0
- package/dist/core/manualSteps.js.map +1 -0
- package/dist/core/paths.d.ts +3 -1
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core/paths.js +14 -10
- package/dist/core/paths.js.map +1 -1
- package/dist/core/spinner.d.ts +1 -1
- package/dist/core/spinner.d.ts.map +1 -1
- package/dist/core/spinner.js +38 -8
- package/dist/core/spinner.js.map +1 -1
- package/dist/core/vosk.d.ts.map +1 -1
- package/dist/core/vosk.js +50 -39
- package/dist/core/vosk.js.map +1 -1
- package/docs/manual-testing.md +91 -0
- package/package.json +6 -3
- package/recipes/audio-recorder/apps/native/src/app/audio-recorder/index.tsx +5 -0
- package/recipes/audio-recorder/recipe.json +3 -3
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-player.tsx +301 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-recorder.tsx +373 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/audio-waveform.tsx +270 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/index.ts +4 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/components/recording-list.tsx +89 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-player-demo.tsx +66 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-recorder-cloud.tsx +68 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/audio-recorder-interview.tsx +102 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/basic.tsx +27 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/index.ts +5 -0
- package/recipes/audio-recorder-supabase/apps/native/src/features/audio-recorder/demo/with-recording-list-demo.tsx +82 -0
- package/recipes/audio-recorder-supabase/packages/backend/src/services/recordings.ts +369 -0
- package/recipes/audio-recorder-supabase/packages/backend/supabase/migrations/recordings.sql +70 -0
- package/recipes/audio-recorder-supabase/recipe.json +52 -0
- package/recipes/audio-recorder-supabase@latest.zip +0 -0
- package/recipes/audio-recorder@latest.zip +0 -0
- package/recipes/charts/apps/native/src/features/charts/components/bar-chart.tsx +3 -3
- package/recipes/charts/apps/native/src/features/charts/components/candlestick-chart.tsx +2 -2
- package/recipes/charts/apps/native/src/features/charts/components/chart-card.tsx +5 -5
- package/recipes/charts/apps/native/src/features/charts/components/column-chart.tsx +3 -3
- package/recipes/charts/apps/native/src/features/charts/components/doughnut-chart.tsx +20 -4
- package/recipes/charts/apps/native/src/features/charts/components/line-chart.tsx +7 -6
- package/recipes/charts/apps/native/src/features/charts/components/radar-chart.tsx +6 -4
- package/recipes/charts/apps/native/src/features/charts/components/radial-bar-chart.tsx +1 -1
- package/recipes/charts/apps/native/src/features/charts/components/stacked-bar-chart.tsx +5 -4
- package/recipes/charts/recipe.json +4 -13
- package/recipes/charts@latest.zip +0 -0
- package/recipes/chatbot/apps/native/src/app/chatbot/index.tsx +1 -0
- package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-markdown.tsx +86 -86
- package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/code-block.tsx +86 -53
- package/recipes/chatbot/recipe.json +26 -92
- package/recipes/chatbot-supabase/apps/native/src/api-client/supabase/chatbot.ts +515 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/app/index.tsx +257 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-header-buttons.tsx +59 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-input-bar.tsx +485 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-markdown.tsx +575 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-message-bubble.tsx +223 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/chat-settings-modal.tsx +161 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/image-preview-list.tsx +116 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/code-block.tsx +165 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/index.ts +10 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/markdown/table-renderer.tsx +129 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/message-error-boundary.tsx +78 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/message-list.tsx +170 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/model-selector.tsx +283 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/report-content-modal.tsx +188 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/components/suggested-messages.tsx +67 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/constants/models.ts +20 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/constants/report-reasons.ts +9 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-attachment-cache.ts +142 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chat-config.ts +458 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chat-handlers.ts +429 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-chatbot-settings.ts +89 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-conversation.ts +90 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-image-picker.ts +122 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-keyboard-coordinator.ts +161 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/hooks/use-smart-scroll-manager.ts +213 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/index.ts +86 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/models.ts +162 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/providers.ts +62 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/models/types.ts +40 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/services/file-uploader.ts +287 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/services/message-handler-service.ts +189 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/types/index.ts +70 -0
- package/recipes/chatbot-supabase/apps/native/src/features/chatbot/utils/chat-telemetry.ts +91 -0
- package/recipes/chatbot-supabase/packages/backend/src/services/conversations.ts +243 -0
- package/recipes/chatbot-supabase/packages/backend/src/services/messages.ts +327 -0
- package/recipes/chatbot-supabase/packages/backend/supabase/functions/chat-stream/index.ts +347 -0
- package/recipes/chatbot-supabase/packages/backend/supabase/migrations/chatbot.sql +104 -0
- package/recipes/chatbot-supabase/recipe.json +106 -0
- package/recipes/chatbot-supabase@latest.zip +0 -0
- package/recipes/chatbot.zip +0 -0
- package/recipes/chatbot@latest.zip +0 -0
- package/recipes/image-analysis/packages/backend/convex/imageAnalysis/index.ts +2 -2
- package/recipes/image-analysis/packages/backend/convex/imageAnalysis.ts +0 -1
- package/recipes/image-analysis/recipe.json +15 -55
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/analysis-options-screen.tsx +304 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/camera.tsx +221 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/image-capture-screen.tsx +333 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/loading-screen.tsx +214 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/loading.tsx +191 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/results.tsx +137 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/trait-details.tsx +172 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/use-analysis-data.ts +160 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/app/use-results-screen.ts +151 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-badge.tsx +77 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-card.tsx +75 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievement-unlocked-modal.tsx +162 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/achievements-section.tsx +44 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/advice-list.tsx +42 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/circular-progress.tsx +233 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/content-card.tsx +38 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/error-state.tsx +42 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/index.ts +9 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/loading-state.tsx +26 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/profile-image.tsx +60 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/results-header.tsx +62 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/score-display.tsx +54 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/share-options-modal.tsx +110 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/components/results/traits-grid.tsx +74 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/config/analysis-config.ts +80 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/config/master-analysis-config.ts +157 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/index.ts +1 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/use-analysis.ts +38 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/hooks/use-image-analysis.ts +208 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/analysis-service.ts +262 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/share-service.ts +176 -0
- package/recipes/image-analysis-supabase/apps/native/src/features/image-analyzer/services/trait-details-service.ts +289 -0
- package/recipes/image-analysis-supabase/packages/backend/src/services/image-analyses.ts +132 -0
- package/recipes/image-analysis-supabase/packages/backend/supabase/functions/analyze-image/index.ts +312 -0
- package/recipes/image-analysis-supabase/packages/backend/supabase/migrations/image_analysis.sql +42 -0
- package/recipes/image-analysis-supabase/recipe.json +90 -0
- package/recipes/image-analysis-supabase@latest.zip +0 -0
- package/recipes/image-analysis@latest.zip +0 -0
- package/recipes/image-generator/apps/native/src/features/image-generator/app/index.tsx +16 -2
- package/recipes/image-generator/apps/native/src/features/image-generator/components/image-model-selector.tsx +11 -5
- package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-generator.ts +11 -5
- package/recipes/image-generator/packages/backend/convex/imageGeneration/index.ts +2 -2
- package/recipes/image-generator/recipe.json +16 -39
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/_layout.tsx +26 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/gallery.tsx +217 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/app/index.tsx +251 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/gallery-image.tsx +25 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-detail-modal.tsx +215 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-model-selector.tsx +216 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/components/image-placeholder.tsx +26 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-gallery.ts +71 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-generator-settings.ts +152 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/hooks/use-image-generator.ts +103 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/models/models.ts +66 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/services/image-gallery-service.ts +96 -0
- package/recipes/image-generator-supabase/apps/native/src/features/image-generator/services/image-save-service.ts +120 -0
- package/recipes/image-generator-supabase/packages/backend/supabase/functions/generate-image/index.ts +291 -0
- package/recipes/image-generator-supabase/packages/backend/supabase/migrations/image_generator.sql +71 -0
- package/recipes/image-generator-supabase/recipe.json +86 -0
- package/recipes/image-generator-supabase@latest.zip +0 -0
- package/recipes/image-generator@latest.zip +0 -0
- package/recipes/ios-widget/recipe.json +15 -24
- package/recipes/ios-widget@latest.zip +0 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/analytics/index.ts +9 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/components/onboarding-with-analytics.tsx +141 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/components/onboarding.tsx +173 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/config/onboarding-flow-config.ts +189 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/demo-one/app/index.tsx +42 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/demo-one/data.ts +32 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/app/index.tsx +43 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/interactive-onboarding.tsx +222 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/ai-tone-step.tsx +133 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/currency-step.tsx +165 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-ai-step.tsx +199 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-chatbot-step.tsx +154 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-manual-step.tsx +156 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/feature-scan-step.tsx +158 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/main-reason-step.tsx +139 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/notification-step.tsx +129 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/overspend-step.tsx +138 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/personalizing-step.tsx +190 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/rating-step.tsx +98 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/reminder-step.tsx +181 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/safety-step.tsx +110 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/struggle-step.tsx +139 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/steps/welcome-step.tsx +217 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/components/ui/onboarding-header.tsx +58 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/expense-tracker/constants.ts +179 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/hooks/use-onboarding-analytics.ts +323 -0
- package/recipes/onboarding/apps/native/src/features/onboarding/services/onboarding-analytics.ts +432 -0
- package/recipes/onboarding/recipe.json +15 -0
- package/recipes/onboarding@latest.zip +0 -0
- package/recipes/payments/recipe.json +28 -61
- package/recipes/payments-supabase/apps/native/src/features/payments/README.md +200 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/app/local-paywall.tsx +194 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/app/remote-paywall.tsx +79 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/components/payment-initializer.tsx +95 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-error-state.tsx +60 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-local-mode.tsx +116 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-product-card.tsx +133 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/components/paywall-remote-mode.tsx +146 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/hooks/use-entitlement.ts +63 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/index.ts +8 -0
- package/recipes/payments-supabase/apps/native/src/features/payments/services/revenuecat-adapter.ts +407 -0
- package/recipes/payments-supabase/packages/backend/src/services/payments.ts +201 -0
- package/recipes/payments-supabase/packages/backend/supabase/migrations/payments.sql +35 -0
- package/recipes/payments-supabase/recipe.json +72 -0
- package/recipes/payments-supabase@latest.zip +0 -0
- package/recipes/payments@latest.zip +0 -0
- package/recipes/quiz/apps/native/src/features/quiz/index.tsx +1 -2
- package/recipes/quiz/recipe.json +6 -9
- package/recipes/quiz@latest.zip +0 -0
- package/recipes/tracker-app/apps/native/src/features/tracker-app/app/index.tsx +1 -2
- package/recipes/tracker-app/recipe.json +7 -10
- package/recipes/tracker-app@latest.zip +0 -0
- package/recipes/voice-bot/recipe.json +8 -68
- package/recipes/voice-bot.zip +0 -0
- package/recipes/voice-bot@latest.zip +0 -0
- package/recipes/wake-word/recipe.json +10 -9
- package/recipes/wake-word.zip +0 -0
- package/recipes/wake-word@latest.zip +0 -0
- package/recipes/charts/apps/native/src/app/(root)/(protected)/charts/index.tsx +0 -3
- package/recipes/chatbot/packages/backend/convex/lib/rateLimit.ts +0 -100
- package/recipes/chatbot/packages/backend/convex/lib/telemetry.ts +0 -29
- package/recipes/chatbot/packages/backend/convex/ragKnowledge.ts +0 -0
- package/recipes/image-analysis/apps/native/assets/features/image-analyzer/front.jpg +0 -0
- package/recipes/image-analysis/apps/native/assets/features/image-analyzer/side.jpg +0 -0
- package/recipes/image-analysis/apps/native/assets/features/image-analyzer/threeQuarter.jpg +0 -0
- package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/_layout.tsx +0 -5
- package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/analysis-options.tsx +0 -50
- package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/camera.tsx +0 -2
- package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/index.tsx +0 -50
- package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/loading.tsx +0 -50
- package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/results.tsx +0 -2
- package/recipes/image-analysis/apps/native/src/app/(root)/(protected)/analysis/[type]/trait-details.tsx +0 -3
- package/recipes/image-analysis/packages/backend/convex/imageAnalysisFunctions.ts +0 -325
- package/recipes/image-analysis/packages/backend/convex/lib/ai/imageAnalysisAdapter.ts +0 -200
- package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/index.tsx +0 -74
- package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/local.tsx +0 -25
- package/recipes/payments/apps/native/src/app/(root)/(protected)/paywall/remote.tsx +0 -23
- package/recipes/quiz/apps/native/src/app/(root)/(protected)/quiz/index.tsx +0 -47
- package/recipes/tracker-app/apps/native/src/app/(root)/(protected)/tracker-app/index.tsx +0 -1
- package/recipes/voice-bot/apps/native/src/app/(root)/(protected)/voice-bot/index.tsx +0 -27
- package/recipes/voice-bot/packages/backend/convex/router.ts +0 -81
- /package/recipes/{chatbot/apps/native/src/app/(root)/(protected) → chatbot-supabase/apps/native/src/app}/chatbot/index.tsx +0 -0
- /package/recipes/{image-generator/apps/native/src/app/(root)/(protected) → image-generator-supabase/apps/native/src/app}/image-generator/gallery.tsx +0 -0
- /package/recipes/{image-generator/apps/native/src/app/(root)/(protected) → image-generator-supabase/apps/native/src/app}/image-generator/index.tsx +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Stack, useLocalSearchParams, useRouter } from 'expo-router';
|
|
2
|
+
import { ScrollView, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { AnimatedHeader, Button, Text } from '@/components/ui';
|
|
5
|
+
import { useThemeConfig } from '@/lib/use-theme-config';
|
|
6
|
+
|
|
7
|
+
import { AdviceList } from '../components/results/advice-list';
|
|
8
|
+
import { ContentCard } from '../components/results/content-card';
|
|
9
|
+
import { ScoreDisplay } from '../components/results/score-display';
|
|
10
|
+
import { formatTraitName } from '../services/analysis-service';
|
|
11
|
+
import { ShareService } from '../services/share-service';
|
|
12
|
+
import {
|
|
13
|
+
getScoreLevel,
|
|
14
|
+
getTraitAdvice,
|
|
15
|
+
} from '../services/trait-details-service';
|
|
16
|
+
|
|
17
|
+
type TraitDetailsParams = {
|
|
18
|
+
traitKey: string;
|
|
19
|
+
score: string;
|
|
20
|
+
analysisId: string;
|
|
21
|
+
feedback?: string;
|
|
22
|
+
structuredData?: string; // JSON string of structured trait data
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default function TraitDetailsScreen() {
|
|
26
|
+
const router = useRouter();
|
|
27
|
+
const theme = useThemeConfig();
|
|
28
|
+
const isDarkMode = theme.dark;
|
|
29
|
+
|
|
30
|
+
const { traitKey, score, feedback, structuredData } =
|
|
31
|
+
useLocalSearchParams<TraitDetailsParams>();
|
|
32
|
+
|
|
33
|
+
// Safely parse score with validation
|
|
34
|
+
const traitScore = (() => {
|
|
35
|
+
const parsed = Number.parseFloat(score || '0');
|
|
36
|
+
return isNaN(parsed) ? 0 : Math.max(0, Math.min(100, parsed)); // Clamp between 0-100
|
|
37
|
+
})();
|
|
38
|
+
const traitName = formatTraitName(traitKey || '');
|
|
39
|
+
|
|
40
|
+
// Parse structured data if available
|
|
41
|
+
let parsedStructuredData:
|
|
42
|
+
| {
|
|
43
|
+
feedback?: string;
|
|
44
|
+
strengths?: string[];
|
|
45
|
+
improvements?: string[];
|
|
46
|
+
}
|
|
47
|
+
| undefined;
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
if (structuredData) {
|
|
51
|
+
parsedStructuredData = JSON.parse(structuredData);
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.warn('Failed to parse structured data:', error);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const traitAdvice = getTraitAdvice(
|
|
58
|
+
traitKey || '',
|
|
59
|
+
traitScore,
|
|
60
|
+
parsedStructuredData,
|
|
61
|
+
);
|
|
62
|
+
const scoreInfo = getScoreLevel(traitScore);
|
|
63
|
+
|
|
64
|
+
const handleConsultationPress = () => {
|
|
65
|
+
// TODO: Navigate to affiliate product recommendations
|
|
66
|
+
console.log('Shop products for', traitName);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleSaveAdvicePress = () => {
|
|
70
|
+
// TODO: Save advice to favorites
|
|
71
|
+
console.log('Save advice for', traitName);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const handleShareTrait = () => {
|
|
75
|
+
ShareService.shareQuickSummary(traitScore, {
|
|
76
|
+
name: traitName,
|
|
77
|
+
score: traitScore,
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<>
|
|
83
|
+
<Stack.Screen options={{ headerShown: false }} />
|
|
84
|
+
<AnimatedHeader
|
|
85
|
+
onBack={() => router.back()}
|
|
86
|
+
title={`${traitName} Analysis`}
|
|
87
|
+
leftIcon="arrow-back"
|
|
88
|
+
showBorder={true}
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<ScrollView
|
|
92
|
+
className="flex-1"
|
|
93
|
+
contentContainerStyle={{ paddingBottom: 120 }}
|
|
94
|
+
showsVerticalScrollIndicator={false}
|
|
95
|
+
>
|
|
96
|
+
{/* Score Section */}
|
|
97
|
+
<View className="py-8">
|
|
98
|
+
<ScoreDisplay
|
|
99
|
+
score={traitScore}
|
|
100
|
+
scoreLevel={scoreInfo.level}
|
|
101
|
+
scoreColor={scoreInfo.color}
|
|
102
|
+
scoreDescription={scoreInfo.description}
|
|
103
|
+
/>
|
|
104
|
+
</View>
|
|
105
|
+
|
|
106
|
+
{/* AI Feedback Section */}
|
|
107
|
+
{(parsedStructuredData?.feedback || feedback) && (
|
|
108
|
+
<ContentCard title="AI Analysis">
|
|
109
|
+
<Text
|
|
110
|
+
className={`text-base leading-6 ${
|
|
111
|
+
isDarkMode ? 'text-neutral-300' : 'text-neutral-700'
|
|
112
|
+
}`}
|
|
113
|
+
>
|
|
114
|
+
{parsedStructuredData?.feedback || feedback}
|
|
115
|
+
</Text>
|
|
116
|
+
</ContentCard>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{/* Strengths Section (if available from structured data) */}
|
|
120
|
+
{parsedStructuredData?.strengths &&
|
|
121
|
+
parsedStructuredData.strengths.length > 0 && (
|
|
122
|
+
<ContentCard title="Your Strengths">
|
|
123
|
+
<AdviceList
|
|
124
|
+
items={parsedStructuredData.strengths}
|
|
125
|
+
bulletType="dot"
|
|
126
|
+
bulletColor="bg-green-500"
|
|
127
|
+
/>
|
|
128
|
+
</ContentCard>
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
{/* Personalized Advice */}
|
|
132
|
+
<ContentCard
|
|
133
|
+
title={
|
|
134
|
+
parsedStructuredData ? 'Improvement Areas' : 'Personalized Advice'
|
|
135
|
+
}
|
|
136
|
+
>
|
|
137
|
+
<AdviceList
|
|
138
|
+
items={traitAdvice.advice}
|
|
139
|
+
bulletType="dot"
|
|
140
|
+
bulletColor={traitAdvice.goodScore ? 'bg-green-500' : 'bg-blue-500'}
|
|
141
|
+
/>
|
|
142
|
+
</ContentCard>
|
|
143
|
+
|
|
144
|
+
{/* Expert Tips */}
|
|
145
|
+
<ContentCard title="Expert Tips">
|
|
146
|
+
<AdviceList items={traitAdvice.tips} bulletType="emoji" emoji="💡" />
|
|
147
|
+
</ContentCard>
|
|
148
|
+
|
|
149
|
+
{/* Action Buttons */}
|
|
150
|
+
<View className="mx-6 mb-6 gap-y-3">
|
|
151
|
+
<Button
|
|
152
|
+
label="🛍️ Shop Recommended Products"
|
|
153
|
+
onPress={handleConsultationPress}
|
|
154
|
+
variant="default"
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
<Button
|
|
158
|
+
label="📤 Share This Trait"
|
|
159
|
+
onPress={handleShareTrait}
|
|
160
|
+
variant="outline"
|
|
161
|
+
/>
|
|
162
|
+
|
|
163
|
+
<Button
|
|
164
|
+
label="⭐ Save This Advice"
|
|
165
|
+
onPress={handleSaveAdvicePress}
|
|
166
|
+
variant="outline"
|
|
167
|
+
/>
|
|
168
|
+
</View>
|
|
169
|
+
</ScrollView>
|
|
170
|
+
</>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { useLocalSearchParams } from 'expo-router';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { useAnalysis } from '../hooks';
|
|
5
|
+
import {
|
|
6
|
+
type AnalysisScores,
|
|
7
|
+
createMockAnalysis,
|
|
8
|
+
extractScoresFromAnalysis,
|
|
9
|
+
getUnlockedAchievements,
|
|
10
|
+
type LocalAnalysis,
|
|
11
|
+
processImageUrl,
|
|
12
|
+
} from '../services/analysis-service';
|
|
13
|
+
|
|
14
|
+
export const useAnalysisData = () => {
|
|
15
|
+
const {
|
|
16
|
+
analysisId,
|
|
17
|
+
localImageUri: localImageUriParam,
|
|
18
|
+
localImageUris: localImageUrisParam,
|
|
19
|
+
isFirstTime,
|
|
20
|
+
} = useLocalSearchParams<{
|
|
21
|
+
analysisId: string;
|
|
22
|
+
localImageUri?: string;
|
|
23
|
+
localImageUris?: string;
|
|
24
|
+
isFirstTime?: string;
|
|
25
|
+
}>();
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
analysis: remoteAnalysis,
|
|
29
|
+
isLoading: isBackendLoading,
|
|
30
|
+
error: backendError,
|
|
31
|
+
} = useAnalysis(analysisId);
|
|
32
|
+
|
|
33
|
+
const [localAnalysis, setLocalAnalysis] = useState<LocalAnalysis | null>(
|
|
34
|
+
null,
|
|
35
|
+
);
|
|
36
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
37
|
+
const [error, setError] = useState<string | null>(null);
|
|
38
|
+
const [extractedScores, setExtractedScores] = useState<AnalysisScores | null>(
|
|
39
|
+
null,
|
|
40
|
+
);
|
|
41
|
+
const [processedImageUrl, setProcessedImageUrl] = useState<string | null>(
|
|
42
|
+
null,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const loadAnalysisData = async () => {
|
|
47
|
+
if (!analysisId) {
|
|
48
|
+
setError('Analysis ID is missing.');
|
|
49
|
+
setIsLoading(false);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
setIsLoading(true);
|
|
54
|
+
try {
|
|
55
|
+
let analysisData: LocalAnalysis | null = null;
|
|
56
|
+
|
|
57
|
+
if (
|
|
58
|
+
remoteAnalysis &&
|
|
59
|
+
remoteAnalysis.status === 'completed' &&
|
|
60
|
+
remoteAnalysis.results
|
|
61
|
+
) {
|
|
62
|
+
// Cast results to expected shape since it's stored as Json
|
|
63
|
+
const results = remoteAnalysis.results as {
|
|
64
|
+
overallScore?: number;
|
|
65
|
+
overallMessage?: string;
|
|
66
|
+
analysis?: string;
|
|
67
|
+
confidence?: number;
|
|
68
|
+
traitScores?: Record<
|
|
69
|
+
string,
|
|
70
|
+
{
|
|
71
|
+
score: number;
|
|
72
|
+
feedback: string;
|
|
73
|
+
strengths?: string[];
|
|
74
|
+
improvements?: string[];
|
|
75
|
+
}
|
|
76
|
+
>;
|
|
77
|
+
recommendations?: string[];
|
|
78
|
+
analysisType?: string;
|
|
79
|
+
processingTime?: number;
|
|
80
|
+
};
|
|
81
|
+
analysisData = {
|
|
82
|
+
id: analysisId,
|
|
83
|
+
localImageUri: undefined,
|
|
84
|
+
aiResults: {
|
|
85
|
+
overallScore: results.overallScore,
|
|
86
|
+
overallMessage: results.overallMessage || results.analysis,
|
|
87
|
+
confidence: results.confidence,
|
|
88
|
+
traitScores: results.traitScores,
|
|
89
|
+
recommendations: results.recommendations,
|
|
90
|
+
analysisType: results.analysisType,
|
|
91
|
+
processingTime: results.processingTime,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
} else if (remoteAnalysis && remoteAnalysis.status === 'processing') {
|
|
95
|
+
setIsLoading(true);
|
|
96
|
+
return;
|
|
97
|
+
} else if (remoteAnalysis && remoteAnalysis.status === 'failed') {
|
|
98
|
+
setError('Analysis failed. Please try again.');
|
|
99
|
+
setIsLoading(false);
|
|
100
|
+
return;
|
|
101
|
+
} else if (!remoteAnalysis || remoteAnalysis.status === 'processing') {
|
|
102
|
+
analysisData = createMockAnalysis(analysisId);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (analysisData) {
|
|
106
|
+
setLocalAnalysis(analysisData);
|
|
107
|
+
|
|
108
|
+
const imageUrl = processImageUrl(
|
|
109
|
+
localImageUriParam || null,
|
|
110
|
+
localImageUrisParam || null,
|
|
111
|
+
analysisData.localImageUri ?? null,
|
|
112
|
+
);
|
|
113
|
+
setProcessedImageUrl(imageUrl ?? null);
|
|
114
|
+
|
|
115
|
+
if (analysisData.aiResults) {
|
|
116
|
+
const scores = extractScoresFromAnalysis(analysisData.aiResults);
|
|
117
|
+
setExtractedScores(scores);
|
|
118
|
+
|
|
119
|
+
if (scores) {
|
|
120
|
+
const achievements = getUnlockedAchievements(scores);
|
|
121
|
+
if (achievements.length > 0 && isFirstTime) {
|
|
122
|
+
console.log('Unlocked achievements:', achievements);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
} catch (_err) {
|
|
128
|
+
console.error('Error loading analysis:', _err);
|
|
129
|
+
setError('Failed to load analysis data.');
|
|
130
|
+
} finally {
|
|
131
|
+
setIsLoading(false);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
loadAnalysisData();
|
|
136
|
+
}, [
|
|
137
|
+
analysisId,
|
|
138
|
+
localImageUriParam,
|
|
139
|
+
localImageUrisParam,
|
|
140
|
+
isFirstTime,
|
|
141
|
+
remoteAnalysis,
|
|
142
|
+
]);
|
|
143
|
+
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (backendError) {
|
|
146
|
+
setError(backendError);
|
|
147
|
+
setIsLoading(false);
|
|
148
|
+
} else if (isBackendLoading) {
|
|
149
|
+
setIsLoading(true);
|
|
150
|
+
}
|
|
151
|
+
}, [backendError, isBackendLoading]);
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
localAnalysis,
|
|
155
|
+
isLoading,
|
|
156
|
+
error,
|
|
157
|
+
extractedScores,
|
|
158
|
+
processedImageUrl,
|
|
159
|
+
};
|
|
160
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { useLocalSearchParams, useRouter } from 'expo-router';
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import { Alert } from 'react-native';
|
|
4
|
+
import {
|
|
5
|
+
useAnimatedScrollHandler,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
} from 'react-native-reanimated';
|
|
8
|
+
|
|
9
|
+
import { formatTraitName, getTraitDetails } from '../services/analysis-service';
|
|
10
|
+
import { useAnalysisData } from './use-analysis-data';
|
|
11
|
+
|
|
12
|
+
export const useResultsScreen = () => {
|
|
13
|
+
const router = useRouter();
|
|
14
|
+
const { type, analysisId } = useLocalSearchParams<{
|
|
15
|
+
type: string;
|
|
16
|
+
analysisId: string;
|
|
17
|
+
}>();
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
localAnalysis,
|
|
21
|
+
isLoading,
|
|
22
|
+
error,
|
|
23
|
+
extractedScores,
|
|
24
|
+
processedImageUrl,
|
|
25
|
+
} = useAnalysisData();
|
|
26
|
+
|
|
27
|
+
const [imageLoadError, setImageLoadError] = useState(false);
|
|
28
|
+
const [isSubscribed] = useState(true);
|
|
29
|
+
const [showShareModal, setShowShareModal] = useState(false);
|
|
30
|
+
|
|
31
|
+
const scrollY = useSharedValue(0);
|
|
32
|
+
const scale = useSharedValue(1);
|
|
33
|
+
const scrollHandler = useAnimatedScrollHandler({
|
|
34
|
+
onScroll: (event) => {
|
|
35
|
+
scrollY.value = event.contentOffset.y;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const handleBackPress = useCallback(() => {
|
|
40
|
+
if (router.canGoBack()) {
|
|
41
|
+
router.back();
|
|
42
|
+
} else {
|
|
43
|
+
router.replace('/');
|
|
44
|
+
}
|
|
45
|
+
}, [router]);
|
|
46
|
+
|
|
47
|
+
const handleImageError = useCallback(() => {
|
|
48
|
+
setImageLoadError(true);
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
const handleTraitPress = useCallback(
|
|
52
|
+
(traitKey: string) => {
|
|
53
|
+
if (traitKey === 'overall') {
|
|
54
|
+
if (!localAnalysis?.aiResults || !extractedScores) {
|
|
55
|
+
Alert.alert('No Data', 'Overall analysis data is not available.');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const overallMessage =
|
|
60
|
+
localAnalysis.aiResults.overallMessage ||
|
|
61
|
+
localAnalysis.aiResults.analysis ||
|
|
62
|
+
'This is your overall analysis score based on all evaluated traits.';
|
|
63
|
+
|
|
64
|
+
router.push({
|
|
65
|
+
pathname: `/analysis/${type}/trait-details` as any,
|
|
66
|
+
params: {
|
|
67
|
+
analysisId,
|
|
68
|
+
traitKey: 'overall',
|
|
69
|
+
traitName: 'Overall Score',
|
|
70
|
+
score: extractedScores.overall.toString(),
|
|
71
|
+
feedback: overallMessage,
|
|
72
|
+
strengths: JSON.stringify([]),
|
|
73
|
+
improvements: JSON.stringify([]),
|
|
74
|
+
allScores: JSON.stringify(extractedScores),
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!localAnalysis?.aiResults?.traitScores) {
|
|
81
|
+
Alert.alert('No Data', 'Trait details are not available.');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const traitDetails = getTraitDetails(
|
|
86
|
+
traitKey,
|
|
87
|
+
localAnalysis.aiResults.traitScores,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
if (!traitDetails) {
|
|
91
|
+
Alert.alert('No Data', 'Details for this trait are not available.');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const formattedName = formatTraitName(traitKey);
|
|
96
|
+
|
|
97
|
+
router.push({
|
|
98
|
+
pathname: `/analysis/${type}/trait-details` as any,
|
|
99
|
+
params: {
|
|
100
|
+
analysisId,
|
|
101
|
+
traitKey,
|
|
102
|
+
traitName: formattedName,
|
|
103
|
+
score: traitDetails.score.toString(),
|
|
104
|
+
feedback: traitDetails.feedback,
|
|
105
|
+
strengths: JSON.stringify(traitDetails.strengths),
|
|
106
|
+
improvements: JSON.stringify(traitDetails.improvements),
|
|
107
|
+
allScores: JSON.stringify(extractedScores),
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
[localAnalysis, router, analysisId, extractedScores, type],
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const handleNewAnalysis = useCallback(() => {
|
|
115
|
+
// Use dynamic analysis route to maintain current analysis type context
|
|
116
|
+
const path = `/analysis/${type}/camera`;
|
|
117
|
+
router.push(path);
|
|
118
|
+
}, [type, router]);
|
|
119
|
+
|
|
120
|
+
const handleShareResults = useCallback(() => {
|
|
121
|
+
if (!localAnalysis || !extractedScores) {
|
|
122
|
+
Alert.alert('No Data', 'No analysis data available to share.');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
setShowShareModal(true);
|
|
127
|
+
}, [localAnalysis, extractedScores]);
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
isDarkMode: false,
|
|
131
|
+
type,
|
|
132
|
+
analysisId,
|
|
133
|
+
localAnalysis,
|
|
134
|
+
isLoading,
|
|
135
|
+
error,
|
|
136
|
+
extractedScores,
|
|
137
|
+
imageLoadError,
|
|
138
|
+
processedImageUrl,
|
|
139
|
+
isSubscribed,
|
|
140
|
+
showShareModal,
|
|
141
|
+
scrollY,
|
|
142
|
+
scale,
|
|
143
|
+
handleBackPress,
|
|
144
|
+
handleImageError,
|
|
145
|
+
handleTraitPress,
|
|
146
|
+
handleNewAnalysis,
|
|
147
|
+
handleShareResults,
|
|
148
|
+
setShowShareModal,
|
|
149
|
+
scrollHandler,
|
|
150
|
+
};
|
|
151
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { FontAwesome5 } from '@expo/vector-icons';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { Text, View } from 'react-native';
|
|
4
|
+
import Animated, {
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
withSequence,
|
|
8
|
+
withTiming,
|
|
9
|
+
} from 'react-native-reanimated';
|
|
10
|
+
|
|
11
|
+
import { useResponsiveSize } from '@/lib/hooks';
|
|
12
|
+
import { useThemeConfig } from '@/lib/use-theme-config';
|
|
13
|
+
|
|
14
|
+
type AchievementBadgeProps = {
|
|
15
|
+
title: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
color: string;
|
|
18
|
+
unlocked: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function AchievementBadge({
|
|
22
|
+
title,
|
|
23
|
+
icon,
|
|
24
|
+
color,
|
|
25
|
+
unlocked,
|
|
26
|
+
}: AchievementBadgeProps) {
|
|
27
|
+
const theme = useThemeConfig();
|
|
28
|
+
const isDarkMode = theme.dark;
|
|
29
|
+
const scale = useSharedValue(1);
|
|
30
|
+
const { isTablet } = useResponsiveSize();
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (unlocked) {
|
|
33
|
+
scale.value = withSequence(
|
|
34
|
+
withTiming(1.2, { duration: 300 }),
|
|
35
|
+
withTiming(1, { duration: 300 }),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}, [unlocked, scale]);
|
|
39
|
+
|
|
40
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
41
|
+
return {
|
|
42
|
+
transform: [{ scale: scale.value }],
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Animated.View className="items-center" style={animatedStyle}>
|
|
48
|
+
<View
|
|
49
|
+
className={`${isTablet ? 'size-16' : 'size-11'} items-center justify-center rounded-full ${
|
|
50
|
+
unlocked ? 'shadow-lg' : 'opacity-40'
|
|
51
|
+
}`}
|
|
52
|
+
style={{
|
|
53
|
+
backgroundColor: unlocked ? color : '#9ca3af',
|
|
54
|
+
shadowColor: unlocked ? color : 'transparent',
|
|
55
|
+
shadowOffset: { width: 0, height: 4 },
|
|
56
|
+
shadowOpacity: 0.3,
|
|
57
|
+
shadowRadius: 6,
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<FontAwesome5 name={icon} size={isTablet ? 26 : 16} color="white" />
|
|
61
|
+
{/* {!unlocked && (
|
|
62
|
+
<View className="absolute inset-0 items-center justify-center backdrop-blur-sm">
|
|
63
|
+
<FontAwesome5 name="lock" size={16} color="white" />
|
|
64
|
+
</View>
|
|
65
|
+
)} */}
|
|
66
|
+
</View>
|
|
67
|
+
<Text
|
|
68
|
+
className={`${isTablet ? 'text-lg' : 'text-[12.5px]'} mt-1 font-semibold ${
|
|
69
|
+
isDarkMode ? 'text-neutral-300' : 'text-neutral-600'
|
|
70
|
+
}`}
|
|
71
|
+
style={unlocked ? { color } : undefined}
|
|
72
|
+
>
|
|
73
|
+
{title}
|
|
74
|
+
</Text>
|
|
75
|
+
</Animated.View>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { Text } from '@/components/ui';
|
|
5
|
+
import { useThemeConfig } from '@/lib/use-theme-config';
|
|
6
|
+
|
|
7
|
+
import type { Achievement } from '../../services/analysis-service';
|
|
8
|
+
|
|
9
|
+
type AchievementCardProps = {
|
|
10
|
+
achievement: Achievement;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function AchievementCard({
|
|
15
|
+
achievement,
|
|
16
|
+
className = '',
|
|
17
|
+
}: AchievementCardProps) {
|
|
18
|
+
const theme = useThemeConfig();
|
|
19
|
+
const isDarkMode = theme.dark;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<View
|
|
23
|
+
className={`flex-row items-center rounded-xl p-3 ${
|
|
24
|
+
isDarkMode ? 'bg-neutral-700/50' : 'bg-neutral-50'
|
|
25
|
+
} ${className}`}
|
|
26
|
+
style={{
|
|
27
|
+
borderLeftWidth: 3,
|
|
28
|
+
borderLeftColor: achievement.color,
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{/* Achievement Icon */}
|
|
32
|
+
<View
|
|
33
|
+
className="mr-3 size-10 items-center justify-center rounded-full"
|
|
34
|
+
style={{ backgroundColor: `${achievement.color}20` }}
|
|
35
|
+
>
|
|
36
|
+
<Ionicons
|
|
37
|
+
name={achievement.icon as keyof typeof Ionicons.glyphMap}
|
|
38
|
+
size={20}
|
|
39
|
+
color={achievement.color}
|
|
40
|
+
/>
|
|
41
|
+
</View>
|
|
42
|
+
|
|
43
|
+
{/* Achievement Details */}
|
|
44
|
+
<View className="flex-1">
|
|
45
|
+
<Text
|
|
46
|
+
className={`font-semibold ${
|
|
47
|
+
isDarkMode ? 'text-white' : 'text-neutral-900'
|
|
48
|
+
}`}
|
|
49
|
+
>
|
|
50
|
+
{achievement.title}
|
|
51
|
+
</Text>
|
|
52
|
+
<Text
|
|
53
|
+
className={`text-sm ${
|
|
54
|
+
isDarkMode ? 'text-neutral-400' : 'text-neutral-600'
|
|
55
|
+
}`}
|
|
56
|
+
>
|
|
57
|
+
{achievement.description}
|
|
58
|
+
</Text>
|
|
59
|
+
</View>
|
|
60
|
+
|
|
61
|
+
{/* Points Badge */}
|
|
62
|
+
<View
|
|
63
|
+
className="rounded-full px-2 py-1"
|
|
64
|
+
style={{ backgroundColor: `${achievement.color}15` }}
|
|
65
|
+
>
|
|
66
|
+
<Text
|
|
67
|
+
className="text-xs font-medium"
|
|
68
|
+
style={{ color: achievement.color }}
|
|
69
|
+
>
|
|
70
|
+
+{achievement.points}
|
|
71
|
+
</Text>
|
|
72
|
+
</View>
|
|
73
|
+
</View>
|
|
74
|
+
);
|
|
75
|
+
}
|