mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 08:18:04 +00:00
feat(dashboard): promote CCS Bar globally
This commit is contained in:
1 parent
8e73ee0acc
commit
b9356a7ce6
13 files changed
+306
-182
No files matched your search
@@ -10,6 +10,7 @@ import { ConnectionIndicator } from '@/components/shared/connection-indicator';
|
||||
import { LocalhostDisclaimer } from '@/components/shared/localhost-disclaimer';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { ClaudeKitBadge } from '@/components/shared/claudekit-badge';
|
||||
import { CcsBarButton } from '@/components/shared/ccs-bar-button';
|
||||
import { SponsorButton } from '@/components/shared/sponsor-button';
|
||||
import { ProjectSelectionDialog } from '@/components/shared/project-selection-dialog';
|
||||
import { DeviceCodeDialog } from '@/components/shared/device-code-dialog';
|
||||
@@ -44,6 +45,7 @@ export function Layout() {
|
||||
<header className="flex h-14 items-center justify-between px-6 border-b shrink-0 bg-background shadow-sm z-20">
|
||||
<div className="flex items-center gap-3">
|
||||
<ClaudeKitBadge />
|
||||
<CcsBarButton />
|
||||
<SponsorButton />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* CCS Bar Feature Banner
|
||||
* Dismissible announcement banner promoting the native macOS menu-bar app.
|
||||
*
|
||||
* Rendered only on macOS: the CTA is an install action (`ccs bar install`) that
|
||||
* has no effect on other platforms, so showing it elsewhere would be misleading.
|
||||
*/
|
||||
|
||||
/* eslint-disable react-hooks/set-state-in-effect */
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { X, MonitorDot, ExternalLink } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
const BANNER_DISMISSED_KEY = 'ccs:ccs-bar-banner-dismissed';
|
||||
|
||||
// User-facing docs page for CCS Bar (flat Markdown in the ccs/cli docs tree).
|
||||
const CCS_BAR_DOCS_URL = 'https://github.com/kaitranntt/ccs/blob/main/docs/ccs-bar.md';
|
||||
|
||||
// Lightweight, dependency-free macOS detection. Kept inline because no other
|
||||
// component needs platform detection; a shared hook would be premature.
|
||||
const isMacOS =
|
||||
typeof navigator !== 'undefined' &&
|
||||
/Mac|iPhone|iPad/i.test(navigator.userAgent || navigator.platform || '');
|
||||
|
||||
interface CcsBarBannerProps {
|
||||
onInstallClick?: () => void;
|
||||
}
|
||||
|
||||
export function CcsBarBanner({ onInstallClick }: CcsBarBannerProps) {
|
||||
const { t } = useTranslation();
|
||||
const [dismissed, setDismissed] = useState(true); // Start hidden to avoid flash
|
||||
|
||||
// Check localStorage on mount
|
||||
useEffect(() => {
|
||||
const isDismissed = localStorage.getItem(BANNER_DISMISSED_KEY) === 'true';
|
||||
setDismissed(isDismissed);
|
||||
}, []);
|
||||
|
||||
const handleDismiss = () => {
|
||||
localStorage.setItem(BANNER_DISMISSED_KEY, 'true');
|
||||
setDismissed(true);
|
||||
};
|
||||
|
||||
if (!isMacOS) return null;
|
||||
if (dismissed) return null;
|
||||
|
||||
return (
|
||||
<div className="bg-gradient-to-r from-accent to-accent/90 text-white px-4 py-3 relative shrink-0">
|
||||
<div className="flex items-center justify-between gap-4 max-w-screen-xl mx-auto">
|
||||
<div className="flex items-center gap-3 flex-1 min-w-0">
|
||||
<div className="p-1.5 bg-white/20 rounded-md shrink-0">
|
||||
<MonitorDot className="w-4 h-4" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<p className="font-medium text-sm">
|
||||
{t('ccsBarBanner.new')}: {t('ccsBarBanner.title')}
|
||||
</p>
|
||||
<p className="text-xs text-white/80 truncate">
|
||||
{t('ccsBarBanner.description')}{' '}
|
||||
<code className="bg-white/15 rounded px-1 py-0.5 font-mono text-[11px]">
|
||||
ccs bar install
|
||||
</code>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
{onInstallClick && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
onClick={onInstallClick}
|
||||
className="bg-white text-accent hover:bg-white/90 h-8"
|
||||
>
|
||||
{t('ccsBarBanner.install')}
|
||||
</Button>
|
||||
)}
|
||||
<a
|
||||
href={CCS_BAR_DOCS_URL}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-xs text-white/80 hover:text-white hidden sm:flex items-center gap-1"
|
||||
>
|
||||
Learn more
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
</a>
|
||||
<Button
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
onClick={handleDismiss}
|
||||
className="h-7 w-7 text-white/70 hover:text-white hover:bg-white/20"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
<span className="sr-only">Dismiss</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* CCS Bar Promo Card
|
||||
* Permanent promotional card for the native macOS menu-bar app, shown in the
|
||||
* providers sidebar footer.
|
||||
*
|
||||
* Rendered only on macOS: the install CTA has no effect elsewhere.
|
||||
*/
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { MonitorDot } from 'lucide-react';
|
||||
|
||||
// Lightweight, dependency-free macOS detection (see ccs-bar-banner.tsx).
|
||||
const isMacOS =
|
||||
typeof navigator !== 'undefined' &&
|
||||
/Mac|iPhone|iPad/i.test(navigator.userAgent || navigator.platform || '');
|
||||
|
||||
interface CcsBarPromoCardProps {
|
||||
onInstallClick: () => void;
|
||||
}
|
||||
|
||||
export function CcsBarPromoCard({ onInstallClick }: CcsBarPromoCardProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (!isMacOS) return null;
|
||||
|
||||
return (
|
||||
<div className="p-3 border-t bg-gradient-to-r from-accent/5 to-accent/10 dark:from-accent/10 dark:to-accent/15">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="p-1.5 bg-accent/10 dark:bg-accent/20 rounded shrink-0">
|
||||
<MonitorDot className="w-4 h-4 text-accent" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<p className="text-xs font-medium text-accent dark:text-accent-foreground">
|
||||
{t('ccsBarPromo.title')}
|
||||
</p>
|
||||
<p className="text-[10px] text-muted-foreground truncate">
|
||||
{t('ccsBarPromo.description')}
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={onInstallClick}
|
||||
className="h-7 px-2 text-accent hover:text-accent hover:bg-accent/10 dark:hover:bg-accent/20"
|
||||
>
|
||||
<MonitorDot className="w-3 h-3 mr-1" />
|
||||
<span className="text-xs">{t('ccsBarPromo.install')}</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -21,9 +21,5 @@ export { OpenRouterPromoCard } from './openrouter-promo-card';
|
||||
export { OpenRouterQuickStart } from './openrouter-quick-start';
|
||||
export { AlibabaCodingPlanPromoCard } from './alibaba-coding-plan-promo-card';
|
||||
|
||||
// CCS Bar (native macOS menu-bar app) promo components
|
||||
export { CcsBarBanner } from './ccs-bar-banner';
|
||||
export { CcsBarPromoCard } from './ccs-bar-promo-card';
|
||||
|
||||
export { ModelTierMapping } from './model-tier-mapping';
|
||||
export type { TierMapping } from './model-tier-mapping';
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* CCS Bar Button
|
||||
*
|
||||
* Compact navbar link for the native macOS menu-bar app docs.
|
||||
*/
|
||||
|
||||
import { MonitorDot } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
|
||||
const CCS_BAR_DOCS_URL = 'https://docs.ccs.kaitran.ca/features/dashboard/ccs-bar';
|
||||
|
||||
export function CcsBarButton() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
asChild
|
||||
className="h-8 gap-1.5 border-accent/40 bg-accent/5 px-2.5 text-accent hover:bg-accent hover:text-accent-foreground"
|
||||
>
|
||||
<a
|
||||
href={CCS_BAR_DOCS_URL}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title={t('ccsBarButton.title')}
|
||||
>
|
||||
<MonitorDot className="w-4 h-4" />
|
||||
<span className="hidden text-xs font-bold sm:inline">{t('ccsBarButton.label')}</span>
|
||||
</a>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom" align="start" className="max-w-64">
|
||||
{t('ccsBarButton.tooltip')}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
export { CcsLogo } from './ccs-logo';
|
||||
export { CcsBarButton } from './ccs-bar-button';
|
||||
export { ClaudeKitBadge } from './claudekit-badge';
|
||||
export { CodeEditor } from './code-editor';
|
||||
export { CommandBuilder } from './command-builder';
|
||||
|
||||
Reference in new issue
Block a user