stack icon indicating copy to clipboard operation
stack copied to clipboard

Better dashboard onboarding process

Open fomalhautb opened this issue 9 months ago • 4 comments


[!IMPORTANT] Enhance dashboard onboarding with setup instructions and metrics visualization, and update backend for setup code handling.

  • Backend:
    • Add SETUP to VerificationCodeType in schema.prisma.
    • Create setup-code-handler.tsx for generating setup codes with createVerificationCodeHandler.
    • Add route.tsx and verify/route.tsx for handling setup key requests.
  • Dashboard:
    • Add SetupPage in setup-page.tsx for onboarding new users with setup instructions.
    • Modify MetricsPage in metrics-page.tsx to display user metrics.
    • Use useThemeWatcher in globe.tsx for theme-based globe rendering.
    • Add globeImages in utils.tsx for light and dark mode globe images.
    • Update PageClient in page-client.tsx to conditionally render SetupPage or MetricsPage based on user count.
    • Update layout.tsx to remove OnboardingDialog.
  • Init-Stack:
    • Add --api-url and --token options to CLI in index.ts.
    • Implement fetchKeys and writeEnvVars to handle API keys and environment variables.

This description was created by Ellipsis for 2bba7356835303b62bfb16ea76793df03ee22433. It will automatically update as commits are pushed.

fomalhautb avatar Apr 04 '25 17:04 fomalhautb

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stack-backend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2025 6:24am
stack-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2025 6:24am
stack-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2025 6:24am

vercel[bot] avatar Apr 04 '25 17:04 vercel[bot]

⚠️ Only 5 files will be analyzed due to processing limits.

recurseml[bot] avatar Apr 04 '25 17:04 recurseml[bot]

😱 Found 1 issue. Time to roll up your sleeves! 😱

🗒️ View all ignored comments in this repo
  • The constraint 'TokenStoreType extends string' is too restrictive. It should likely be 'TokenStoreType extends string | object' to match the condition check in line 113 where TokenStoreType is checked against {}
  • Return type mismatch - the interface declares useUsers() returning ServerUser[] but the Team interface that this extends declares useUsers() returning TeamUser[]
  • There is a syntax error in the super constructor call due to the ellipsis operator used incorrectly. Objects aren't being merged correctly. This syntax usage can lead to runtime errors when trying to pass the merged object to 'super()'. Verify that the intended alterations to the object occur before or outside of the super() call if needed.
  • Throwing an error when no active span is found is too aggressive. The log function should gracefully fallback to console.log or another logging mechanism when there's no active span, since not all execution contexts will have an active span. This makes the code less resilient and could break functionality in non-traced environments.

📚 Relevant Docs

  • Function sets backendContext with a new configuration but doesn't pass 'defaultProjectKeys'. Since defaultProjectKeys is required in the type definition and cannot be updated (throws error if tried to set), this will cause a type error.
  • The schema is using array syntax for pick() which is incorrect for Yup schemas. The pick() method in Yup expects individual arguments, not an array. Should be changed to: emailConfigSchema.pick('type', 'host', 'port', 'username', 'sender_name', 'sender_email')

📚 Relevant Docs

  • Creating a refresh token with current timestamp as expiration means it expires immediately. Should set a future date for token expiration.
  • The 'tools' object is initialized as an empty object, even though 'tools' is presumably expected to contain tool definitions. This could cause the server capabilities to lack necessary tool configurations, thus potentially impacting functionalities that depend on certain tool setups.

📚 Relevant Docs

  • 'STACK_SECRET_SERVER_KEY' is potentially being included in every request header without checking its existence again here. Although it's checked during initialization, this could lead to security issues as it's exposed in all communications where the header is logged or captured.

📚 Relevant Docs

  • When adding 'use client' directive at the beginning, it doesn't check if file.text already contains the 'use client' directive. This could lead to duplicate 'use client' directives if the file already has one.

📚 Relevant Docs

recurseml[bot] avatar Apr 04 '25 17:04 recurseml[bot]

Documentation Changes Required

  1. packages/init-stack/README.md

    • Update the Options section to include new command line options:
      - `--api-url <url>`: Stack Auth API URL
      - `--token <token>`: Token to fetch Stack Auth keys
      
    • These new options allow programmatic access to fetch Stack Auth keys without manual intervention through the browser, which is relevant for automation scenarios.
  2. StackAdminApp Type

    • Add a new method to the StackAdminApp type:
      createSetupCode(): Promise<{ code: string }>
      
  3. _StackAdminAppImplIncomplete

    • Implement the new createSetupCode() method that calls the interface's createSetupCode() method and returns its response.
  4. Reordering of Imports

    • In packages/stack-ui/src/components/copy-button.tsx, move 'forwardRefIfNeeded' before other imports.
    • In files related to AdminProject* and AdminTeam*, reorder the imports (non-functional change).

Note: Several files were analyzed and found to require no changes, including internal API endpoints, UI changes, and implementation details that don't affect public SDK or documentation.

patched-codes[bot] avatar Apr 04 '25 17:04 patched-codes[bot]