This commit is contained in:
Johannes
2023-10-07 14:57:00 +05:45
parent 7e2e0c9739
commit f8aaa0351f
@@ -1,14 +1,14 @@
"use client";
import { Button } from "@formbricks/ui";
import { TSurvey } from "@formbricks/types/v1/surveys";
import { ArrowPathIcon } from "@heroicons/react/24/outline";
import { DocumentDuplicateIcon, EyeIcon } from "@heroicons/react/24/solid";
import { useRef, useState, useEffect } from "react";
import toast from "react-hot-toast";
import { generateSingleUseIdAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/actions";
import { truncateMiddle } from "@/lib/utils";
import { cn } from "@formbricks/lib/cn";
import { generateSingleUseIdAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/actions";
import { TSurvey } from "@formbricks/types/v1/surveys";
import { Button } from "@formbricks/ui";
import { ArrowPathIcon } from "@heroicons/react/24/outline";
import { DocumentDuplicateIcon, EyeIcon } from "@heroicons/react/24/solid";
import { useEffect, useRef, useState } from "react";
import toast from "react-hot-toast";
interface LinkSingleUseSurveyModalProps {
survey: TSurvey;
@@ -28,7 +28,7 @@ export default function LinkSingleUseSurveyModal({ survey, surveyBaseUrl }: Link
};
const generateSingleUseIds = async (isEncrypted: boolean) => {
const promises = Array(5)
const promises = Array(7)
.fill(null)
.map(() => generateSingleUseIdAction(isEncrypted));
const ids = await Promise.all(promises);
@@ -51,7 +51,7 @@ export default function LinkSingleUseSurveyModal({ survey, surveyBaseUrl }: Link
return (
<>
{singleUseIds && (
<div className="bg-gremin-w-full w-full">
<div className="w-full">
<div className="flex justify-end">
<Button
variant="darkCTA"
@@ -65,7 +65,8 @@ export default function LinkSingleUseSurveyModal({ survey, surveyBaseUrl }: Link
</Button>
</div>
<div className="mt-4">
<div className="my-4 border-t border-slate-300 pb-2 pt-4">
<p className="mb-3 font-semibold text-slate-800">Single Use Links</p>
<div ref={linkTextRef} className="min flex flex-col space-y-4">
{singleUseIds &&
singleUseIds.map((singleUseId, index) => {
@@ -75,7 +76,7 @@ export default function LinkSingleUseSurveyModal({ survey, surveyBaseUrl }: Link
<div
key={singleUseId}
className={cn(
"row relative flex w-full cursor-pointer items-center justify-between overflow-hidden rounded-lg border border-slate-300 bg-white px-6 py-4 text-left text-slate-800 transition-all duration-200 ease-in-out hover:border-slate-500",
"row relative flex w-full cursor-pointer items-center justify-between overflow-hidden rounded-lg border border-slate-300 bg-white px-6 py-2 text-left text-slate-800 transition-all duration-200 ease-in-out hover:border-slate-500",
isSelected && "border-slate-200 text-slate-400 hover:border-slate-200"
)}
onClick={() => {
@@ -88,7 +89,7 @@ export default function LinkSingleUseSurveyModal({ survey, surveyBaseUrl }: Link
<div className="ml-2 min-h-full">
<Button
variant="secondary"
className="m-0 my-0 h-full w-full overflow-hidden whitespace-pre px-4 text-center"
className="m-0 my-0 h-full w-full overflow-hidden whitespace-pre text-center"
onClick={() => handleLinkOnClick(index)}>
{isSelected ? "Copied" : " Copy "}
</Button>