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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ talks to the Smartloop API (`api.smartloop.ai`) from the browser.
| Overview | `/dashboard` | Getting started, token usage and estimated savings |
| Models | `/models` | The model catalogue and published benchmark scores |
| Cloud models | `/cloud-models/usage`, `/cloud-models/history` | Credit usage and call history for cloud models |
| GPU boxes | `/gpushed` | [gpushed](https://gpushed.smartloop.ai) balance, top-ups, the current box, daily spend and GPU prices (from `api.smartloop.ai/v1/gpushed`) |
| Settings | `/settings/tokens`, `/settings/websearch`, `/settings/billing` | Access tokens, web search, plan, credits and invoices |
| Plans and payment | `/plans`, `/pricing`, `/upgrade`, `/payment/*` | Upgrade and Stripe Checkout return pages |
| Account | `/profile` | Name, email and password |
Expand Down
17 changes: 13 additions & 4 deletions src/app/components/app-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import TravelExploreIcon from '@mui/icons-material/TravelExplore';
import TerminalIcon from '@mui/icons-material/Terminal';
import CloudOutlinedIcon from '@mui/icons-material/CloudOutlined';
import HistoryIcon from '@mui/icons-material/History';
import DeveloperBoardOutlinedIcon from '@mui/icons-material/DeveloperBoardOutlined';
import ReceiptLongOutlinedIcon from '@mui/icons-material/ReceiptLongOutlined';
import PersonOutlineIcon from '@mui/icons-material/PersonOutline';
import Logo from '@/app/components/logo';
Expand All @@ -33,6 +34,8 @@ const SIDEBAR_WIDTH = 248;
// it does not need a header of its own.
const NAV_GROUPS: {
heading: string | null;
/** Shown to superusers only, for sections that haven't launched yet. */
adminOnly?: boolean;
items: { label: string; path: string; icon: typeof TravelExploreIcon }[];
}[] = [
{
Expand All @@ -49,6 +52,12 @@ const NAV_GROUPS: {
{ label: 'Session History', path: '/cloud-models/history', icon: HistoryIcon },
],
},
{
heading: 'GPU Boxes',
// TEMP: until gpushed launches (see src/app/gpushed/page.tsx).
adminOnly: true,
items: [{ label: 'gpushed', path: '/gpushed', icon: DeveloperBoardOutlinedIcon }],
},
{
heading: 'Settings',
items: [
Expand All @@ -63,7 +72,7 @@ const NAV_GROUPS: {
},
];

function SidebarContent({ onNavigate }: { onNavigate?: () => void }) {
function SidebarContent({ isAdmin, onNavigate }: { isAdmin: boolean; onNavigate?: () => void }) {
const router = useRouter();
const pathname = usePathname();
const { theme, toggleTheme } = useTheme();
Expand All @@ -80,7 +89,7 @@ function SidebarContent({ onNavigate }: { onNavigate?: () => void }) {
</Box>

<Box component="nav" className="flex-1 overflow-y-auto px-3 pb-4">
{NAV_GROUPS.map((group, gi) => (
{NAV_GROUPS.filter((g) => isAdmin || !g.adminOnly).map((group, gi) => (
<Box key={group.heading ?? gi} className={gi === 0 ? '' : 'mt-7'}>
{group.heading && (
<div className="px-3 mb-2 text-[11px] font-semibold uppercase tracking-wider text-faint">
Expand Down Expand Up @@ -142,7 +151,7 @@ export default function AppShell({ user, children }: { user?: any; children: Rea
className="hidden md:block fixed inset-y-0 left-0 z-30"
sx={{ width: SIDEBAR_WIDTH, borderRight: '1px solid var(--border)', bgcolor: 'var(--surface)' }}
>
<SidebarContent />
<SidebarContent isAdmin={!!user?.admin} />
</Box>

{/* Mobile drawer */}
Expand All @@ -158,7 +167,7 @@ export default function AppShell({ user, children }: { user?: any; children: Rea
className="md:hidden fixed inset-y-0 left-0 z-50"
sx={{ width: SIDEBAR_WIDTH, borderRight: '1px solid var(--border)', bgcolor: 'var(--surface)' }}
>
<SidebarContent onNavigate={() => setDrawerOpen(false)} />
<SidebarContent isAdmin={!!user?.admin} onNavigate={() => setDrawerOpen(false)} />
</Box>
</>
)}
Expand Down
2 changes: 2 additions & 0 deletions src/app/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const BASE_URL = process.env.base_url || "https://api.smartloop.ai";

export const API_ENDPOINT = `${BASE_URL}/v1`;
export const WS_ENDPOINT = `${BASE_URL}/ws`;
// gpushed (GPU boxes) is served under the same host, by its own Worker.
export const GPUSHED_ENDPOINT = `${BASE_URL}/v1/gpushed`;

// Plan names, prices and feature copy live on the marketing site, not in this
// app. Keeping a second copy here meant hand-syncing every price change (and
Expand Down
Loading
Loading