Merge pull request #920 from OpenSignLabs/raktima-opensignlabs-patch-11

fix: public profile user name already exist issue
This commit is contained in:
prafull-opensignlabs
2024-07-12 11:30:47 +05:30
committed by GitHub
4 changed files with 13 additions and 39 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ import { useNavigate } from "react-router-dom";
import Parse from "parse";
import { useWindowSize } from "../hook/useWindowSize";
import { checkIsSubscribed, getAppLogo, openInNewTab } from "../constant/Utils";
import { isEnableSubscription } from "../constant/const";
import { isEnableSubscription, isStaging } from "../constant/const";
const Header = ({ showSidebar }) => {
const navigate = useNavigate();
@@ -86,7 +86,7 @@ const Header = ({ showSidebar }) => {
};
}, [isOpen]);
const handleConsoleRedirect = () => {
if (window.location.host === "staging-app.opensignlabs.com") {
if (isStaging) {
window.open(" https://staging-console.opensignlabs.com/");
} else {
window.open("https://console.opensignlabs.com/");
+2 -1
View File
@@ -107,7 +107,7 @@ function UserProfile() {
let phn = Phone,
res = "";
//condition to call cloud function when user change publicUserName
if (previousPublicUserName.current !== publicUserName) {
if (publicUserName && previousPublicUserName.current !== publicUserName) {
res = await handleCheckPublicUserName();
}
if (!res) {
@@ -185,6 +185,7 @@ function UserProfile() {
const json = JSON.parse(JSON.stringify([res]));
const extRes = JSON.stringify(json);
localStorage.setItem("Extand_Class", extRes);
previousPublicUserName.current = publicUserName;
// console.log("updateRes ", updateRes);
};
// file upload function
@@ -1240,42 +1240,18 @@ const ReportTable = (props) => {
<p className="text-lg">
{props.isPublic[item.objectId]
? `Are you sure you want to make this template public ?`
: `Are you sure you want to make this template private ? This will remove it from your public profile ?`}
: `Are you sure you want to make this template private? This will remove it from your public profile.`}
</p>
{props.isPublic[item.objectId] && (
<div className="flex mt-2 gap-2 md:items-center">
<p className="text-[15px]">
Public role :{" "}
</p>
{/* {item?.Placeholders?.length > 1 ? (
<select
className="w-[60%] md:w-[70%] border-[1px] border-gray-200 rounded-sm p-[2px]"
name="textvalidate"
value={selectedPublicRole}
onChange={(e) =>
setSelectedPublicRole(
e.target.value
)
}
>
<option
disabled
style={{ fontSize: "13px" }}
value=""
>
Select...
</option>
{handleShowRole(item)}
</select>
) : ( */}
<input
className="op-input op-input-bordered focus:outline-none hover:border-base-content op-input-sm"
value={handleShowRole(item)}
/>
{/* {item?.Placeholders[0]?.Role} */}
{/* {handleShowRole(item)} */}
{/* </div> */}
{/* )} */}
</div>
)}
</div>
@@ -1306,27 +1282,24 @@ const ReportTable = (props) => {
handleClose={() => {
setIsPublicProfile({});
}}
reduceWidth={
"md:min-w-[440px] md:max-w-[550px]"
}
>
<div className="m-[20px]">
{publicUserName ? (
<div className="font-normal text-black">
<p>
Heres your public URL. Copy or share
it with the signer, and you will be
able to see all your publicly set
Heres your public URL: Copy it or
share it with the signer, and you will
be able to see all your publicly set
templates.
</p>
<div className=" flex items-center gap-5 mt-2 p-[2px] w-[75%]">
<div className=" flex items-center gap-3 mt-2 p-[2px] ">
<span className="font-bold">
Public URL :{" "}
</span>
<span
onClick={() => copytoProfileLink()}
className="underline underline-offset-2 cursor-pointer"
>{`https://opensign-me.vercel.app/${publicUserName}`}</span>
>{`https://opensign.me/${publicUserName}`}</span>
</div>
</div>
) : (
+2 -2
View File
@@ -23,7 +23,7 @@ const appId = process.env.REACT_APP_APPID
: "opensign";
const serverUrl = process.env.REACT_APP_SERVERURL
? process.env.REACT_APP_SERVERURL
: window.location.origin + "/api/app";
: "https://staging-app.opensignlabs.com/api/app";
localStorage.setItem("baseUrl", `${serverUrl}/`);
localStorage.setItem("parseAppId", appId);
Parse.initialize(appId);
@@ -33,7 +33,7 @@ const scriptComponent = document.createElement("div");
scriptComponent.id = "script-component";
document.body.appendChild(scriptComponent);
const link = document.createElement("link");
link.href = `${process.env.PUBLIC_URL}/css/fonts.css`;
link.href = "https://staging-app.opensignlabs.com/css/fonts.css";
link.rel = "stylesheet";
document.head.appendChild(link);