diff --git a/packages/shared/src/components/tools/ToolBreadcrumb.tsx b/packages/shared/src/components/tools/ToolBreadcrumb.tsx new file mode 100644 index 0000000000..ef66d86330 --- /dev/null +++ b/packages/shared/src/components/tools/ToolBreadcrumb.tsx @@ -0,0 +1,73 @@ +import type { ReactElement } from 'react'; +import React from 'react'; +import classNames from 'classnames'; +import Link from '../utilities/Link'; +import type { Tool } from '../../lib/toolsMockData'; +import { AiIcon, HomeIcon } from '../icons'; +import { Button, ButtonSize, ButtonVariant } from '../buttons/Button'; + +export interface ToolBreadcrumbProps { + toolPath: Tool[]; + className?: string; +} + +export const ToolBreadcrumb = ({ + toolPath, + className, +}: ToolBreadcrumbProps): ReactElement => { + return ( + + ); +}; diff --git a/packages/shared/src/components/tools/ToolCard.tsx b/packages/shared/src/components/tools/ToolCard.tsx new file mode 100644 index 0000000000..4417e810fe --- /dev/null +++ b/packages/shared/src/components/tools/ToolCard.tsx @@ -0,0 +1,56 @@ +import type { ReactElement } from 'react'; +import React from 'react'; +import classNames from 'classnames'; +import Link from '../utilities/Link'; +import type { Tool } from '../../lib/toolsMockData'; +import { Image } from '../image/Image'; +import { UpvoteIcon } from '../icons'; +import { largeNumberFormat } from '../../lib'; + +export interface ToolCardProps { + tool: Tool; + className?: string; +} + +export const ToolCard = ({ tool, className }: ToolCardProps): ReactElement => { + const hasChildren = tool.children.length > 0; + + return ( + + +
+ {`${tool.name} +
+

+ {tool.name} +

+
+ + + {largeNumberFormat(tool.upvotes)} + + {hasChildren && ( + <> + ยท + {tool.children.length} tools + + )} +
+
+
+

+ {tool.description} +

+
+ + ); +}; diff --git a/packages/shared/src/components/tools/ToolDiscussion.tsx b/packages/shared/src/components/tools/ToolDiscussion.tsx new file mode 100644 index 0000000000..c7389f1fa5 --- /dev/null +++ b/packages/shared/src/components/tools/ToolDiscussion.tsx @@ -0,0 +1,110 @@ +import type { ReactElement } from 'react'; +import React from 'react'; +import classNames from 'classnames'; +import type { MockComment } from '../../lib/toolsMockData'; +import { Image } from '../image/Image'; +import { + Button, + ButtonSize, + ButtonVariant, + ButtonColor, +} from '../buttons/Button'; +import { UpvoteIcon } from '../icons'; +import { largeNumberFormat } from '../../lib'; + +export interface ToolDiscussionProps { + comments: MockComment[]; + upvotedComments: Set; + onUpvoteComment: (commentId: string) => void; + className?: string; +} + +const formatTimestamp = (timestamp: string): string => { + const date = new Date(timestamp); + const now = new Date(); + const diffMs = now.getTime() - date.getTime(); + const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); + + if (diffDays === 0) { + return 'Today'; + } + if (diffDays === 1) { + return 'Yesterday'; + } + if (diffDays < 7) { + return `${diffDays} days ago`; + } + return date.toLocaleDateString('en-US', { + month: 'short', + day: 'numeric', + }); +}; + +export const ToolDiscussion = ({ + comments, + upvotedComments, + onUpvoteComment, + className, +}: ToolDiscussionProps): ReactElement => { + return ( +
+

+ Discussion +

+
+