From 7a62b9fd5826d88aabd33432f8ca2e5d5ce87168 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Tue, 24 Feb 2026 19:15:54 -0800 Subject: [PATCH] feat: add rStack AppSwitcher dropdown to header Adds the unified rStack app switcher with pastel badges, emoji icons, and categorized navigation across all 17 rStack apps. Co-Authored-By: Claude Opus 4.6 --- src/components/AppSwitcher.tsx | 192 +++++++++++++++++++++++++++++++++ src/components/Navbar.tsx | 2 + 2 files changed, 194 insertions(+) create mode 100644 src/components/AppSwitcher.tsx diff --git a/src/components/AppSwitcher.tsx b/src/components/AppSwitcher.tsx new file mode 100644 index 0000000..3696bad --- /dev/null +++ b/src/components/AppSwitcher.tsx @@ -0,0 +1,192 @@ +'use client'; + +import { useState, useRef, useEffect } from 'react'; + +export interface AppModule { + id: string; + name: string; + badge: string; // favicon-style abbreviation: rS, rN, rP, etc. + color: string; // Tailwind bg class for the pastel badge + emoji: string; // function emoji shown right of title + description: string; + domain?: string; +} + +const MODULES: AppModule[] = [ + // Creating + { id: 'space', name: 'rSpace', badge: 'rS', color: 'bg-teal-300', emoji: '🎨', description: 'Real-time collaborative canvas', domain: 'rspace.online' }, + { id: 'notes', name: 'rNotes', badge: 'rN', color: 'bg-amber-300', emoji: 'πŸ“', description: 'Group note-taking & knowledge capture', domain: 'rnotes.online' }, + { id: 'pubs', name: 'rPubs', badge: 'rP', color: 'bg-rose-300', emoji: 'πŸ“°', description: 'Collaborative publishing platform', domain: 'rpubs.online' }, + // Planning + { id: 'cal', name: 'rCal', badge: 'rC', color: 'bg-sky-300', emoji: 'πŸ“…', description: 'Collaborative scheduling & events', domain: 'rcal.online' }, + { id: 'trips', name: 'rTrips', badge: 'rT', color: 'bg-emerald-300', emoji: '✈️', description: 'Group travel planning in real time', domain: 'rtrips.online' }, + { id: 'maps', name: 'rMaps', badge: 'rM', color: 'bg-green-300', emoji: 'πŸ—ΊοΈ', description: 'Collaborative real-time mapping', domain: 'rmaps.online' }, + // Discussing & Deciding + { id: 'inbox', name: 'rInbox', badge: 'rI', color: 'bg-indigo-300', emoji: 'πŸ“¬', description: 'Private group messaging', domain: 'rinbox.online' }, + { id: 'choices', name: 'rChoices', badge: 'rCh', color: 'bg-fuchsia-300', emoji: 'πŸ”€', description: 'Collaborative decision making', domain: 'rchoices.online' }, + { id: 'vote', name: 'rVote', badge: 'rV', color: 'bg-violet-300', emoji: 'πŸ—³οΈ', description: 'Real-time polls & governance', domain: 'rvote.online' }, + // Funding & Commerce + { id: 'funds', name: 'rFunds', badge: 'rF', color: 'bg-lime-300', emoji: 'πŸ’Έ', description: 'Collaborative fundraising & grants', domain: 'rfunds.online' }, + { id: 'wallet', name: 'rWallet', badge: 'rW', color: 'bg-yellow-300', emoji: 'πŸ’°', description: 'Multi-chain crypto wallet', domain: 'rwallet.online' }, + { id: 'cart', name: 'rCart', badge: 'rCt', color: 'bg-orange-300', emoji: 'πŸ›’', description: 'Group commerce & shared shopping', domain: 'rcart.online' }, + { id: 'auctions', name: 'rAuctions', badge: 'rA', color: 'bg-red-300', emoji: 'πŸ”¨', description: 'Live auction platform', domain: 'rauctions.online' }, + // Social & Sharing + { id: 'network', name: 'rNetwork', badge: 'rNe', color: 'bg-blue-300', emoji: '🌐', description: 'Community network & social graph', domain: 'rnetwork.online' }, + { id: 'files', name: 'rFiles', badge: 'rFi', color: 'bg-cyan-300', emoji: 'πŸ“', description: 'Collaborative file storage', domain: 'rfiles.online' }, + { id: 'tube', name: 'rTube', badge: 'rTu', color: 'bg-pink-300', emoji: '🎬', description: 'Group video platform', domain: 'rtube.online' }, + { id: 'data', name: 'rData', badge: 'rD', color: 'bg-purple-300', emoji: 'πŸ“Š', description: 'Analytics & insights dashboard', domain: 'rdata.online' }, +]; + +const MODULE_CATEGORIES: Record = { + space: 'Creating', + notes: 'Creating', + pubs: 'Creating', + cal: 'Planning', + trips: 'Planning', + inbox: 'Discussing & Deciding', + choices: 'Discussing & Deciding', + vote: 'Discussing & Deciding', + funds: 'Funding & Commerce', + wallet: 'Funding & Commerce', + cart: 'Funding & Commerce', + auctions:'Funding & Commerce', + maps: 'Planning', + network: 'Social & Sharing', + files: 'Social & Sharing', + tube: 'Social & Sharing', + data: 'Social & Sharing', +}; + +const CATEGORY_ORDER = [ + 'Creating', + 'Planning', + 'Discussing & Deciding', + 'Funding & Commerce', + 'Social & Sharing', +]; + +interface AppSwitcherProps { + current?: string; +} + +export function AppSwitcher({ current = 'notes' }: AppSwitcherProps) { + const [open, setOpen] = useState(false); + const ref = useRef(null); + + useEffect(() => { + function handleClick(e: MouseEvent) { + if (ref.current && !ref.current.contains(e.target as Node)) { + setOpen(false); + } + } + document.addEventListener('click', handleClick); + return () => document.removeEventListener('click', handleClick); + }, []); + + const currentMod = MODULES.find((m) => m.id === current); + + // Group modules by category + const groups = new Map(); + for (const m of MODULES) { + const cat = MODULE_CATEGORIES[m.id] || 'Other'; + if (!groups.has(cat)) groups.set(cat, []); + groups.get(cat)!.push(m); + } + + return ( +
+ {/* Trigger button */} + + + {/* Dropdown */} + {open && ( +
+ {/* rStack header */} +
+ + r* + +
+
rStack
+
Self-hosted community app suite
+
+
+ + {/* Categories */} + {CATEGORY_ORDER.map((cat) => { + const items = groups.get(cat); + if (!items || items.length === 0) return null; + return ( + + ); + })} + + {/* Footer */} + +
+ )} +
+ ); +} diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 71d507b..6842f6a 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -5,6 +5,7 @@ import { useEncryptID } from "@encryptid/sdk/ui/react"; import { usePathname } from "next/navigation"; import { Button } from "@/components/ui/button"; import { CreditDisplay } from "./CreditDisplay"; +import { AppSwitcher } from "./AppSwitcher"; import { DropdownMenu, DropdownMenuContent, @@ -36,6 +37,7 @@ export function Navbar() {
+ rVote