Skip to content

Commit

Permalink
remove connection modal
Browse files Browse the repository at this point in the history
  • Loading branch information
connorpark24 committed Nov 1, 2024
1 parent 16ea8ee commit 1683e89
Showing 1 changed file with 49 additions and 57 deletions.
106 changes: 49 additions & 57 deletions components/startups/StartupProfileTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,56 +41,56 @@ export default function StartupProfileTile({
} | null>(null);
const [connectionMessage, setConnectionMessage] = useState<string>("");

const { rank } = useSupabase();
const v1Community = rank && rank >= 1;
const v1Member = rank && rank >= 2;
// const { rank } = useSupabase();
// const v1Community = rank && rank >= 1;
// const v1Member = rank && rank >= 2;

const anonymousPersonImage =
"https://www.shutterstock.com/image-vector/default-avatar-profile-icon-social-600nw-1677509740.jpg";

const [isLoading, setIsLoading] = useState<boolean>(false);
// const [isLoading, setIsLoading] = useState<boolean>(false);

const sendConnectionMessage = useCallback(() => {
const session = supabase.auth.session();
if (!session) return;
const { access_token: accessToken } = session;
// const sendConnectionMessage = useCallback(() => {
// const session = supabase.auth.session();
// if (!session) return;
// const { access_token: accessToken } = session;

setIsLoading(true);
const body = JSON.stringify({
recipient: profileEmail,
message: connectionMessage,
});
fetch(CONNECTION_REQUEST_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${accessToken}`,
},
body,
})
.then(async (response) => {
setConnectDialogOpen(false);
setIsLoading(false);
// setIsLoading(true);
// const body = JSON.stringify({
// recipient: profileEmail,
// message: connectionMessage,
// });
// fetch(CONNECTION_REQUEST_URL, {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// Authorization: `Bearer ${accessToken}`,
// },
// body,
// })
// .then(async (response) => {
// setConnectDialogOpen(false);
// setIsLoading(false);

if (response.ok) {
setConnectionStatus({
success: true,
message: "Connection sent successfully!",
});
} else {
const errorBody = await response.text();
setConnectionStatus({ success: false, message: errorBody });
}
})
.catch((error) => {
console.log("Error sending connection request:", error);
setIsLoading(false);
setConnectionStatus({
success: false,
message: "An error occurred while sending the connection request.",
});
});
}, [profileEmail, connectionMessage]);
// if (response.ok) {
// setConnectionStatus({
// success: true,
// message: "Connection sent successfully!",
// });
// } else {
// const errorBody = await response.text();
// setConnectionStatus({ success: false, message: errorBody });
// }
// })
// .catch((error) => {
// console.log("Error sending connection request:", error);
// setIsLoading(false);
// setConnectionStatus({
// success: false,
// message: "An error occurred while sending the connection request.",
// });
// });
// }, [profileEmail, connectionMessage]);

return (
<div className="flex flex-col items-center p-2">
Expand Down Expand Up @@ -135,12 +135,12 @@ export default function StartupProfileTile({

<Transition
as={Fragment}
enter="transition ease-out duration-150"
enterFrom="opacity-0 scale-50"
enter="transition ease-out duration-100"
enterFrom="opacity-0 scale-75"
enterTo="opacity-100 scale-100"
leave="transition ease-in duration-150"
leave="transition ease-in duration-100"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-50"
leaveTo="opacity-0 scale-75"
>
<Popover.Panel className="absolute z-[9999] bottom-[-30px] left-1/2 transform -translate-x-1/2 flex space-x-4">
<div className="flex items-center space-x-2">
Expand Down Expand Up @@ -168,7 +168,7 @@ export default function StartupProfileTile({
</Popover>
)}

<Transition appear show={connectDialogOpen} as={Fragment}>
{/* <Transition appear show={connectDialogOpen} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
Expand Down Expand Up @@ -199,7 +199,6 @@ export default function StartupProfileTile({
>
<Dialog.Panel className="w-full max-w-lg transform overflow-hidden rounded-2xl bg-white px-6 py-2 text-left align-middle shadow-xl transition-all">
<div className="flex flex-col justify-between items-start">
{(v1Community || v1Member) && (
<p className="text-sm p-4 flex items-center">
<FaSlack className="mr-2 w-4 h-4" />
<a
Expand All @@ -209,9 +208,7 @@ export default function StartupProfileTile({
className="hover:underline text-blue-600"
>{`Message ${displayName} on Slack`}</a>
</p>
)}
{v1Member && (
<div className="w-full px-4 pb-4">
<div className="flex items-center mb-2">
<FaEnvelope className="mr-2 w-4 h-4" />
Expand Down Expand Up @@ -252,27 +249,22 @@ export default function StartupProfileTile({
</div>
</div>
</div>
)}
{/* {!(v1Community || v1Member) && (
<p className="text-sm text-gray-400">
Become a V1 Member to connect with {displayName}{" "}
through email!
</p>
)} */}
{/* {!(v1Community || v1Member) && (
<p className="text-sm text-gray-400">
Finish signing in to connect with members of V1!
</p>
)} */}
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition>
</Transition> */}
</div>
);
}

0 comments on commit 1683e89

Please sign in to comment.