Skip to content

Templates Filters ordered alphabetically#2434

Closed
AQIB-NAWAB wants to merge 6 commits intounkeyed:mainfrom
AQIB-NAWAB:filters-ordered-alphabetically
Closed

Templates Filters ordered alphabetically#2434
AQIB-NAWAB wants to merge 6 commits intounkeyed:mainfrom
AQIB-NAWAB:filters-ordered-alphabetically

Conversation

@AQIB-NAWAB
Copy link

@AQIB-NAWAB AQIB-NAWAB commented Oct 15, 2024

What does this PR do?

Templates Filters ordered alphabetically

Fixes # #2432

Type of change

Templates Filters ordered alphabetically

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • [ x] Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

Visit the https://www.unkey.com/templates

Checklist

Required

  • [ x] Filled out the "How to test" section in this PR
  • [ x] Read Contributing Guide
  • [ x] Self-reviewed my own code
  • [ x] Commented on my code in hard-to-understand areas
  • [ x] Ran pnpm build
  • [ x] Ran pnpm fmt
  • [ x] Checked for warnings, there are none
  • [ x] Removed all console.logs
  • [ x] Merged the latest changes from main onto my branch with git pull origin main
  • [ x] My changes don't cause any responsiveness issues

Appreciated

  • [x ] If a UI change was made: Added a screen recording or screenshots to this PR

image

  • Updated the Unkey Docs if changes were necessary

Summary by CodeRabbit

  • New Features

    • Enhanced error messages for email promotion and verification processes, providing clearer feedback to users.
    • Introduced new frameworks and templates, including "Actix", "Axum", "Bun", "Echo", "Express", "FastAPI", "NestJS", "Next.js", "Oak", "Rocket", "Svelte", and new templates like "bun-koyeb" and "elixir-mix-supervision".
  • Improvements

    • Updated and reorganized frameworks and templates for better clarity and accessibility.
    • Improved API definitions for better understanding and consistency, including clearer request and response structures.
  • Bug Fixes

    • Resolved issues with error handling to deliver more informative messages during user email updates and verifications.

@changeset-bot
Copy link

changeset-bot bot commented Oct 15, 2024

⚠️ No Changeset found

Latest commit: 0c61f36

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Oct 15, 2024

@AQIB-NAWAB is attempting to deploy a commit to the Unkey Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Oct 15, 2024

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

Name Status Preview Comments Updated (UTC)
engineering ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2024 1:38am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 15, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request focus on enhancing error handling in the UpdateUserEmail and VerificationForm components to provide clearer error messages. Additionally, the data.ts file has been reorganized, updating the frameworks and templates arrays with new entries and sorting them alphabetically. The openapi.d.ts file has undergone significant modifications to type definitions and request/response structures, improving clarity and consistency across various API operations.

Changes

File Path Change Summary
apps/dashboard/app/(app)/settings/user/update-user-email.tsx Updated error handling in UpdateUserEmail and VerificationForm components to provide more specific error messages related to email promotion and verification processes.
apps/www/app/templates/data.ts Reordered frameworks array alphabetically and updated it with new entries. Modified templates object by removing several entries and adding new templates with detailed information while retaining existing ones.
apps/www/app/templates/client.tsx Changed frameworks variable from const to let, allowing reassignment, and added sorting of the frameworks object alphabetically. Enhanced type safety with explicit type definition.
packages/api/src/openapi.d.ts Reformatted type definitions and request/response bodies for various API operations, improved clarity, marked several methods as deprecated, and enhanced overall formatting for better readability and maintainability.

Possibly related issues

Suggested reviewers

  • chronark
  • mcstepp

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 15, 2024

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.
Here is an example:

<type>[optional scope]: <description>
fix: I fixed something for Unkey

Details:

No release type found in pull request title "Templates Filters ordered alphabetically". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@chronark chronark self-assigned this Oct 15, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (15)
apps/dashboard/app/(app)/settings/user/update-user-email.tsx (1)

190-190: Improved error handling for email promotion.

The change to use ClerkError instead of Error provides more specific error information, which is a good improvement. This aligns well with the PR objective of enhancing error handling.

For consistency, consider using optional chaining here as well, similar to the change in the VerificationForm component:

toast.error((e as ClerkError)?.errors.at(0)?.longMessage ?? "Error promoting email");

This would provide a fallback message in case the expected error structure is not present.

apps/www/app/templates/data.ts (3)

Line range hint 74-74: Typo in 'framework' in the 'rust-axum' template description.

In line 74, the word "framwork" is misspelled in the description of the 'rust-axum' template. It should be "framework".

Apply this diff to correct the typo:

- description: "A Rust API service using Unkey for API key validation with the Axum framwork.",
+ description: "A Rust API service using Unkey for API key validation with the Axum framework.",

18-18: Consistent casing for 'TypeScript' in 'languages' array.

In the 'languages' array, "Typescript" should be capitalized as "TypeScript" to match the official casing.

Apply this diff to update the casing:

- export const languages = ["Typescript", "Python", "Golang", "Rust", "Elixir"] as const;
+ export const languages = ["TypeScript", "Python", "Golang", "Rust", "Elixir"] as const;

Ensure that all occurrences of "Typescript" in the file are updated to "TypeScript" for consistency.


Line range hint 153-165: Inconsistent 'authors' field formatting across templates.

There is inconsistency in how 'authors' are listed in the templates. Some templates use GitHub usernames, while others use personal names. For consistency, consider standardizing the format.

  • Decide on a standard (e.g., always use GitHub usernames) and update the 'authors' fields accordingly.

Example diff for the 'nextjs-expiration' template:

- authors: ["ethan-stone"],
+ authors: ["ethanstone"], // Replace with the correct GitHub username
packages/api/src/openapi.d.ts (11)

599-613: Refactor the ratelimit configuration for consistency.

The ratelimits property in the V1KeysVerifyKeyRequest interface has been updated to use a more consistent and clear structure for defining ratelimits. The changes include:

  • Using cost instead of tokens for specifying the cost of the operation.
  • Using duration instead of window for specifying the duration of the ratelimit window.
  • Removing the refillRate and refillInterval properties as they are not used in this context.

To further improve consistency, consider applying similar changes to other places where ratelimits are defined, such as in the createKey and updateKey request bodies.


Line range hint 1294-1326: Refactor the ratelimit configuration for consistency.

The ratelimit property in the updateKey request body has been updated to use a more consistent and clear structure for defining ratelimits. The changes include:

  • Using async instead of type for specifying the ratelimiting mode.
  • Using duration instead of refillInterval for specifying the duration of the ratelimit window.
  • Deprecating the refillRate and refillInterval properties in favor of limit and duration.

To further improve consistency, consider applying similar changes to other places where ratelimits are defined, such as in the createKey request body and the V1KeysVerifyKeyRequest interface.


1370-1379: Added support for creating roles and permissions during key update.

The roles property in the updateKey request body has been updated to allow specifying roles using either their id or name. Additionally, a new create property has been introduced to enable automatically creating roles if they don't exist when specifying them by name.

Consider adding a comment to clarify that the create property only works when specifying roles by name and that it requires the rbac.*.create_role permission.


1397-1406: Added support for creating permissions during key update.

The permissions property in the updateKey request body has been updated to allow specifying permissions using either their id or name. Additionally, a new create property has been introduced to enable automatically creating permissions if they don't exist when specifying them by name.

Consider adding a comment to clarify that the create property only works when specifying permissions by name and that it requires the rbac.*.create_permission permission.


1632-1641: Added support for creating permissions when adding them to a key.

The permissions property in the request body of the addPermissions operation has been updated to allow specifying permissions using either their id or name. Additionally, a new create property has been introduced to enable automatically creating permissions if they don't exist when specifying them by name.

Consider adding a comment to clarify that the create property only works when specifying permissions by name and that it requires the rbac.*.create_permission permission.


1905-1914: Added support for creating roles when adding them to a key.

The roles property in the request body of the addRoles operation has been updated to allow specifying roles using either their id or name. Additionally, a new create property has been introduced to enable automatically creating roles if they don't exist when specifying them by name.

Consider adding a comment to clarify that the create property only works when specifying roles by name and that it requires the rbac.*.create_role permission.


2080-2089: Added support for creating roles when setting them on a key.

The roles property in the request body of the setRoles operation has been updated to allow specifying roles using either their id or name. Additionally, a new create property has been introduced to enable automatically creating roles if they don't exist when specifying them by name.

Consider adding a comment to clarify that the create property only works when specifying roles by name and that it requires the rbac.*.create_role permission.


Line range hint 2654-2801: Improved structure for bulk key creation.

The request body of the v1.migrations.createKeys operation has been updated to accept an array of key configurations. This allows for bulk creation of keys in a single request. Each key configuration object includes properties for specifying the API ID, prefix, name, plaintext or hash, owner ID, metadata, roles, permissions, expiration, remaining requests, refill settings, ratelimit settings, enabled status, and environment.

Consider adding comments to clarify the purpose and usage of each property in the key configuration object.


2864-3016: Added support for bulk key enqueuing.

The v1.migrations.enqueueKeys operation has been introduced to allow enqueuing keys for migration. The request body accepts a migration ID, API ID, and an array of key configurations. Each key configuration object includes properties for specifying the prefix, name, plaintext or hash, start characters, owner ID, metadata, roles, permissions, expiration, remaining requests, refill settings, ratelimit settings, enabled status, and environment.

Consider adding comments to clarify the purpose and usage of each property in the key configuration object.


3656-3671: Added support for attaching ratelimits to identities.

The ratelimits property has been added to the request body of the createIdentity operation. This allows attaching ratelimits to an identity during creation. Each ratelimit object includes properties for specifying the name, limit, and duration of the ratelimit window.

Consider adding comments to clarify the purpose and usage of each property in the ratelimit object.


3947-3962: Added support for updating ratelimits on identities.

The ratelimits property has been added to the request body of the updateIdentity operation. This allows updating the ratelimits associated with an identity. Setting an empty array will delete all existing ratelimits. Each ratelimit object includes properties for specifying the name, limit, and duration of the ratelimit window.

Consider adding comments to clarify the purpose and usage of each property in the ratelimit object.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c6373b4 and 9c50268.

📒 Files selected for processing (3)
  • apps/dashboard/app/(app)/settings/user/update-user-email.tsx (2 hunks)
  • apps/www/app/templates/data.ts (5 hunks)
  • packages/api/src/openapi.d.ts (33 hunks)
🧰 Additional context used
🔇 Additional comments (22)
apps/dashboard/app/(app)/settings/user/update-user-email.tsx (2)

345-345: Improved error handling for email verification.

This change enhances the error handling by using ClerkError for more specific error information. The addition of optional chaining and a fallback message improves the robustness of the error handling. This is a good improvement that aligns well with the PR objectives.


Line range hint 1-385: Overall assessment of changes in update-user-email.tsx

The changes made in this file successfully improve the error handling for both email promotion and verification processes. These enhancements align well with the PR objectives and contribute to a better user experience by providing more specific and robust error messages.

No other significant changes or issues were observed in the file. The modifications are focused and effective in addressing the intended improvements.

apps/www/app/templates/data.ts (1)

198-198: 🛠️ Refactor suggestion

Use GitHub username in 'authors' field for consistency.

In the 'unkey-trpc-ratelimit' template, the 'authors' field is set to ["Michael"]. For consistency with other templates, consider using the GitHub username instead of the personal name.

If the GitHub username is known, apply this diff:

- authors: ["Michael"],
+ authors: ["github_username"], // Replace 'github_username' with the actual username

Likely invalid or redundant comment.

packages/api/src/openapi.d.ts (19)

6-6: LGTM!

The empty line is fine and improves readability.


9-10: Improved formatting for better readability.

The changes to the XOR and OneOf type definitions improve the formatting and readability of the code. The use of parentheses in the XOR type and the consistent indentation in the OneOf type enhance clarity.


550-554: Improved formatting for better readability.

The changes to the PermissionQuery type definition improve the formatting and readability of the code. The consistent indentation and line breaks enhance clarity.


1339-1347: Improved typing for the refill property.

The refill property in the updateKey request body has been updated to use a more precise type definition. The interval property now explicitly specifies the allowed values using an enum, and the amount property is marked as required.


1556-1576: Improved structure for usage data.

The verifications property in the response of the getVerifications operation has been updated to use a more structured format for representing usage data. Each item in the array now includes properties for the timestamp, successful requests, rate-limited requests, and usage-exceeded requests.


1650-1660: Improved structure for returned permissions.

The response of the addPermissions operation has been updated to return an array of permissions with a more consistent structure. Each permission object now includes an id property for the internal permission ID and a name property for the permission name.


1725-1729: Improved structure for specifying permissions to remove.

The permissions property in the request body of the removePermissions operation has been updated to allow specifying permissions using either their id or name. This provides more flexibility when removing permissions from a key.


1825-1835: Improved structure for returned permissions.

The response of the setPermissions operation has been updated to return an array of permissions with a more consistent structure. Each permission object now includes an id property for the internal permission ID and a name property for the permission name.


1923-1933: Improved structure for returned roles.

The response of the addRoles operation has been updated to return an array of roles with a more consistent structure. Each role object now includes an id property for the internal role ID and a name property for the role name.


1998-2002: Improved structure for specifying roles to remove.

The roles property in the request body of the removeRoles operation has been updated to allow specifying roles using either their id or name. This provides more flexibility when removing roles from a key.


2098-2108: Improved structure for returned roles.

The response of the setRoles operation has been updated to return an array of roles with a more consistent structure. Each role object now includes an id property for the internal role ID and a name property for the role name.


2804-2818: Improved response structure for bulk key creation.

The response of the v1.migrations.createKeys operation has been updated to return an array of key IDs for the created keys. This provides a clear and concise way to retrieve the IDs of the newly created keys.


3287-3302: Improved structure for returned permissions.

The response of the listPermissions operation has been updated to return an array of permissions with a more consistent structure. Each permission object now includes an id property for the internal permission ID, a name property for the permission name, and an optional description property for the permission description.


3565-3580: Improved structure for returned roles.

The response of the listRoles operation has been updated to return an array of roles with a more consistent structure. Each role object now includes an id property for the internal role ID, a name property for the role name, and an optional description property for the role description.


3754-3769: Improved structure for returned ratelimits.

The response of the getIdentity operation has been updated to include a ratelimits property, which is an array of ratelimit objects. Each ratelimit object includes properties for the name, limit, and duration of the ratelimit window.


3832-3853: Improved structure for returned identities.

The response of the listIdentities operation has been updated to return an array of identities with a more consistent structure. Each identity object now includes an id property for the internal identity ID, an externalId property for the external identity ID, and a ratelimits property for the associated ratelimits.


3991-4006: Improved structure for returned ratelimits.

The response of the updateIdentity operation has been updated to include a ratelimits property, which is an array of ratelimit objects. Each ratelimit object includes properties for the name, limit, and duration of the ratelimit window.


524-524: Verify the addition of new verification result codes.

The code property in the V1KeysVerifyKeyResponse interface has been updated to include new possible values such as DISABLED, INSUFFICIENT_PERMISSIONS, and EXPIRED.

Ensure that the backend implementation correctly returns these new codes in the appropriate scenarios and that the frontend handles them properly.

#!/bin/bash

# Description: Verify the backend returns the new codes and the frontend handles them.

# Test: Search for the usage of the new codes in the backend. Expect: Should find relevant occurrences.
rg --type go $'DISABLED|INSUFFICIENT_PERMISSIONS|EXPIRED'

# Test: Search for the handling of the new codes in the frontend. Expect: Should find relevant occurrences.  
rg --type typescript $'DISABLED|INSUFFICIENT_PERMISSIONS|EXPIRED'

4368-4368: Verify the addition of new verification result codes.

The code property in the response of the deprecated verifyKey operation has been updated to include new possible values such as DISABLED, INSUFFICIENT_PERMISSIONS, and EXPIRED.

Ensure that the backend implementation correctly returns these new codes in the appropriate scenarios and that the frontend handles them properly.

✅ Verification successful

Verification Successful: New verification result codes are properly implemented and handled in both backend and frontend.

  • Backend implementations correctly return DISABLED, INSUFFICIENT_PERMISSIONS, and EXPIRED codes.
  • Frontend components and handlers appropriately manage the new codes.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash

# Description: Verify the backend returns the new codes and the frontend handles them.

# Test: Search for the usage of the new codes in the backend. Expect: Should find relevant occurrences.
rg --type go $'DISABLED|INSUFFICIENT_PERMISSIONS|EXPIRED' 

# Test: Search for the handling of the new codes in the frontend. Expect: Should find relevant occurrences.
rg --type typescript $'DISABLED|INSUFFICIENT_PERMISSIONS|EXPIRED'

Length of output: 258


Script:

#!/bin/bash

# Description: Re-verify the backend and frontend for the new verification result codes.

# Test: Search for the usage of the new codes in the backend without type restriction.
rg 'DISABLED|INSUFFICIENT_PERMISSIONS|EXPIRED' --type go

# Test: Search for the handling of the new codes in the frontend using correct TypeScript file types.
rg 'DISABLED|INSUFFICIENT_PERMISSIONS|EXPIRED' --type ts --type tsx

Length of output: 254


Script:

#!/bin/bash

# Description: Re-verify the backend and frontend for the new verification result codes with adjusted search parameters.

# Test: Search for the usage of the new codes in the backend without type restriction.
rg 'DISABLED|INSUFFICIENT_PERMISSIONS|EXPIRED'

# Test: Search for the handling of the new codes in the frontend by specifying file extensions explicitly.
rg 'DISABLED|INSUFFICIENT_PERMISSIONS|EXPIRED' --glob '*.ts' --glob '*.tsx'

Length of output: 13428

title: "Unkey + Elixir Mix Supervision",
description: "A simple example of using the Unkey Elixir SDK.",
authors: ["glamboyosa"],
repository: "https://github.com/unkeyed/unkey/examples/main/elixir_mix_supervision_example",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Incorrect repository URL in 'elixir-mix-supervision' template.

The 'repository' URL for the 'elixir-mix-supervision' template appears to be incorrect. It currently points to:

https://github.com/unkeyed/unkey/examples/main/elixir_mix_supervision_example

It should likely be:

https://github.com/unkeyed/examples/tree/main/elixir_mix_supervision_example

Apply this diff to fix the repository URL:

- repository: "https://github.com/unkeyed/unkey/examples/main/elixir_mix_supervision_example",
+ repository: "https://github.com/unkeyed/examples/tree/main/elixir_mix_supervision_example",

"cost-ratelimit": {
title: "Cost based Ratelimiting",
description: "Ratelimit your AI application based on estimated cost",
authors: ["hashsbhat"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Typo in 'authors' field in 'cost-ratelimit' template.

The 'authors' field has a typo in the username. It's written as "hashsbhat" but should be "harshsbhat", matching the username in the repository URL.

Apply this diff to correct the author's username:

- authors: ["hashsbhat"],
+ authors: ["harshsbhat"],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
authors: ["hashsbhat"],
authors: ["harshsbhat"],

Copy link

@0xJaskeerat 0xJaskeerat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AQIB-NAWAB

Do resolve the merge conflicts after you are done with changes
Do leme know if you need any help

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
apps/www/app/templates/client.tsx (1)

Line range hint 58-83: LGTM! Consider a minor optimization for framework sorting.

The changes to the frameworks variable declaration and sorting look good. The transition from const to let, addition of type annotation, and the alphabetical sorting of frameworks align well with the PR objective.

Consider combining the initial reduction and sorting into a single operation for slightly improved efficiency:

const frameworks: Partial<Record<Framework, number>> = Object.fromEntries(
  Object.entries(
    Object.values(templates).reduce(
      (acc, { framework }) => {
        if (framework) {
          acc[framework] = (acc[framework] || 0) + 1;
        }
        return acc;
      },
      {} as Record<Framework, number>
    )
  ).sort(([a], [b]) => a.localeCompare(b))
);

This approach eliminates the need for the let declaration and performs the sorting in a single pass.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9c50268 and 529af34.

⛔ Files ignored due to path filters (1)
  • apps/www/public/images/templates/nextjs-supabase-payasyougo.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • apps/dashboard/app/(app)/settings/user/update-user-email.tsx (1 hunks)
  • apps/www/app/templates/client.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/app/(app)/settings/user/update-user-email.tsx
🧰 Additional context used
🔇 Additional comments (1)
apps/www/app/templates/client.tsx (1)

Line range hint 58-83: Positive impact on user interface noted.

The alphabetical sorting of frameworks will improve the user experience by presenting the framework filter checkboxes in a more organized and easily navigable order. This change aligns well with the PR objective of enhancing the ordering of template filters.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
apps/www/app/templates/data.ts (1)

Line range hint 4-19: Frameworks array is not sorted alphabetically and contains duplicates

The frameworks array should be sorted alphabetically to improve readability and maintainability, as indicated by the comment on line 3. Additionally, there's a duplicate entry for "Django" in the array.

Apply this diff to sort the array alphabetically and remove the duplicate:

 export const frameworks = [
-  "Django",
-  "Next.js",
-  "Svelte",
-  "Express",
-  "Bun",
-  "Echo",
-  "Flask",
-  "Django",
-  "Axum",
-  "Actix",
-  "Rocket",
-  "Oak",
-  "FastAPI",
-  "NestJS",
+  "Actix",
+  "Axum",
+  "Bun",
+  "Django",
+  "Echo",
+  "Express",
+  "FastAPI",
+  "Flask",
+  "NestJS",
+  "Next.js",
+  "Oak",
+  "Rocket",
+  "Svelte",
 ] as const;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 529af34 and 41d5466.

📒 Files selected for processing (1)
  • apps/www/app/templates/data.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
apps/www/app/templates/data.ts (3)

Line range hint 89-91: Duplicate comment from previous review

The 'authors' field in the 'cost-ratelimit' template still contains a typo. The username is written as "hashsbhat" but should be "harshsbhat" to match the correct GitHub username.


Line range hint 135-147: Duplicate comment from previous review

There's a typo in the template key 'nextjs-boilderplate'; it should be 'nextjs-boilerplate' to match the standard spelling.


Line range hint 241-252: Duplicate comment from previous review

The repository URL in the 'elixir-mix-supervision' template appears to be incorrect. It should likely be:

https://github.com/unkeyed/examples/tree/main/elixir_mix_supervision_example

instead of the current URL.

@AQIB-NAWAB
Copy link
Author

AQIB-NAWAB commented Oct 16, 2024

@0xJaskeerat i dynamically ordered the templates
Uploading image.png…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants