|
| 1 | +/** |
| 2 | + * Copyright (c) 2024 Gitpod GmbH. All rights reserved. |
| 3 | + * Licensed under the GNU Affero General Public License (AGPL). |
| 4 | + * See License.AGPL.txt in the project root for license information. |
| 5 | + */ |
| 6 | + |
| 7 | +import React, { useEffect, useState } from "react"; |
| 8 | +import { trackEvent } from "../Analytics"; |
| 9 | +import { useCurrentUser } from "../user-context"; |
| 10 | +import { getPrimaryEmail } from "@gitpod/public-api-common/lib/user-utils"; |
| 11 | +import { useToast } from "../components/toasts/Toasts"; |
| 12 | +import onaWordmark from "../images/ona-wordmark.svg"; |
| 13 | +import onaApplication from "../images/ona-application.webp"; |
| 14 | + |
| 15 | +const onaBanner = { |
| 16 | + type: "Introducing", |
| 17 | + title: "ONA", |
| 18 | + subtitle: "The privacy-first software engineering agent.", |
| 19 | + ctaText: "Get early access", |
| 20 | + learnMoreText: "Learn more", |
| 21 | + link: "https://ona.com/", |
| 22 | +}; |
| 23 | + |
| 24 | +interface OnaBannerProps { |
| 25 | + compact?: boolean; |
| 26 | +} |
| 27 | + |
| 28 | +export const OnaBanner: React.FC<OnaBannerProps> = ({ compact = false }) => { |
| 29 | + const [onaClicked, setOnaClicked] = useState(false); |
| 30 | + const user = useCurrentUser(); |
| 31 | + const { toast } = useToast(); |
| 32 | + |
| 33 | + useEffect(() => { |
| 34 | + const storedOnaData = localStorage.getItem("ona-banner-data"); |
| 35 | + |
| 36 | + if (storedOnaData) { |
| 37 | + const { clicked } = JSON.parse(storedOnaData); |
| 38 | + setOnaClicked(clicked || false); |
| 39 | + } |
| 40 | + }, []); |
| 41 | + |
| 42 | + const handleOnaBannerClick = () => { |
| 43 | + if (!onaClicked) { |
| 44 | + // Track "Get early access" click |
| 45 | + const userEmail = user ? getPrimaryEmail(user) || "" : ""; |
| 46 | + trackEvent("waitlist_joined", { email: userEmail, feature: "Ona" }); |
| 47 | + |
| 48 | + setOnaClicked(true); |
| 49 | + localStorage.setItem("ona-banner-data", JSON.stringify({ clicked: true })); |
| 50 | + |
| 51 | + // Show success toast |
| 52 | + toast( |
| 53 | + <div> |
| 54 | + <div className="font-medium">You're on the waitlist</div> |
| 55 | + <div className="text-sm opacity-80">We'll reach out to you soon.</div> |
| 56 | + </div>, |
| 57 | + ); |
| 58 | + } else { |
| 59 | + // "Learn more" click - open link |
| 60 | + window.open(onaBanner.link, "_blank", "noopener,noreferrer"); |
| 61 | + } |
| 62 | + }; |
| 63 | + |
| 64 | + if (compact) { |
| 65 | + return ( |
| 66 | + <div |
| 67 | + className="relative rounded-lg hidden lg:flex flex-col gap-3 text-white max-w-80 p-4 shadow-lg" |
| 68 | + style={{ |
| 69 | + background: |
| 70 | + "linear-gradient(340deg, #1F1329 0%, #333A75 20%, #556CA8 40%, #90A898 60%, #E2B15C 80%, #BEA462 100%)", |
| 71 | + }} |
| 72 | + > |
| 73 | + {/* Compact layout */} |
| 74 | + <div className="flex items-center gap-2 text-sm font-normal"> |
| 75 | + {onaBanner.type} |
| 76 | + <img src={onaWordmark} alt="ONA" className="w-12" draggable="false" /> |
| 77 | + </div> |
| 78 | + |
| 79 | + <h3 className="text-white text-lg font-bold leading-tight"> |
| 80 | + The privacy-first software engineering agent |
| 81 | + </h3> |
| 82 | + |
| 83 | + <p className="text-white/90 text-sm leading-relaxed"> |
| 84 | + Delegate software tasks to Ona. It writes code, runs tests, and opens a pull request. Or jump in to |
| 85 | + inspect output or pair program in your IDE. |
| 86 | + <br /> |
| 87 | + <br /> |
| 88 | + Ona runs inside your infrastructure (VPC), with full audit trails, zero data exposure, and support |
| 89 | + for any LLM. |
| 90 | + </p> |
| 91 | + |
| 92 | + <button |
| 93 | + onClick={handleOnaBannerClick} |
| 94 | + className="bg-white/20 backdrop-blur-sm text-white font-medium py-1.5 px-4 rounded-full hover:bg-white/30 transition-colors border border-white/20 inline-flex items-center gap-2 text-sm w-fit" |
| 95 | + > |
| 96 | + {onaClicked ? onaBanner.learnMoreText : onaBanner.ctaText} |
| 97 | + <span className="font-bold">→</span> |
| 98 | + </button> |
| 99 | + </div> |
| 100 | + ); |
| 101 | + } |
| 102 | + |
| 103 | + return ( |
| 104 | + <div |
| 105 | + className="relative rounded-lg flex flex-col lg:flex-row gap-4 lg:gap-6 text-white max-w-5xl mx-auto p-4 lg:p-6 mt-4 mb-16" |
| 106 | + style={{ |
| 107 | + background: |
| 108 | + "linear-gradient(340deg, #1F1329 0%, #333A75 20%, #556CA8 40%, #90A898 60%, #E2B15C 80%, #BEA462 100%)", |
| 109 | + }} |
| 110 | + > |
| 111 | + {/* Left section - ONA branding and image */} |
| 112 | + <div className="flex-1 max-w-full lg:max-w-[400px] order-2 lg:order-1"> |
| 113 | + <div className="relative bg-white/10 backdrop-blur-sm rounded-lg pt-4 px-4 lg:px-6 lg:pt-6 "> |
| 114 | + {/* ONA Logo prominently displayed */} |
| 115 | + <div className="flex justify-center -mb-4 lg:-mb-6"> |
| 116 | + <img src={onaWordmark} alt="ONA" className="w-28 lg:w-56" draggable="false" /> |
| 117 | + </div> |
| 118 | + |
| 119 | + {/* Application screenshot */} |
| 120 | + <div className="relative overflow-hidden"> |
| 121 | + <img |
| 122 | + src={onaApplication} |
| 123 | + alt="Ona application preview" |
| 124 | + className="w-full translate-y-16 h-auto rounded-lg shadow-lg" |
| 125 | + draggable="false" |
| 126 | + /> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | + </div> |
| 130 | + |
| 131 | + {/* Right section - Text content and CTA */} |
| 132 | + <div className="flex-1 max-w-[500px] lg:max-w-[550px] order-1 lg:order-2 lg:ml-8 text-left"> |
| 133 | + <div className="max-lg:mt-2 space-y-3 lg:space-y-4"> |
| 134 | + {/* Main title */} |
| 135 | + <h2 className="text-white text-xl sm:text-2xl lg:text-3xl font-bold leading-tight"> |
| 136 | + The privacy-first software engineering agent |
| 137 | + </h2> |
| 138 | + |
| 139 | + {/* Description */} |
| 140 | + <div className="space-y-2 lg:space-y-3"> |
| 141 | + <p className="text-[#FFFFFF99] text-sm sm:text-base lg:text-lg leading-relaxed"> |
| 142 | + Delegate software tasks to Ona. It writes code, runs tests, and opens a pull request. Or |
| 143 | + jump in to inspect output or pair program in your IDE. |
| 144 | + </p> |
| 145 | + <p className="text-[#FFFFFF99] text-sm sm:text-base lg:text-lg leading-relaxed"> |
| 146 | + Ona runs inside your infrastructure (VPC), with full audit trails, zero data exposure, and |
| 147 | + support for any LLM. |
| 148 | + </p> |
| 149 | + </div> |
| 150 | + |
| 151 | + {/* CTA Button */} |
| 152 | + <div className="pt-2 lg:pt-3 mb-4"> |
| 153 | + <button |
| 154 | + onClick={handleOnaBannerClick} |
| 155 | + className="inline-flex items-center justify-center gap-2 bg-[#fdfdfd] text-[#12100C] px-4 lg:px-6 py-2 rounded-[14px] text-sm lg:text-base transition-all duration-200 shadow-sm h-10 lg:h-12 hover:shadow-md focus:shadow-md hover:bg-[#F5F4F3] font-medium" |
| 156 | + > |
| 157 | + <span>{onaClicked ? onaBanner.learnMoreText : onaBanner.ctaText}</span> |
| 158 | + <span className="font-bold">→</span> |
| 159 | + </button> |
| 160 | + </div> |
| 161 | + </div> |
| 162 | + </div> |
| 163 | + </div> |
| 164 | + ); |
| 165 | +}; |
0 commit comments