mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 12:25:22 +00:00
add sourcebot cloud card to public search demo
This commit is contained in:
parent
ba19f39f99
commit
9a204b9557
10 changed files with 168 additions and 4 deletions
3
.github/workflows/ghcr-publish.yml
vendored
3
.github/workflows/ghcr-publish.yml
vendored
|
|
@ -81,7 +81,8 @@ jobs:
|
|||
build-args: |
|
||||
SOURCEBOT_VERSION=${{ github.ref_name }}
|
||||
POSTHOG_PAPIK=${{ secrets.POSTHOG_PAPIK }}
|
||||
|
||||
PUBLIC_SEARCH_DEMO=${{ secrets.PUBLIC_SEARCH_DEMO }}
|
||||
|
||||
- name: Export digest
|
||||
run: |
|
||||
mkdir -p /tmp/digests
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
|||
# @see: https://phase.dev/blog/nextjs-public-runtime-variables/
|
||||
ARG NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED=BAKED_NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED
|
||||
ARG NEXT_PUBLIC_SOURCEBOT_VERSION=BAKED_NEXT_PUBLIC_SOURCEBOT_VERSION
|
||||
ENV NEXT_PUBLIC_SEARCH_DEMO=BAKED_NEXT_PUBLIC_SEARCH_DEMO
|
||||
ENV NEXT_PUBLIC_POSTHOG_PAPIK=BAKED_NEXT_PUBLIC_POSTHOG_PAPIK
|
||||
# @note: leading "/" is required for the basePath property. @see: https://nextjs.org/docs/app/api-reference/next-config-js/basePath
|
||||
ARG NEXT_PUBLIC_DOMAIN_SUB_PATH=/BAKED_NEXT_PUBLIC_DOMAIN_SUB_PATH
|
||||
|
|
@ -54,6 +55,10 @@ ARG SOURCEBOT_VERSION=unknown
|
|||
ENV SOURCEBOT_VERSION=$SOURCEBOT_VERSION
|
||||
RUN echo "Sourcebot Version: $SOURCEBOT_VERSION"
|
||||
|
||||
ARG PUBLIC_SEARCH_DEMO=false
|
||||
ENV PUBLIC_SEARCH_DEMO=$PUBLIC_SEARCH_DEMO
|
||||
RUN echo "Public Search Demo: $PUBLIC_SEARCH_DEMO"
|
||||
|
||||
# Valid values are: debug, info, warn, error
|
||||
ENV SOURCEBOT_LOG_LEVEL=info
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,21 @@
|
|||
"flameshot-org/flameshot",
|
||||
"envoyproxy/envoy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "gitlab",
|
||||
"token": {
|
||||
"env": "GITLAB_TOKEN"
|
||||
},
|
||||
"groups": [
|
||||
"fdroid"
|
||||
],
|
||||
"exclude": {
|
||||
"projects": [
|
||||
"fdroid/wiki",
|
||||
"Matrixcoffee/internal-twif-preview"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -93,6 +93,11 @@ echo -e "\e[34m[Info] Using config file at: '$CONFIG_PATH'.\e[0m"
|
|||
export NEXT_PUBLIC_SOURCEBOT_VERSION="$SOURCEBOT_VERSION"
|
||||
fi
|
||||
|
||||
# Infer NEXT_PUBLIC_SEARCH_DEMO if it is not set
|
||||
if [ -z "$NEXT_PUBLIC_SEARCH_DEMO" ] && [ ! -z "$PUBLIC_SEARCH_DEMO" ]; then
|
||||
export NEXT_PUBLIC_SEARCH_DEMO="$PUBLIC_SEARCH_DEMO"
|
||||
fi
|
||||
|
||||
# Always infer NEXT_PUBLIC_POSTHOG_PAPIK
|
||||
export NEXT_PUBLIC_POSTHOG_PAPIK="$POSTHOG_PAPIK"
|
||||
|
||||
|
|
@ -103,6 +108,7 @@ echo -e "\e[34m[Info] Using config file at: '$CONFIG_PATH'.\e[0m"
|
|||
sed -i "s|BAKED_NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED|${NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED}|g" "$file"
|
||||
sed -i "s|BAKED_NEXT_PUBLIC_SOURCEBOT_VERSION|${NEXT_PUBLIC_SOURCEBOT_VERSION}|g" "$file"
|
||||
sed -i "s|BAKED_NEXT_PUBLIC_POSTHOG_PAPIK|${NEXT_PUBLIC_POSTHOG_PAPIK}|g" "$file"
|
||||
sed -i "s|BAKED_NEXT_PUBLIC_SEARCH_DEMO|${NEXT_PUBLIC_SEARCH_DEMO}|g" "$file"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ export const EditorContextMenu = ({
|
|||
description: "✅ Copied link to selection",
|
||||
});
|
||||
|
||||
captureEvent('share_link_created', {});
|
||||
captureEvent('wa_share_link_created', {});
|
||||
|
||||
// Reset the selection
|
||||
view.dispatch(
|
||||
|
|
|
|||
49
packages/web/src/app/components/registrationCard.tsx
Normal file
49
packages/web/src/app/components/registrationCard.tsx
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import Link from "next/link"
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { ArrowRight, Code, Database, Search } from "lucide-react"
|
||||
import useCaptureEvent from "@/hooks/useCaptureEvent"
|
||||
|
||||
export default function RegistrationCard() {
|
||||
const [isHovered, setIsHovered] = useState(false)
|
||||
const captureEvent = useCaptureEvent()
|
||||
|
||||
return (
|
||||
<Card
|
||||
className="w-full max-w-md mx-auto border shadow-lg overflow-hidden"
|
||||
onMouseEnter={() => setIsHovered(true)}
|
||||
onMouseLeave={() => setIsHovered(false)}
|
||||
>
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="text-xl font-bold mt-2">Try Sourcebot Cloud</CardTitle>
|
||||
<CardDescription>Index and search your own code repositories</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-start">
|
||||
<Search className="h-5 w-5 mr-3 text-primary" />
|
||||
<p className="text-sm">Search your private and public repositories</p>
|
||||
</div>
|
||||
<div className="flex items-start">
|
||||
<Database className="h-5 w-5 mr-3 text-primary" />
|
||||
<p className="text-sm">Index your own codebase in minutes</p>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
<CardFooter className="flex flex-col space-y-3 pt-0">
|
||||
<Link href="https://app.sourcebot.dev" className="w-full" rel="noopener noreferrer" onClick={() => captureEvent("wa_demo_try_card_pressed", {})}>
|
||||
<Button className={`w-full transition-all duration-300 ${isHovered ? "translate-y-[-2px]" : ""}`}>
|
||||
Try With Your Code
|
||||
<ArrowRight className="ml-2 h-4 w-4" />
|
||||
</Button>
|
||||
</Link>
|
||||
<p className="text-xs text-center text-muted-foreground">
|
||||
14 day free trial. No credit card required.
|
||||
</p>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
|
@ -12,6 +12,8 @@ import { SymbolIcon } from "@radix-ui/react-icons";
|
|||
import { UpgradeToast } from "./components/upgradeToast";
|
||||
import Link from "next/link";
|
||||
import { KeyboardShortcutHint } from "./components/keyboardShortcutHint";
|
||||
import RegistrationCard from "./components/registrationCard";
|
||||
import { PUBLIC_SEARCH_DEMO } from "@/lib/environment";
|
||||
|
||||
export default async function Home() {
|
||||
return (
|
||||
|
|
@ -38,6 +40,11 @@ export default async function Home() {
|
|||
autoFocus={true}
|
||||
className="mt-4 w-full max-w-[800px]"
|
||||
/>
|
||||
{PUBLIC_SEARCH_DEMO && (
|
||||
<div className="mt-8">
|
||||
<RegistrationCard />
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-8">
|
||||
<Suspense fallback={<div>...</div>}>
|
||||
<RepositoryList />
|
||||
|
|
|
|||
79
packages/web/src/components/ui/card.tsx
Normal file
79
packages/web/src/components/ui/card.tsx
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const Card = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.HTMLAttributes<HTMLDivElement>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
Card.displayName = "Card"
|
||||
|
||||
const CardHeader = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.HTMLAttributes<HTMLDivElement>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
CardHeader.displayName = "CardHeader"
|
||||
|
||||
const CardTitle = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.HTMLAttributes<HTMLDivElement>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"text-2xl font-semibold leading-none tracking-tight",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
CardTitle.displayName = "CardTitle"
|
||||
|
||||
const CardDescription = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.HTMLAttributes<HTMLDivElement>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn("text-sm text-muted-foreground", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
CardDescription.displayName = "CardDescription"
|
||||
|
||||
const CardContent = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.HTMLAttributes<HTMLDivElement>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
||||
))
|
||||
CardContent.displayName = "CardContent"
|
||||
|
||||
const CardFooter = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.HTMLAttributes<HTMLDivElement>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn("flex items-center p-6 pt-0", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
CardFooter.displayName = "CardFooter"
|
||||
|
||||
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
import 'server-only';
|
||||
|
||||
import { getEnv, getEnvNumber } from "./utils";
|
||||
import { getEnv, getEnvBoolean, getEnvNumber } from "./utils";
|
||||
|
||||
export const ZOEKT_WEBSERVER_URL = getEnv(process.env.ZOEKT_WEBSERVER_URL, "http://localhost:6070")!;
|
||||
export const SHARD_MAX_MATCH_COUNT = getEnvNumber(process.env.SHARD_MAX_MATCH_COUNT, 10000);
|
||||
export const TOTAL_MAX_MATCH_COUNT = getEnvNumber(process.env.TOTAL_MAX_MATCH_COUNT, 100000);
|
||||
export const SOURCEBOT_VERSION = getEnv(process.env.SOURCEBOT_VERSION, 'unknown')!;
|
||||
export const NODE_ENV = process.env.NODE_ENV;
|
||||
export const PUBLIC_SEARCH_DEMO = getEnvBoolean(process.env.PUBLIC_SEARCH_DEMO, false);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ export type PosthogEventMap = {
|
|||
flushReason: number,
|
||||
fileLanguages: string[]
|
||||
},
|
||||
share_link_created: {},
|
||||
wa_demo_try_card_pressed: {},
|
||||
wa_share_link_created: {},
|
||||
}
|
||||
|
||||
export type PosthogEvent = keyof PosthogEventMap;
|
||||
Loading…
Reference in a new issue