Skip to content
Open
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
2 changes: 2 additions & 0 deletions src/app/mcp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
import { Server, Star, Download, Zap } from "lucide-react";
import { MCP_CATEGORIES } from "@/lib/constants";
import { CopyLinkButton } from "@/components/ui/CopyLinkButton";

export const metadata: Metadata = {
title: "MCP Server Marketplace | ugig.net",
Expand Down Expand Up @@ -228,6 +229,7 @@ async function McpList({ searchParams }: { searchParams: McpPageProps["searchPar
<Download className="h-3.5 w-3.5" />
{listing.downloads_count}
</span>
<CopyLinkButton path={`/mcp/${listing.slug}`} />
</div>
</div>
</Link>
Expand Down
2 changes: 2 additions & 0 deletions src/app/prompts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
import { FileText, Star, Download, Zap } from "lucide-react";
import { PROMPT_CATEGORIES } from "@/lib/constants";
import { CopyLinkButton } from "@/components/ui/CopyLinkButton";

export const metadata: Metadata = {
title: "Prompt Marketplace | ugig.net",
Expand Down Expand Up @@ -238,6 +239,7 @@ async function PromptList({ searchParams }: { searchParams: PromptsPageProps["se
<Download className="h-3.5 w-3.5" />
{listing.downloads_count}
</span>
<CopyLinkButton path={`/prompts/${listing.slug}`} />
</div>
</div>
</Link>
Expand Down
2 changes: 2 additions & 0 deletions src/components/agents/AgentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ReputationBadge } from "@/components/ui/ReputationBadge";
import { MapPin, DollarSign, Coins, CheckCircle, Clock } from "lucide-react";
import { formatRelativeTime } from "@/lib/utils";
import { ZapButton } from "@/components/zaps/ZapButton";
import { CopyLinkButton } from "@/components/ui/CopyLinkButton";
import type { Profile } from "@/types";

interface AgentCardProps {
Expand Down Expand Up @@ -160,6 +161,7 @@ export function AgentCard({ agent, highlightTags = [] }: AgentCardProps) {
<Button size="sm">Hire Agent</Button>
</Link>
<ZapButton targetType="profile" targetId={agent.id} recipientId={agent.id} />
<CopyLinkButton path={`/u/${agent.username}`} />
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/gigs/GigCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Badge } from "@/components/ui/badge";
import { AgentBadge } from "@/components/ui/AgentBadge";
import { VerifiedBadge } from "@/components/ui/VerifiedBadge";
import { SaveGigButton } from "./SaveGigButton";
import { CopyLinkButton } from "@/components/ui/CopyLinkButton";
import { formatCurrency, formatRelativeTime } from "@/lib/utils";
import { linkifyText } from "@/lib/linkify";
import type { Gig, Profile } from "@/types";
Expand Down Expand Up @@ -103,6 +104,7 @@ export function GigCard({
{poster?.account_type === "agent" && (
<AgentBadge size="sm" />
)}
<CopyLinkButton path={detailHref} />
{showSaveButton && (
<SaveGigButton
gigId={gig.id}
Expand Down
38 changes: 38 additions & 0 deletions src/components/ui/CopyLinkButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"use client";

import { useState } from "react";
import { Link, Check } from "lucide-react";

interface CopyLinkButtonProps {
path: string;
className?: string;
}

export function CopyLinkButton({ path, className = "" }: CopyLinkButtonProps) {
const [copied, setCopied] = useState(false);

const handleCopy = (e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
const url = `${window.location.origin}${path}`;
navigator.clipboard.writeText(url).then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 2000);
});
};

return (
<button
type="button"
onClick={handleCopy}
title={copied ? "Copied!" : "Copy shareable link"}
className={`inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-primary hover:bg-muted transition-colors ${className}`}
>
{copied ? (
<Check className="h-3.5 w-3.5 text-green-500" />
) : (
<Link className="h-3.5 w-3.5" />
)}
</button>
);
}