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
5 changes: 4 additions & 1 deletion ui/desktop/src/components/GooseSidebar/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ChatSmart, Gear } from '../icons';
import { ViewOptions, View } from '../../utils/navigationUtils';
import { useChatContext } from '../../contexts/ChatContext';
import { DEFAULT_CHAT_TITLE } from '../../contexts/ChatContext';
import EnvironmentBadge from './EnvironmentBadge';

interface SidebarProps {
onSelectSession: (sessionId: string) => void;
Expand Down Expand Up @@ -165,7 +166,9 @@ const AppSidebar: React.FC<SidebarProps> = ({ currentPath }) => {
<SidebarMenu>{menuItems.map((entry, index) => renderMenuItem(entry, index))}</SidebarMenu>
</SidebarContent>

<SidebarFooter />
<SidebarFooter className="pb-2 flex items-start">
<EnvironmentBadge />
</SidebarFooter>
</>
);
};
Expand Down
30 changes: 30 additions & 0 deletions ui/desktop/src/components/GooseSidebar/EnvironmentBadge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/Tooltip';

const EnvironmentBadge: React.FC = () => {
const isAlpha = process.env.ALPHA;
const isDevelopment = import.meta.env.DEV;
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we set these? there's also a test to see if this has node things set

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup import.meta.env.DEV is provided by Vite
process.env.ALPHA is set with "start-alpha-gui": "ALPHA=true npm run start-gui" in package.json


// Don't show badge in production
if (!isDevelopment && !isAlpha) {
return null;
}

const tooltipText = isAlpha ? 'Alpha' : 'Dev';
const bgColor = isAlpha ? 'bg-purple-600' : 'bg-orange-400';

return (
<Tooltip>
<TooltipTrigger asChild>
<div
className={`${bgColor} w-3 h-3 rounded-full cursor-default`}
data-testid="environment-badge"
aria-label={tooltipText}
/>
</TooltipTrigger>
<TooltipContent side="right">{tooltipText}</TooltipContent>
</Tooltip>
);
};

export default EnvironmentBadge;
1 change: 1 addition & 0 deletions ui/desktop/src/components/GooseSidebar/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as AppSidebar } from './AppSidebar';
export { default as EnvironmentBadge } from './EnvironmentBadge';
Loading