feat: update Makelore modules and conversations
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
import { useState, type ComponentType } from 'react';
|
||||
import {
|
||||
AppWindow,
|
||||
Bot,
|
||||
Code2,
|
||||
LayoutTemplate,
|
||||
MonitorSmartphone,
|
||||
TerminalSquare,
|
||||
} from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
type TemplateProject = {
|
||||
id: string;
|
||||
label: string;
|
||||
icon: ComponentType<{ className?: string }>;
|
||||
};
|
||||
|
||||
const templateProjects: TemplateProject[] = [
|
||||
{ id: 'agent-app', label: 'Agent App', icon: Bot },
|
||||
{ id: 'web-app', label: 'Web App', icon: Code2 },
|
||||
{ id: 'desktop-app', label: 'Desktop App', icon: AppWindow },
|
||||
{ id: 'mobile-app', label: 'Mobile App', icon: MonitorSmartphone },
|
||||
{ id: 'cli-tool', label: 'CLI Tool', icon: TerminalSquare },
|
||||
];
|
||||
|
||||
export function TemplateProjectMenu() {
|
||||
const [selectedTemplateId, setSelectedTemplateId] = useState(templateProjects[0]?.id ?? '');
|
||||
|
||||
return (
|
||||
<nav
|
||||
aria-label="Template projects"
|
||||
data-testid="home-template-project-menu"
|
||||
className="flex shrink-0 items-center gap-3 border-b bg-background px-4 py-2 sm:px-5"
|
||||
>
|
||||
<div className="hidden shrink-0 items-center gap-2 text-sm font-semibold text-muted-foreground sm:flex">
|
||||
<LayoutTemplate className="h-4 w-4" />
|
||||
<span>Templates</span>
|
||||
</div>
|
||||
|
||||
<div className="flex min-w-0 flex-1 gap-2 overflow-x-auto">
|
||||
{templateProjects.map((template) => {
|
||||
const Icon = template.icon;
|
||||
const selected = selectedTemplateId === template.id;
|
||||
|
||||
return (
|
||||
<button
|
||||
key={template.id}
|
||||
type="button"
|
||||
aria-label={template.label}
|
||||
aria-pressed={selected}
|
||||
onClick={() => setSelectedTemplateId(template.id)}
|
||||
className={cn(
|
||||
'inline-flex h-9 shrink-0 items-center gap-2 rounded-md border px-3 text-sm font-medium transition-colors',
|
||||
selected
|
||||
? 'border-primary/40 bg-primary text-primary-foreground'
|
||||
: 'border-border bg-card text-foreground hover:bg-accent hover:text-accent-foreground',
|
||||
)}
|
||||
>
|
||||
<Icon className="h-4 w-4" />
|
||||
<span>{template.label}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '@/components/ui/sheet';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import {
|
||||
CollaborationProject,
|
||||
@@ -44,7 +44,7 @@ function ProjectCard({
|
||||
onRestore: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="rounded-lg border bg-card p-4 shadow-sm transition-colors hover:border-primary/40">
|
||||
<div className="surface-card motion-press rounded-2xl border border-border/70 bg-card p-4 shadow-none hover:border-brand/25 hover:shadow-soft">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
@@ -123,19 +123,19 @@ export function Home() {
|
||||
setNameError('');
|
||||
};
|
||||
|
||||
const openCreateSheet = () => {
|
||||
const openCreateDialog = () => {
|
||||
resetCreateForm();
|
||||
setCreateOpen(true);
|
||||
window.setTimeout(() => nameInputRef.current?.focus(), 50);
|
||||
};
|
||||
|
||||
const cancelCreateSheet = () => {
|
||||
const cancelCreateDialog = () => {
|
||||
resetCreateForm();
|
||||
setCreateOpen(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const handleOpenCreateProject = () => openCreateSheet();
|
||||
const handleOpenCreateProject = () => openCreateDialog();
|
||||
|
||||
window.addEventListener('niancode:create-project', handleOpenCreateProject);
|
||||
return () => window.removeEventListener('niancode:create-project', handleOpenCreateProject);
|
||||
@@ -195,7 +195,7 @@ export function Home() {
|
||||
|
||||
return (
|
||||
<main className="flex h-full min-h-0 -m-6 flex-col bg-background">
|
||||
<div className="shrink-0 border-b bg-background px-6 py-5">
|
||||
<div className="glass-surface shrink-0 border-b border-border/70 bg-background/80 px-6 py-5">
|
||||
<div className="flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between">
|
||||
<div>
|
||||
<div className="flex items-center gap-2 text-sm font-medium text-muted-foreground">
|
||||
@@ -207,7 +207,7 @@ export function Home() {
|
||||
|
||||
<Button
|
||||
className="w-full shrink-0 lg:w-auto"
|
||||
onClick={openCreateSheet}
|
||||
onClick={openCreateDialog}
|
||||
>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
新建项目
|
||||
@@ -225,7 +225,7 @@ export function Home() {
|
||||
|
||||
<TabsContent value="running" className="min-h-0 flex-1 overflow-auto px-6 pb-6">
|
||||
{visibleGroups.active.length === 0 && visibleGroups.inactive.length === 0 ? (
|
||||
<div className="mt-6 flex min-h-[280px] items-center justify-center rounded-lg border border-dashed bg-card/40">
|
||||
<div className="surface-card mt-6 flex min-h-[280px] items-center justify-center rounded-2xl border border-dashed border-border bg-card/40">
|
||||
<div className="max-w-sm text-center">
|
||||
<FolderKanban className="mx-auto h-10 w-10 text-muted-foreground" />
|
||||
<p className="mt-3 text-sm font-medium">还没有项目</p>
|
||||
@@ -233,7 +233,7 @@ export function Home() {
|
||||
<Button
|
||||
className="mt-4"
|
||||
size="sm"
|
||||
onClick={openCreateSheet}
|
||||
onClick={openCreateDialog}
|
||||
>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
新建项目
|
||||
@@ -298,28 +298,28 @@ export function Home() {
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
<Sheet
|
||||
<Dialog
|
||||
open={createOpen}
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
openCreateSheet();
|
||||
openCreateDialog();
|
||||
} else {
|
||||
cancelCreateSheet();
|
||||
cancelCreateDialog();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SheetContent className="flex w-[min(460px,92vw)] flex-col overflow-hidden p-0 sm:max-w-none">
|
||||
<SheetHeader className="border-b px-6 py-5">
|
||||
<SheetTitle className="flex items-center gap-2">
|
||||
<DialogContent className="flex max-h-[calc(100vh-2rem)] w-[min(460px,92vw)] max-w-none flex-col overflow-hidden p-0 sm:max-w-lg">
|
||||
<DialogHeader className="border-b px-6 py-5">
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<span className="flex h-8 w-8 items-center justify-center rounded-md bg-primary/10 text-primary">
|
||||
<Sparkles className="h-4 w-4" />
|
||||
</span>
|
||||
新建项目
|
||||
</SheetTitle>
|
||||
<SheetDescription>
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
只需要先填写项目名称,其他信息会在阶段一继续补充。
|
||||
</SheetDescription>
|
||||
</SheetHeader>
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<form onSubmit={submit} className="flex min-h-0 flex-1 flex-col">
|
||||
<div className="min-h-0 flex-1 space-y-4 overflow-auto px-6 py-5">
|
||||
<div>
|
||||
@@ -378,7 +378,7 @@ export function Home() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-auto flex shrink-0 justify-end gap-2 border-t bg-background px-6 py-4">
|
||||
<Button type="button" variant="outline" onClick={cancelCreateSheet}>
|
||||
<Button type="button" variant="outline" onClick={cancelCreateDialog}>
|
||||
取消
|
||||
</Button>
|
||||
<Button type="submit">
|
||||
@@ -386,8 +386,8 @@ export function Home() {
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user