Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
* {
@apply border-border;
}

body {
@apply bg-background text-foreground;
}
Expand All @@ -88,6 +89,7 @@
* {
@apply border-border outline-ring/50;
}

body {
@apply bg-background text-foreground;
}
Expand Down
12 changes: 3 additions & 9 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Metadata } from 'next'
import { plusJakartaSans } from '@/config/fonts'
import { inter } from '@/config/fonts'
import { ReactQueryProvider } from '@/utils/ReactQueryProvider'
import { Toaster } from '@/components/ui/sonner'
import { Amplify } from 'aws-amplify'
Expand Down Expand Up @@ -55,16 +55,10 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="es">
<body className={plusJakartaSans.className}>
<body className={inter.className}>
<ConfigureAmplifyClientSide />
<ReactQueryProvider>{children}</ReactQueryProvider>
<Toaster
toastOptions={{
classNames: {
description: '!important',
},
}}
/>
<Toaster position="top-center" />
</body>
</html>
)
Expand Down
143 changes: 67 additions & 76 deletions app/store/components/ai-chat/RefinedAiAssistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useChat } from '@/app/store/components/ai-chat/hooks/useChat'
import { Button } from '@/components/ui/button'
import { useMediaQuery } from '@/hooks/ui/use-media-query'
import { GradientSparkles } from '@/app/store/components/ai-chat/GradientSparkles'
import { Drawer, Text } from '@medusajs/ui'
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'
import Orb from '@/app/store/components/ai-chat/Orb'

interface Suggestion {
Expand Down Expand Up @@ -107,15 +107,12 @@ export function RefinedAIAssistantSheet({ open, onOpenChange }: RefinedAIAssista
}))

return (
<Drawer open={open} onOpenChange={onOpenChange}>
<Drawer.Content
className="z-50"
overlayProps={{
className: 'bg-transparent',
}}
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent
side="right"
className="p-0 sm:max-w-md w-full flex flex-col h-full rounded-t-2xl"
>
<Drawer.Header className="flex items-center bg-white border-b border-gray-200 shrink-0">
{' '}
<SheetHeader className="flex items-center bg-white/50 backdrop-blur-sm border-b border-gray-200 shrink-0">
{isMobile && (
<Button
variant="ghost"
Expand All @@ -128,77 +125,71 @@ export function RefinedAIAssistantSheet({ open, onOpenChange }: RefinedAIAssista
)}
<div className="flex flex-1 justify-center items-center gap-2">
<GradientSparkles />
<Drawer.Title className="font-medium text-gray-800">FastBot</Drawer.Title>
<SheetTitle className="font-medium text-gray-800">FastBot</SheetTitle>
</div>
</Drawer.Header>

<Drawer.Body className="p-0 flex flex-col h-full overflow-hidden">
<ScrollArea className="flex-1 overflow-y-auto">
<div ref={scrollRef} className="px-4">
{chatMessages.length === 0 ? (
<div className="flex flex-col items-center justify-center h-full py-20">
<div className="mb-6 relative">
<Orb rotateOnHover={false} hoverIntensity={0.0} />
</div>
<p className="text-gray-600 text-center mb-6">
¿Qué te gustaría saber sobre ecommerce o dropshipping?
</p>
<div className="flex flex-col items-end gap-2 w-full">
{suggestions.map(suggestion => (
<button
key={suggestion.id}
onClick={() => handleSuggestionClick(suggestion.text)}
className="bg-gray-50 py-2 px-4 rounded-full text-sm shadow-sm transition-all hover:bg-gray-100"
>
{suggestion.text}
</button>
))}
</div>
</SheetHeader>

<ScrollArea className="flex-1 overflow-y-auto">
<div ref={scrollRef} className="px-4">
{chatMessages.length === 0 ? (
<div className="flex flex-col items-center justify-center h-full py-20">
<div className="mb-6 relative">
<Orb rotateOnHover={false} hoverIntensity={0.0} />
</div>
) : (
<div className="space-y-4 py-2">
{transformedMessages.map(message => (
<TypingMessage
key={message.id}
id={message.id}
content={message.content}
type={message.type as 'user' | 'ai'}
longMessageThreshold={LONG_MESSAGE_THRESHOLD}
isExpanded={isMessageExpanded(message.id)}
onExpand={toggleMessageExpansion}
/>
<p className="text-gray-600 text-center mb-6">
¿Qué te gustaría saber sobre ecommerce o dropshipping?
</p>
<div className="flex flex-col items-end gap-2 w-full">
{suggestions.map(suggestion => (
<button
key={suggestion.id}
onClick={() => handleSuggestionClick(suggestion.text)}
className="bg-gray-50 py-2 px-4 rounded-full text-sm shadow-sm transition-all hover:bg-gray-100"
>
{suggestion.text}
</button>
))}
{loading && (
<div className="flex justify-start">
<MessageLoading />
</div>
)}
<div ref={messagesEndRef} />
</div>
)}
</div>
</ScrollArea>

<div className="border-gray-200 shrink-0 bg-white">
<AIInputWithSearch
placeholder="Pregúntame cualquier cosa..."
minHeight={48}
maxHeight={96}
onSubmit={(value, withSearch) => {
if (value.trim()) {
chat(value)
setTimeout(scrollToBottom, 100)
}
}}
onFileSelect={file => {
// Handle file if needed, or leave empty
console.log('File selected:', file.name)
}}
className="py-2"
/>
</div>
) : (
<div className="space-y-4 py-2">
{transformedMessages.map(message => (
<TypingMessage
key={message.id}
id={message.id}
content={message.content}
type={message.type as 'user' | 'ai'}
longMessageThreshold={LONG_MESSAGE_THRESHOLD}
isExpanded={isMessageExpanded(message.id)}
onExpand={toggleMessageExpansion}
/>
))}
{loading && (
<div className="flex justify-start">
<MessageLoading />
</div>
)}
<div ref={messagesEndRef} />
</div>
)}
</div>
</Drawer.Body>
</Drawer.Content>
</Drawer>
</ScrollArea>

<div className=" border-gray-200 shrink-0 bg-white">
<AIInputWithSearch
placeholder="Pregúntame cualquier cosa..."
minHeight={48}
maxHeight={96}
onSubmit={(value, withSearch) => {
if (value.trim()) {
chat(value)
setTimeout(scrollToBottom, 100)
}
}}
className="py-2"
/>
</div>
</SheetContent>
</Sheet>
)
}
7 changes: 3 additions & 4 deletions app/store/components/images-selector/image-selector-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useRef, useCallback } from 'react'
import { Search, Grid, List, Upload, Trash2 } from 'lucide-react'
import { Search, Grid, List, Upload } from 'lucide-react'
import { Loader } from '@/components/ui/loader'
import { Button } from '@/components/ui/button'
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
Expand Down Expand Up @@ -206,11 +206,10 @@ export default function ImageSelectorModal({
e.preventDefault()
}, [])

// Handle scroll to fetch more images
const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {
const target = e.target as HTMLDivElement
// Check if scrolled to the bottom (within a threshold)
const isAtBottom = target.scrollHeight - target.scrollTop <= target.clientHeight + 100 // 100px threshold

const isAtBottom = target.scrollHeight - target.scrollTop <= target.clientHeight + 100

if (isAtBottom && nextContinuationToken && !loadingMore && !loading) {
fetchMoreImages()
Expand Down
4 changes: 2 additions & 2 deletions components.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "app/global.css",
"baseColor": "slate",
"baseColor": "zinc",
"cssVariables": true,
"prefix": ""
},
Expand Down
2 changes: 2 additions & 0 deletions components/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import * as React from 'react'
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'

Expand Down
4 changes: 3 additions & 1 deletion components/ui/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import * as React from 'react'
import * as DialogPrimitive from '@radix-ui/react-dialog'
import { X } from 'lucide-react'
Expand Down Expand Up @@ -42,7 +44,7 @@ const DialogContent = React.forwardRef<
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
Expand Down
4 changes: 0 additions & 4 deletions components/ui/sonner.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
'use client'

import { useTheme } from 'next-themes'
import { Toaster as Sonner } from 'sonner'

type ToasterProps = React.ComponentProps<typeof Sonner>

const Toaster = ({ ...props }: ToasterProps) => {
const { theme = 'system' } = useTheme()

return (
<Sonner
theme={theme as ToasterProps['theme']}
className="toaster group"
toastOptions={{
classNames: {
Expand Down
4 changes: 2 additions & 2 deletions config/fonts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Plus_Jakarta_Sans } from 'next/font/google'
import { Inter } from 'next/font/google'

export const plusJakartaSans = Plus_Jakarta_Sans({
export const inter = Inter({
subsets: ['latin'],
weight: ['300', '400', '500', '700'],
display: 'swap',
Expand Down
Loading
Loading