From f9274cb730e24b9ab74f219c793a41fc6c8b8b1f Mon Sep 17 00:00:00 2001 From: Bran18 Date: Sat, 9 Nov 2024 11:31:51 -0600 Subject: [PATCH 1/6] fix:restore desktop navigation link - browse --- apps/masterbots.ai/components/layout/header/header.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/masterbots.ai/components/layout/header/header.tsx b/apps/masterbots.ai/components/layout/header/header.tsx index bf98b073..a968e419 100644 --- a/apps/masterbots.ai/components/layout/header/header.tsx +++ b/apps/masterbots.ai/components/layout/header/header.tsx @@ -21,6 +21,8 @@ export function Header() {
+ + {appConfig.devMode && ( <> From 4618a83482c45519b10be27ef97c3b31dc16c992 Mon Sep 17 00:00:00 2001 From: Bran18 Date: Sat, 9 Nov 2024 11:40:00 -0600 Subject: [PATCH 2/6] fix:formating --- apps/masterbots.ai/components/layout/header/header.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/masterbots.ai/components/layout/header/header.tsx b/apps/masterbots.ai/components/layout/header/header.tsx index a968e419..3e920e86 100644 --- a/apps/masterbots.ai/components/layout/header/header.tsx +++ b/apps/masterbots.ai/components/layout/header/header.tsx @@ -16,14 +16,12 @@ export function Header() { - + {/* Navigation links - Hidden on mobile */}
- - {appConfig.devMode && ( <> From 5a91ec51acc70b751d1c4bae27ad17ffad92f915 Mon Sep 17 00:00:00 2001 From: Bran18 Date: Mon, 11 Nov 2024 08:03:44 -0600 Subject: [PATCH 3/6] feat:yellow combobox btn (JUN-REQUEST) --- apps/masterbots.ai/components/routes/chat/chat-combobox.tsx | 2 +- apps/masterbots.ai/components/ui/button.tsx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/masterbots.ai/components/routes/chat/chat-combobox.tsx b/apps/masterbots.ai/components/routes/chat/chat-combobox.tsx index 290032e4..ba7f23cf 100644 --- a/apps/masterbots.ai/components/routes/chat/chat-combobox.tsx +++ b/apps/masterbots.ai/components/routes/chat/chat-combobox.tsx @@ -52,7 +52,7 @@ export function ChatCombobox() { role="combobox" aria-expanded={open} className={cn( - buttonVariants({ size: 'sm', variant: 'outline' }), + buttonVariants({ size: 'sm', variant: 'chatCombobox' }), 'absolute left-0 top-4 size-8 rounded-full p-0 sm:left-4' )} > diff --git a/apps/masterbots.ai/components/ui/button.tsx b/apps/masterbots.ai/components/ui/button.tsx index 7d595bd6..f30f48ce 100644 --- a/apps/masterbots.ai/components/ui/button.tsx +++ b/apps/masterbots.ai/components/ui/button.tsx @@ -3,6 +3,7 @@ import { Slot } from '@radix-ui/react-slot' import { cva, type VariantProps } from 'class-variance-authority' import { cn } from '@/lib/utils' +import {ChatCombobox} from '@/components/routes/chat/chat-combobox'; const buttonVariants = cva( 'inline-flex items-center justify-center rounded-md text-sm font-medium shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', @@ -21,6 +22,8 @@ const buttonVariants = cva( link: 'text-primary underline-offset-4 shadow-none hover:underline', icon: 'flex size-8 shrink-0 select-none items-center justify-center rounded-full border shadow cursor-pointer', sideBarProfile: 'bg-transparent border-0 shadow-none justify-start', + chatCombobox: + 'border border-input bg-yellow-400 hover:bg-yellow-500 hover:text-accent-foreground', }, size: { default: 'h-8 px-4 py-2', From 42c539e1733935229d5f7955d0e2489bd50665cd Mon Sep 17 00:00:00 2001 From: Bran18 Date: Mon, 11 Nov 2024 17:34:03 -0600 Subject: [PATCH 4/6] glowing effect variant --- apps/masterbots.ai/components/ui/button.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/masterbots.ai/components/ui/button.tsx b/apps/masterbots.ai/components/ui/button.tsx index f30f48ce..f53cf744 100644 --- a/apps/masterbots.ai/components/ui/button.tsx +++ b/apps/masterbots.ai/components/ui/button.tsx @@ -22,8 +22,7 @@ const buttonVariants = cva( link: 'text-primary underline-offset-4 shadow-none hover:underline', icon: 'flex size-8 shrink-0 select-none items-center justify-center rounded-full border shadow cursor-pointer', sideBarProfile: 'bg-transparent border-0 shadow-none justify-start', - chatCombobox: - 'border border-input bg-yellow-400 hover:bg-yellow-500 hover:text-accent-foreground', + chatCombobox:'border border-input animate-pulse-yellow hover:bg-yellow-400 hover:text-accent-foreground transition-all duration-200 ease-in-out hover:shadow-[0_0_20px_#f5be0b]' }, size: { default: 'h-8 px-4 py-2', From 3036edbd8716862838e8a75ec80d2428c9629b8d Mon Sep 17 00:00:00 2001 From: Bran18 Date: Tue, 12 Nov 2024 11:50:57 -0600 Subject: [PATCH 5/6] upt:removed /b navigation as original v --- apps/masterbots.ai/components/layout/header/header.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/masterbots.ai/components/layout/header/header.tsx b/apps/masterbots.ai/components/layout/header/header.tsx index 3e920e86..40945adf 100644 --- a/apps/masterbots.ai/components/layout/header/header.tsx +++ b/apps/masterbots.ai/components/layout/header/header.tsx @@ -21,7 +21,6 @@ export function Header() {
- {appConfig.devMode && ( <> From 650acc5ccf5ecfc19caa0bf67fa8d595a3c4ed41 Mon Sep 17 00:00:00 2001 From: Bran18 Date: Tue, 12 Nov 2024 13:24:57 -0600 Subject: [PATCH 6/6] feat:powerup mode + provider --- .../components/layout/providers.tsx | 13 +- .../components/routes/chat/chat-combobox.tsx | 4 +- .../routes/chat/chat-panel-header.tsx | 127 ++++++++++-------- apps/masterbots.ai/components/ui/button.tsx | 2 +- apps/masterbots.ai/components/ui/switch.tsx | 2 +- apps/masterbots.ai/lib/hooks/use-power-up.tsx | 40 ++++++ 6 files changed, 125 insertions(+), 63 deletions(-) create mode 100644 apps/masterbots.ai/lib/hooks/use-power-up.tsx diff --git a/apps/masterbots.ai/components/layout/providers.tsx b/apps/masterbots.ai/components/layout/providers.tsx index 0de9df6e..026d4a70 100644 --- a/apps/masterbots.ai/components/layout/providers.tsx +++ b/apps/masterbots.ai/components/layout/providers.tsx @@ -6,9 +6,10 @@ import { SidebarProvider } from '@/lib/hooks/use-sidebar' import { ThreadProvider } from '@/lib/hooks/use-thread' import { SessionProvider } from 'next-auth/react' import { ThemeProvider as NextThemesProvider } from 'next-themes' -import { ThemeProviderProps } from 'next-themes/dist/types' +import type { ThemeProviderProps } from 'next-themes/dist/types' import { ModelProvider } from '@/lib/hooks/use-model' import { ThreadVisibilityProvider } from '@/lib/hooks/use-thread-visibility' +import { PowerUpProvider } from '@/lib/hooks/use-power-up' export function Providers({ children, ...props }: ThemeProviderProps) { return ( @@ -18,9 +19,13 @@ export function Providers({ children, ...props }: ThemeProviderProps) { - - {children} - + + + + {children} + + + diff --git a/apps/masterbots.ai/components/routes/chat/chat-combobox.tsx b/apps/masterbots.ai/components/routes/chat/chat-combobox.tsx index ba7f23cf..f42d0b2e 100644 --- a/apps/masterbots.ai/components/routes/chat/chat-combobox.tsx +++ b/apps/masterbots.ai/components/routes/chat/chat-combobox.tsx @@ -27,6 +27,7 @@ import { } from '@/components/ui/popover' import { useModel } from '@/lib/hooks/use-model' import { AIModels } from '@/app/api/chat/models/models' +import { usePowerUp } from '@/lib/hooks/use-power-up' //* Model options available in the combobox, each with label, value, and logo icon. const models = [ @@ -43,6 +44,7 @@ export function ChatCombobox() { const { selectedModel, changeModel } = useModel() const [open, setOpen] = React.useState(false) const [value, setValue] = React.useState(selectedModel as string) + const { isPowerUp } = usePowerUp() return ( @@ -52,7 +54,7 @@ export function ChatCombobox() { role="combobox" aria-expanded={open} className={cn( - buttonVariants({ size: 'sm', variant: 'chatCombobox' }), + buttonVariants({ size: 'sm', variant: isPowerUp ? 'powerUp' : 'outline' }), 'absolute left-0 top-4 size-8 rounded-full p-0 sm:left-4' )} > diff --git a/apps/masterbots.ai/components/routes/chat/chat-panel-header.tsx b/apps/masterbots.ai/components/routes/chat/chat-panel-header.tsx index 9dccda8c..240d8590 100644 --- a/apps/masterbots.ai/components/routes/chat/chat-panel-header.tsx +++ b/apps/masterbots.ai/components/routes/chat/chat-panel-header.tsx @@ -3,6 +3,9 @@ import { ChatShareDialog } from '@/components/routes/chat/chat-share-dialog' import { ButtonScrollToBottom } from '@/components/shared/button-scroll-to-bottom' import { Button } from '@/components/ui/button' import { IconRefresh, IconShare, IconStop } from '@/components/ui/icons' +import { Label } from '@/components/ui/label' +import { Switch } from '@/components/ui/switch' +import { usePowerUp } from '@/lib/hooks/use-power-up' import * as React from 'react' interface ChatPanelHeaderProps { @@ -32,71 +35,83 @@ export function ChatPanelHeader({ isAtBottom }: ChatPanelHeaderProps) { const [shareDialogOpen, setShareDialogOpen] = React.useState(false) + const { isPowerUp, togglePowerUp } = usePowerUp() return (
- {showReload && ( -
- {isLoading || loadingState ? ( - <> - {/* Displays loading state message if active */} - {loadingState && ( -
-
-
-
-
-
-

- {loadingState} -

-
- )} - - - ) : ( - messages?.length >= 2 && ( +
+
+ + +
+ + {showReload && ( +
+ {isLoading || loadingState ? ( <> - - {id && title && ( - <> - - setShareDialogOpen(false)} // Closes dialog after copying link. - chat={{ - id, - title, - messages - }} - /> - + {loadingState && ( +
+
+
+
+
+
+

+ {loadingState} +

+
)} + - ) - )} -
- )} - {/* ButtonScrollToBottom provides a button to scroll to the bottom of the chat */} + ) : ( + messages?.length >= 2 && ( + <> + + {id && title && ( + <> + + setShareDialogOpen(false)} + chat={{ + id, + title, + messages + }} + /> + + )} + + ) + )} +
+ )} +
) -} +} \ No newline at end of file diff --git a/apps/masterbots.ai/components/ui/button.tsx b/apps/masterbots.ai/components/ui/button.tsx index f53cf744..8e20993e 100644 --- a/apps/masterbots.ai/components/ui/button.tsx +++ b/apps/masterbots.ai/components/ui/button.tsx @@ -22,7 +22,7 @@ const buttonVariants = cva( link: 'text-primary underline-offset-4 shadow-none hover:underline', icon: 'flex size-8 shrink-0 select-none items-center justify-center rounded-full border shadow cursor-pointer', sideBarProfile: 'bg-transparent border-0 shadow-none justify-start', - chatCombobox:'border border-input animate-pulse-yellow hover:bg-yellow-400 hover:text-accent-foreground transition-all duration-200 ease-in-out hover:shadow-[0_0_20px_#f5be0b]' + powerUp:'border border-input animate-pulse-yellow bg-yellow-400 text-black transition-all duration-200 ease-in-out shadow-[0_0_20px_#f5be0b] hover:bg-yellow-500' }, size: { default: 'h-8 px-4 py-2', diff --git a/apps/masterbots.ai/components/ui/switch.tsx b/apps/masterbots.ai/components/ui/switch.tsx index 191ef52e..bc69cf2d 100644 --- a/apps/masterbots.ai/components/ui/switch.tsx +++ b/apps/masterbots.ai/components/ui/switch.tsx @@ -11,7 +11,7 @@ const Switch = React.forwardRef< >(({ className, ...props }, ref) => ( void +} + +const PowerUpContext = React.createContext(undefined) + +export function PowerUpProvider({ children }: { children: React.ReactNode }) { + const [isPowerUp, setIsPowerUp] = React.useState(false) + + const togglePowerUp = React.useCallback(() => { + setIsPowerUp(prev => !prev) + }, []) + + const value = React.useMemo( + () => ({ + isPowerUp, + togglePowerUp + }), + [isPowerUp, togglePowerUp] + ) + + return ( + + {children} + + ) +} + +export function usePowerUp() { + const context = React.useContext(PowerUpContext) + if (context === undefined) { + throw new Error('usePowerUp must be used within a PowerUpProvider') + } + return context +} \ No newline at end of file