Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new label to app tiles in the app store #1407

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

hex-developer
Copy link
Contributor

This PR addresses issue #899.

Changes

  • A new created field for config.json. It stores the time the app was added to the app store as a UNIX timestamp (with milliseconds). It should ideally be set by CI when a new app is merged.
  • API also returns app creation date when queried for apps.
  • App store tile code now shows a NEW label next to the title if the app is less than 2 weeks old. Comparison happens on client using the timestamp provided by the API.

Copy link
Contributor

coderabbitai bot commented May 14, 2024

Walkthrough

The recent changes introduce a new created field to the appInfoSchema, which tracks the creation date of apps. This addition is leveraged in the AppStoreTile component to display a "new" badge for recently created apps. Additionally, the checkPasswordChangeRequest method in the authentication service now includes logic to validate password change requests based on file data. Lastly, the getAvailableApps function is updated to include the created field in its returned data.

Changes

File Path Summary of Changes
packages/shared/src/schemas/app-schemas.ts Added a created field to appInfoSchema, which is an optional integer representing the app's creation date.
src/app/(dashboard)/app-store/components/AppStoreTile/AppStoreTile.tsx Updated to display a "new" badge for apps created within the last 14 days.
src/server/services/auth/auth.service.ts Enhanced checkPasswordChangeRequest method to read and validate expiry time from a file.
src/server/services/apps/apps.helpers.ts Modified getAvailableApps function to include the created field in the returned app data.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant AppStoreTile
    participant AppService

    User->>AppStoreTile: View App Store
    AppStoreTile->>AppService: Fetch Apps
    AppService-->>AppStoreTile: Return Apps with `created` field
    AppStoreTile->>AppStoreTile: Determine if App is New
    AppStoreTile-->>User: Display Apps with "New" Badge if Applicable
sequenceDiagram
    participant AuthService
    participant FileSystem

    AuthService->>FileSystem: Check if Password Change File Exists
    FileSystem-->>AuthService: Return File Status
    AuthService->>FileSystem: Read File Content
    FileSystem-->>AuthService: Return File Content
    AuthService->>AuthService: Validate Expiry Time from File Content

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

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: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 819ce6d and 4d44f77.
Files ignored due to path filters (1)
  • src/client/messages/en.json is excluded by !**/*.json
Files selected for processing (3)
  • packages/shared/src/schemas/app-schemas.ts (1 hunks)
  • src/app/(dashboard)/app-store/components/AppStoreTile/AppStoreTile.tsx (1 hunks)
  • src/server/services/apps/apps.helpers.ts (1 hunks)
Additional comments not posted (2)
packages/shared/src/schemas/app-schemas.ts (1)

83-83: The addition of the created field to the appInfoSchema looks good and follows best practices.

src/server/services/apps/apps.helpers.ts (1)

72-79: Including the created property in the return structure of the getAvailableApps function looks good.

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 4d44f77 and 26d8ad1.
Files selected for processing (1)
  • src/app/(dashboard)/app-store/components/AppStoreTile/AppStoreTile.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/app/(dashboard)/app-store/components/AppStoreTile/AppStoreTile.tsx

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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 26d8ad1 and a12e301.
Files ignored due to path filters (1)
  • src/client/messages/en.json is excluded by !**/*.json
Files selected for processing (1)
  • src/server/services/auth/auth.service.ts (2 hunks)
Files not reviewed due to errors (1)
  • src/server/services/auth/auth.service.ts (no review received)

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a12e301 and b678f8d.

Files selected for processing (3)
  • packages/shared/src/schemas/app-schemas.ts (1 hunks)
  • src/app/(dashboard)/app-store/components/AppStoreTile/AppStoreTile.tsx (1 hunks)
  • src/server/services/apps/apps.helpers.ts (1 hunks)
Additional context used
Biome
src/app/(dashboard)/app-store/components/AppStoreTile/AppStoreTile.tsx

[error] 29-29: The computed expression can be simplified without the use of a string literal.


[error] 4-5: All these imports are only used as types.


[error] 6-7: All these imports are only used as types.

src/server/services/apps/apps.helpers.ts

[error] 5-5: A Node.js builtin module should be imported with the node: protocol.


[error] 1-1: All these imports are only used as types.

GitHub Check: build
src/app/(dashboard)/app-store/components/AppStoreTile/AppStoreTile.tsx

[failure] 22-22:
Property 'created' does not exist on type 'App'.

Additional comments not posted (3)
src/app/(dashboard)/app-store/components/AppStoreTile/AppStoreTile.tsx (1)

29-31: Conditional rendering for "NEW" label is implemented correctly.

Consider simplifying the expression for better readability as suggested by the static analysis tool.

packages/shared/src/schemas/app-schemas.ts (1)

83-83: The addition of the created field to appInfoSchema is correctly implemented with appropriate constraints.

src/server/services/apps/apps.helpers.ts (1)

72-79: The inclusion of the created property in the returned app data by getAvailableApps is correctly implemented.

Consider importing Node.js built-in modules with the node: protocol for better compatibility and clarity.

@@ -19,13 +19,17 @@

export const AppStoreTile: React.FC<{ app: App }> = ({ app }) => {
const t = useTranslations();
const isNewApp = app.created + (14 * 24 * 60 * 60 * 1000) > Date.now();
Copy link
Contributor

Choose a reason for hiding this comment

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

Property 'created' does not exist on type 'App'.

Please ensure that the created property is added to the App type definition to resolve the build error.

Tools
GitHub Check: build

[failure] 22-22:
Property 'created' does not exist on type 'App'.

@MontejoJorge
Copy link
Collaborator

Would be nice to have a category with the new added apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants