Files
OpenCut/apps/web/src/components/header.tsx
T

64 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-06-22 13:07:02 +02:00
"use client";
import Link from "next/link";
2025-06-22 14:28:34 +02:00
import Image from "next/image";
2025-06-22 13:07:02 +02:00
import { Button } from "./ui/button";
import { ArrowRight } from "lucide-react";
import { HeaderBase } from "./header-base";
import { useSession } from "@opencut/auth/client";
2025-06-24 02:06:55 +05:30
import { getStars } from "@/lib/fetchGhStars";
2025-06-24 01:40:46 +05:30
import { Star } from "lucide-react";
2025-06-24 02:06:55 +05:30
import { useEffect, useState } from "react";
2025-06-22 13:07:02 +02:00
export function Header() {
const { data: session } = useSession();
2025-06-24 02:06:55 +05:30
const [star, setStar] = useState<string>("");
useEffect(() => {
const fetchStars = async () => {
try {
const data = await getStars();
setStar(data);
} catch (err) {
console.error("Failed to fetch GitHub stars", err);
}
};
fetchStars();
}, []);
2025-06-22 13:07:02 +02:00
const leftContent = (
2025-06-22 14:28:34 +02:00
<Link href="/" className="flex items-center gap-3">
2025-06-22 22:22:08 +02:00
<Image src="/logo.png" alt="OpenCut Logo" width={24} height={24} />
<span className="font-medium tracking-tight">OpenCut</span>
2025-06-22 13:07:02 +02:00
</Link>
);
const rightContent = (
<nav className="flex items-center">
<Link href="/contributors">
<Button variant="text" className="text-sm">
Contributors
2025-06-22 13:07:02 +02:00
</Button>
</Link>
{process.env.NODE_ENV === "development" ? (
<Link href="/editor" target="_blank">
<Button size="sm" className="text-sm ml-4">
Editor
<ArrowRight className="h-4 w-4" />
</Button>
</Link>
) : (
<Link href="https://github.com/OpenCut-app/OpenCut" target="_blank">
<Button size="sm" className="text-sm ml-4">
GitHub
<ArrowRight className="h-4 w-4" />
</Button>
</Link>
)}
2025-06-22 13:07:02 +02:00
</nav>
);
return <HeaderBase leftContent={leftContent} rightContent={rightContent} />;
}