Add ai bot suggestions

This commit is contained in:
CREDO23 2025-10-17 16:48:10 +02:00
parent 525564bd82
commit 2339a156c2
4 changed files with 31 additions and 20 deletions

View file

@ -339,7 +339,7 @@ export function GridPattern({ width, height, x, y, squares, ...props }: any) {
</defs> </defs>
<rect width="100%" height="100%" strokeWidth={0} fill={`url(#${patternId})`} /> <rect width="100%" height="100%" strokeWidth={0} fill={`url(#${patternId})`} />
{squares && ( {squares && (
<svg x={x} y={y} className="overflow-visible"> <svg aria-hidden="true" x={x} y={y} className="overflow-visible">
{squares.map(([x, y]: any, idx: number) => ( {squares.map(([x, y]: any, idx: number) => (
<rect <rect
strokeWidth="0" strokeWidth="0"

View file

@ -5,8 +5,8 @@ import Link from "next/link";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { Logo } from "@/components/Logo"; import { Logo } from "@/components/Logo";
import { ThemeTogglerComponent } from "@/components/theme/theme-toggle"; import { ThemeTogglerComponent } from "@/components/theme/theme-toggle";
import { useGithubStars } from "@/hooks/use-github-stars";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { useGithubStarts } from "@/hooks/use-github-starts";
export const Navbar = () => { export const Navbar = () => {
const [isScrolled, setIsScrolled] = useState(false); const [isScrolled, setIsScrolled] = useState(false);
@ -37,7 +37,7 @@ export const Navbar = () => {
const DesktopNav = ({ navItems, isScrolled }: any) => { const DesktopNav = ({ navItems, isScrolled }: any) => {
const [hovered, setHovered] = useState<number | null>(null); const [hovered, setHovered] = useState<number | null>(null);
const { compactFormat: githubStarts, loading: loadingGithubStarts } = useGithubStarts(); const { compactFormat: githubStars, loading: loadingGithubStars } = useGithubStars();
return ( return (
<motion.div <motion.div
onMouseLeave={() => { onMouseLeave={() => {
@ -88,11 +88,11 @@ const DesktopNav = ({ navItems, isScrolled }: any) => {
className="hidden rounded-full px-3 py-2 hover:bg-gray-100 dark:hover:bg-neutral-800 transition-colors md:flex items-center gap-1.5" className="hidden rounded-full px-3 py-2 hover:bg-gray-100 dark:hover:bg-neutral-800 transition-colors md:flex items-center gap-1.5"
> >
<IconBrandGithub className="h-5 w-5 text-neutral-600 dark:text-neutral-300" /> <IconBrandGithub className="h-5 w-5 text-neutral-600 dark:text-neutral-300" />
{loadingGithubStarts ? ( {loadingGithubStars ? (
<div className="w-6 h-5 dark:bg-neutral-800 animate-pulse"></div> <div className="w-6 h-5 dark:bg-neutral-800 animate-pulse"></div>
) : ( ) : (
<span className="text-sm font-medium text-neutral-600 dark:text-neutral-300"> <span className="text-sm font-medium text-neutral-600 dark:text-neutral-300">
{githubStarts} {githubStars}
</span> </span>
)} )}
</Link> </Link>
@ -110,7 +110,7 @@ const DesktopNav = ({ navItems, isScrolled }: any) => {
const MobileNav = ({ navItems, isScrolled }: any) => { const MobileNav = ({ navItems, isScrolled }: any) => {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const { compactFormat: githubStarts, loading: loadingGithubStarts } = useGithubStarts(); const { compactFormat: githubStars, loading: loadingGithubStars } = useGithubStars();
return ( return (
<> <>
@ -169,16 +169,19 @@ const MobileNav = ({ navItems, isScrolled }: any) => {
className="flex items-center gap-1.5 rounded-lg px-3 py-2 hover:bg-gray-100 dark:hover:bg-neutral-800 transition-colors" className="flex items-center gap-1.5 rounded-lg px-3 py-2 hover:bg-gray-100 dark:hover:bg-neutral-800 transition-colors"
> >
<IconBrandGithub className="h-5 w-5 text-neutral-600 dark:text-neutral-300" /> <IconBrandGithub className="h-5 w-5 text-neutral-600 dark:text-neutral-300" />
{loadingGithubStarts ? ( {loadingGithubStars ? (
<div className="w-6 h-5 dark:bg-neutral-800 animate-pulse"></div> <div className="w-6 h-5 dark:bg-neutral-800 animate-pulse"></div>
) : ( ) : (
<span className="text-sm font-medium text-neutral-600 dark:text-neutral-300"> <span className="text-sm font-medium text-neutral-600 dark:text-neutral-300">
{githubStarts} {githubStars}
</span> </span>
)} )}
</Link> </Link>
</div> </div>
<button className="w-full rounded-lg bg-black px-8 py-2 font-medium text-white shadow-[0px_-2px_0px_0px_rgba(255,255,255,0.4)_inset] dark:bg-white dark:text-black"> <button
type="button"
className="w-full rounded-lg bg-black px-8 py-2 font-medium text-white shadow-[0px_-2px_0px_0px_rgba(255,255,255,0.4)_inset] dark:bg-white dark:text-black"
>
Book a call Book a call
</button> </button>
</motion.div> </motion.div>

View file

@ -76,7 +76,10 @@ export function Pricing({
</div> </div>
<div className="flex justify-center mb-10"> <div className="flex justify-center mb-10">
<label className="relative inline-flex items-center cursor-pointer"> <label
htmlFor="billing-toggle"
className="relative inline-flex items-center cursor-pointer"
>
<Label> <Label>
<Switch <Switch
ref={switchRef as any} ref={switchRef as any}

View file

@ -1,44 +1,49 @@
import { useCallback, useEffect, useState } from "react"; import { useEffect, useState } from "react";
export const useGithubStarts = () => { export const useGithubStars = () => {
const repo = process.env.NEXT_PUBLIC_GITHUB_REPO; const repo = process.env.NEXT_PUBLIC_GITHUB_REPO;
const owner = process.env.NEXT_PUBLIC_GITHUB_OWNER; const owner = process.env.NEXT_PUBLIC_GITHUB_OWNER;
const [starts, setStarts] = useState<number | null>(null); const [stars, setStars] = useState<number | null>(null);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => { useEffect(() => {
const getStarts = async () => { const getStars = async () => {
try { try {
if (!repo || !owner) { if (!repo || !owner) {
throw new Error("Missing GitHub credentials"); throw new Error("Missing GitHub credentials");
} }
setError(null);
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`); const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`);
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to fetch starts: ${response.statusText}`); throw new Error(`Failed to fetch stars: ${response.statusText}`);
} }
const data = await response.json(); const data = await response.json();
setStarts(data?.stargazers_count); setStars(data?.stargazers_count);
} catch (err) { } catch (err) {
console.error("Error fetching starts:", err); console.error("Error fetching stars:", err);
setError(err instanceof Error ? err.message : `Failed to fetch stars ${err}`);
throw err; throw err;
} finally { } finally {
setLoading(false); setLoading(false);
} }
}; };
getStarts(); getStars();
}, []); }, []);
return { return {
starts, stars,
loading, loading,
error,
compactFormat: Intl.NumberFormat("en-US", { compactFormat: Intl.NumberFormat("en-US", {
notation: "compact", notation: "compact",
}).format(starts || 0), }).format(stars || 0),
}; };
}; };