mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-13 04:45:19 +00:00
Fix root domain issue on onboarding
This commit is contained in:
parent
a93ee6527c
commit
7307134e77
6 changed files with 17 additions and 10 deletions
|
|
@ -9,7 +9,6 @@ import { Form, FormControl, FormField, FormItem, FormMessage } from "@/component
|
|||
import { Input } from "@/components/ui/input";
|
||||
import useCaptureEvent from "@/hooks/useCaptureEvent";
|
||||
import { useDomain } from "@/hooks/useDomain";
|
||||
import { NEXT_PUBLIC_ROOT_DOMAIN } from "@/lib/environment.client";
|
||||
import { orgDomainSchema } from "@/lib/schemas";
|
||||
import { isServiceError } from "@/lib/utils";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
|
|
@ -27,9 +26,10 @@ const formSchema = z.object({
|
|||
interface ChangeOrgDomainCardProps {
|
||||
currentUserRole: OrgRole,
|
||||
orgDomain: string,
|
||||
rootDomain: string,
|
||||
}
|
||||
|
||||
export function ChangeOrgDomainCard({ orgDomain, currentUserRole }: ChangeOrgDomainCardProps) {
|
||||
export function ChangeOrgDomainCard({ orgDomain, currentUserRole, rootDomain }: ChangeOrgDomainCardProps) {
|
||||
const domain = useDomain()
|
||||
const { toast } = useToast()
|
||||
const captureEvent = useCaptureEvent();
|
||||
|
|
@ -80,7 +80,7 @@ export function ChangeOrgDomainCard({ orgDomain, currentUserRole }: ChangeOrgDom
|
|||
<FormItem>
|
||||
<FormControl>
|
||||
<div className="flex items-center w-full">
|
||||
<div className="flex-shrink-0 text-sm text-muted-foreground bg-backgroundSecondary rounded-md rounded-r-none border border-r-0 px-3 py-[9px]">{NEXT_PUBLIC_ROOT_DOMAIN}/</div>
|
||||
<div className="flex-shrink-0 text-sm text-muted-foreground bg-backgroundSecondary rounded-md rounded-r-none border border-r-0 px-3 py-[9px]">{rootDomain}/</div>
|
||||
<Input
|
||||
placeholder={orgDomain}
|
||||
{...field}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import { isServiceError } from "@/lib/utils";
|
|||
import { getCurrentUserRole } from "@/actions";
|
||||
import { getOrgFromDomain } from "@/data/org";
|
||||
import { ChangeOrgDomainCard } from "./components/changeOrgDomainCard";
|
||||
import { SOURCEBOT_ROOT_DOMAIN } from "@/lib/environment";
|
||||
|
||||
interface GeneralSettingsPageProps {
|
||||
params: {
|
||||
domain: string;
|
||||
|
|
@ -40,6 +42,7 @@ export default async function GeneralSettingsPage({ params: { domain } }: Genera
|
|||
<ChangeOrgDomainCard
|
||||
orgDomain={org.domain}
|
||||
currentUserRole={currentUserRole}
|
||||
rootDomain={SOURCEBOT_ROOT_DOMAIN}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -13,12 +13,14 @@ import { Loader2 } from "lucide-react"
|
|||
import { useToast } from "@/components/hooks/use-toast"
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Card } from "@/components/ui/card"
|
||||
import { NEXT_PUBLIC_ROOT_DOMAIN } from "@/lib/environment.client";
|
||||
import useCaptureEvent from "@/hooks/useCaptureEvent";
|
||||
import { orgNameSchema, orgDomainSchema } from "@/lib/schemas"
|
||||
|
||||
interface OrgCreateFormProps {
|
||||
rootDomain: string;
|
||||
}
|
||||
|
||||
export function OrgCreateForm() {
|
||||
export function OrgCreateForm({ rootDomain }: OrgCreateFormProps) {
|
||||
const { toast } = useToast();
|
||||
const router = useRouter();
|
||||
const captureEvent = useCaptureEvent();
|
||||
|
|
@ -97,7 +99,7 @@ export function OrgCreateForm() {
|
|||
<FormDescription>{`Your organization's URL namespace. This is where your organization's Sourcebot instance will be accessible.`}</FormDescription>
|
||||
<FormControl>
|
||||
<div className="flex items-center w-full">
|
||||
<div className="flex-shrink-0 text-sm text-muted-foreground bg-backgroundSecondary rounded-md rounded-r-none border border-r-0 px-3 py-[9px]">{NEXT_PUBLIC_ROOT_DOMAIN}/</div>
|
||||
<div className="flex-shrink-0 text-sm text-muted-foreground bg-backgroundSecondary rounded-md rounded-r-none border border-r-0 px-3 py-[9px]">{rootDomain}/</div>
|
||||
<Input
|
||||
placeholder="aperture-labs"
|
||||
{...field}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { redirect } from "next/navigation";
|
|||
import { OnboardHeader } from "./components/onboardHeader";
|
||||
import { OnboardingSteps } from "@/lib/constants";
|
||||
import { LogoutEscapeHatch } from "../components/logoutEscapeHatch";
|
||||
import { SOURCEBOT_ROOT_DOMAIN } from "@/lib/environment";
|
||||
|
||||
export default async function Onboarding() {
|
||||
const session = await auth();
|
||||
|
|
@ -18,7 +19,7 @@ export default async function Onboarding() {
|
|||
description="Create a organization for your team to search and share code across your repositories."
|
||||
step={OnboardingSteps.CreateOrg}
|
||||
/>
|
||||
<OrgCreateForm />
|
||||
<OrgCreateForm rootDomain={SOURCEBOT_ROOT_DOMAIN} />
|
||||
<LogoutEscapeHatch className="absolute top-0 right-0 p-4 sm:p-12" />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -10,5 +10,4 @@ export const NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED = getEnvBoolean(process.en
|
|||
export const NEXT_PUBLIC_SOURCEBOT_VERSION = getEnv(process.env.NEXT_PUBLIC_SOURCEBOT_VERSION, "unknown")!;
|
||||
export const NEXT_PUBLIC_DOMAIN_SUB_PATH = getEnv(process.env.NEXT_PUBLIC_DOMAIN_SUB_PATH, "")!;
|
||||
export const NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY = getEnv(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY);
|
||||
export const NEXT_PUBLIC_POLLING_INTERVAL_MS = getEnvNumber(process.env.NEXT_PUBLIC_POLLING_INTERVAL_MS, 5000);
|
||||
export const NEXT_PUBLIC_ROOT_DOMAIN = getEnv(process.env.NEXT_PUBLIC_ROOT_DOMAIN, "localhost:3000")!;
|
||||
export const NEXT_PUBLIC_POLLING_INTERVAL_MS = getEnvNumber(process.env.NEXT_PUBLIC_POLLING_INTERVAL_MS, 5000);
|
||||
|
|
@ -22,4 +22,6 @@ export const STRIPE_WEBHOOK_SECRET = getEnv(process.env.STRIPE_WEBHOOK_SECRET);
|
|||
export const CONFIG_MAX_REPOS_NO_TOKEN = getEnvNumber(process.env.CONFIG_MAX_REPOS_NO_TOKEN, 500);
|
||||
|
||||
export const SMTP_CONNECTION_URL = getEnv(process.env.SMTP_CONNECTION_URL);
|
||||
export const EMAIL_FROM = getEnv(process.env.EMAIL_FROM);
|
||||
export const EMAIL_FROM = getEnv(process.env.EMAIL_FROM);
|
||||
|
||||
export const SOURCEBOT_ROOT_DOMAIN = getEnv(process.env.SOURCEBOT_ROOT_DOMAIN, "localhost:3000")!;
|
||||
Loading…
Reference in a new issue