mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-28 04:36:43 -05:00
d45cbefcff
# Conflicts: # apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/page.tsx # apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/page.tsx # apps/web/app/(app)/(onboarding)/organizations/[organizationId]/workspaces/new/settings/page.tsx # apps/web/app/(app)/environments/[environmentId]/actions.ts # apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.tsx # apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.tsx # apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.tsx # apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/emailTemplate.tsx # apps/web/modules/ee/contacts/[contactId]/components/activity-section.tsx # apps/web/modules/ee/contacts/components/contacts-secondary-navigation.tsx # apps/web/modules/ee/contacts/layout.tsx # apps/web/modules/ee/whitelabel/remove-branding/actions.ts # apps/web/modules/environments/lib/utils.test.ts # apps/web/modules/environments/lib/utils.ts # apps/web/modules/projects/settings/general/components/delete-project.tsx # apps/web/modules/survey/editor/page.tsx # apps/web/modules/survey/list/page.tsx # apps/web/modules/survey/templates/page.tsx # apps/web/modules/workspaces/settings/actions.ts # apps/web/modules/workspaces/settings/look/page.tsx
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { redirect } from "next/navigation";
|
|
import { ResourceNotFoundError } from "@formbricks/types/errors";
|
|
import { getPublicDomain } from "@/lib/getPublicUrl";
|
|
import { getTranslate } from "@/lingodotdev/server";
|
|
import { getEnvironmentAuth } from "@/modules/environments/lib/utils";
|
|
import { getWorkspaceWithTeamIdsByEnvironmentId } from "@/modules/survey/lib/workspace";
|
|
import { TemplateContainerWithPreview } from "./components/template-container";
|
|
|
|
interface SurveyTemplateProps {
|
|
params: Promise<{
|
|
environmentId: string;
|
|
}>;
|
|
}
|
|
|
|
export const SurveyTemplatesPage = async (props: SurveyTemplateProps) => {
|
|
const t = await getTranslate();
|
|
const params = await props.params;
|
|
const environmentId = params.environmentId;
|
|
|
|
const { session, environment, isReadOnly } = await getEnvironmentAuth(environmentId);
|
|
|
|
const workspace = await getWorkspaceWithTeamIdsByEnvironmentId(environmentId);
|
|
|
|
if (!workspace) {
|
|
throw new Error(t("common.workspace_not_found"));
|
|
}
|
|
|
|
if (isReadOnly) {
|
|
return redirect(`/environments/${environment.id}/surveys`);
|
|
}
|
|
|
|
const publicDomain = getPublicDomain();
|
|
|
|
return (
|
|
<TemplateContainerWithPreview
|
|
userId={session.user.id}
|
|
environment={environment}
|
|
workspace={workspace}
|
|
publicDomain={publicDomain}
|
|
/>
|
|
);
|
|
};
|