application-card.tsx


Overview

This file defines two React functional components, ApplicationCard and SeeAllAppCard, which are UI elements designed to display information about applications in a card layout. These components are part of a user interface, likely within a dashboard or app listing page, providing users with a concise summary of an application and a navigational option to view all applications.

Both components use a shared UI card component (Card and CardContent) for consistent styling and layout and integrate other components/utilities such as RAGFlowAvatar for avatar rendering and formatDate for date formatting.


Components and Types

1. ApplicationCard

type ApplicationCardProps = {
  app: {
    avatar?: string;
    title: string;
    update_time: number;
  };
  onClick?(): void;
  moreDropdown: React.ReactNode;
};

export function ApplicationCard({
  app,
  onClick,
  moreDropdown,
}: ApplicationCardProps): JSX.Element;

Purpose

Renders a card representing a single application, showing its avatar, title, last updated date, and an interactive dropdown menu.

Props

Name

Type

Description

app

{ avatar?: string; title: string; update_time: number }

Object containing application data. avatar is optional.

onClick

() => void (optional)

Callback function invoked when the card is clicked.

moreDropdown

React.ReactNode

React node representing a dropdown menu or additional actions UI element.

Functionality

Usage Example

<ApplicationCard
  app={{
    avatar: 'https://example.com/avatar.png',
    title: 'My Cool App',
    update_time: 1688000000000,
  }}
  onClick={() => console.log('Card clicked')}
  moreDropdown={<MyDropdownMenu />}
/>

2. SeeAllAppCard

export type SeeAllAppCardProps = {
  click(): void;
};

export function SeeAllAppCard({ click }: SeeAllAppCardProps): JSX.Element;

Purpose

Renders a card that invites the user to "See All" applications. This acts as a navigational or action button.

Props

Name

Type

Description

click

() => void

Callback function triggered upon clicking the card.

Functionality

Usage Example

<SeeAllAppCard click={() => navigateToAllApps()} />

Implementation Details


Interaction with Other Parts of the System


Visual Diagram: Component Structure and Interaction

componentDiagram
    direction LR
    ApplicationCard -- uses --> RAGFlowAvatar
    ApplicationCard -- uses --> Card
    ApplicationCard -- uses --> CardContent
    ApplicationCard -- uses --> formatDate
    ApplicationCard -- receives --> moreDropdown
    SeeAllAppCard -- uses --> Card
    SeeAllAppCard -- uses --> CardContent
    SeeAllAppCard -- uses --> ChevronRight

Summary

This file provides two focused presentational components for displaying application information and navigation within an app listing interface. It leverages shared UI components and utilities for consistent styling and functionality, emphasizing clean, concise display of key app data and user interaction points.


End of documentation for application-card.tsx