mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
feat: add no results screen for project search
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
|||||||
Loader2,
|
Loader2,
|
||||||
X,
|
X,
|
||||||
Trash2,
|
Trash2,
|
||||||
|
Search,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { TProject } from "@/types/project";
|
import { TProject } from "@/types/project";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
@@ -248,8 +249,13 @@ export default function ProjectsPage() {
|
|||||||
<div className="flex items-center justify-center py-16">
|
<div className="flex items-center justify-center py-16">
|
||||||
<Loader2 className="h-8 w-8 text-muted-foreground animate-spin" />
|
<Loader2 className="h-8 w-8 text-muted-foreground animate-spin" />
|
||||||
</div>
|
</div>
|
||||||
) : sortedProjects.length === 0 ? (
|
) : savedProjects.length === 0 ? (
|
||||||
<NoProjects onCreateProject={handleCreateProject} />
|
<NoProjects onCreateProject={handleCreateProject} />
|
||||||
|
) : sortedProjects.length === 0 ? (
|
||||||
|
<NoResults
|
||||||
|
searchQuery={searchQuery}
|
||||||
|
onClearSearch={() => setSearchQuery("")}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-6">
|
<div className="grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-6">
|
||||||
{sortedProjects.map((project) => (
|
{sortedProjects.map((project) => (
|
||||||
@@ -618,3 +624,26 @@ function NoProjects({ onCreateProject }: { onCreateProject: () => void }) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function NoResults({
|
||||||
|
searchQuery,
|
||||||
|
onClearSearch,
|
||||||
|
}: {
|
||||||
|
searchQuery: string;
|
||||||
|
onClearSearch: () => void;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col items-center justify-center py-16 text-center">
|
||||||
|
<div className="w-16 h-16 rounded-full bg-muted/30 flex items-center justify-center mb-4">
|
||||||
|
<Search className="h-8 w-8 text-muted-foreground" />
|
||||||
|
</div>
|
||||||
|
<h3 className="text-lg font-medium mb-2">No results found</h3>
|
||||||
|
<p className="text-muted-foreground mb-6 max-w-md">
|
||||||
|
Your search for "{searchQuery}" did not return any results.
|
||||||
|
</p>
|
||||||
|
<Button onClick={onClearSearch} variant="outline">
|
||||||
|
Clear Search
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user