Various improvements
This commit is contained in:
parent
fa34c5d8f5
commit
29f09b2093
3 changed files with 17 additions and 87 deletions
|
|
@ -25,10 +25,6 @@ export const TabloModal = ({ tablo, onClose, onEdit }: TabloModalProps) => {
|
|||
const [inviteEmail, setInviteEmail] = useState("");
|
||||
const inviteUser = useInviteUser();
|
||||
|
||||
const handleCancelEdit = () => {
|
||||
setEditData(null);
|
||||
};
|
||||
|
||||
const handleSaveEdit = () => {
|
||||
if (editData && onEdit) {
|
||||
// Clear the unused field based on selection
|
||||
|
|
@ -46,7 +42,6 @@ export const TabloModal = ({ tablo, onClose, onEdit }: TabloModalProps) => {
|
|||
const handleSendInvite = () => {
|
||||
if (inviteEmail.trim()) {
|
||||
inviteUser({ email: inviteEmail, tablo_id: tablo?.id ?? "" });
|
||||
setInviteEmail("");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -80,7 +75,7 @@ export const TabloModal = ({ tablo, onClose, onEdit }: TabloModalProps) => {
|
|||
</ClickOutside>
|
||||
) : (
|
||||
<h2
|
||||
className="text-2xl font-bold text-gray-900 dark:text-white cursor-pointer hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
|
||||
className="text-2xl font-bold text-gray-900 dark:text-white cursor-text hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
|
||||
onClick={() => setIsEditingName(true)}
|
||||
>
|
||||
{tablo.name}
|
||||
|
|
@ -146,7 +141,7 @@ export const TabloModal = ({ tablo, onClose, onEdit }: TabloModalProps) => {
|
|||
<button
|
||||
type="button"
|
||||
className="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md"
|
||||
onClick={handleCancelEdit}
|
||||
onClick={onClose}
|
||||
>
|
||||
Annuler
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { useMutation } from "@tanstack/react-query";
|
||||
import { api } from "@ui/lib/api";
|
||||
import { useSession } from "@ui/contexts/SessionContext";
|
||||
import { toast } from "@ui/ui-library/toast/toast-queue";
|
||||
|
||||
// Invite user by email
|
||||
export const useInviteUser = () => {
|
||||
|
|
@ -27,6 +28,18 @@ export const useInviteUser = () => {
|
|||
);
|
||||
return data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.add(
|
||||
{
|
||||
title: "Invitation envoyée avec succès",
|
||||
description: "L'utilisateur a été invité avec succès",
|
||||
type: "success",
|
||||
},
|
||||
{
|
||||
timeout: 2000,
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
return mutate;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { toast } from "@ui/ui-library/toast/toast-queue";
|
|||
|
||||
export const JoinPage = () => {
|
||||
const { tablo_name } = useParams<{ tablo_name: string }>();
|
||||
// const [searchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
const user = useUser();
|
||||
const joinTablo = useJoinTablo();
|
||||
|
|
@ -27,89 +26,12 @@ export const JoinPage = () => {
|
|||
navigate("/");
|
||||
}
|
||||
|
||||
// const handleJoinTablo = async () => {
|
||||
// if (!user || !tablo_name || !token) return;
|
||||
|
||||
// setJoining(true);
|
||||
// try {
|
||||
// // Add user to tablo_access table
|
||||
// const { error: accessError } = await supabase
|
||||
// .from("tablo_access")
|
||||
// .insert({
|
||||
// tablo_id: tablo.id,
|
||||
// user_id: user.id,
|
||||
// });
|
||||
|
||||
// if (accessError) {
|
||||
// setError("Failed to join tablo");
|
||||
// setJoining(false);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // Remove the invite since it's been used
|
||||
// await supabase.from("tablo_invites").delete().eq("id", invite.id);
|
||||
|
||||
// // Redirect to the tablo
|
||||
// navigate(`/tablo/${tablo.id}`);
|
||||
// } catch (err) {
|
||||
// setError("Failed to join tablo");
|
||||
// setJoining(false);
|
||||
// }
|
||||
// };
|
||||
|
||||
// if (error) {
|
||||
// return (
|
||||
// <div className="min-h-screen flex items-center justify-center">
|
||||
// <div className="text-center">
|
||||
// <div className="text-red-500 text-6xl mb-4">⚠️</div>
|
||||
// <h1 className="text-2xl font-bold text-gray-900 mb-2">
|
||||
// Invalid Invitation
|
||||
// </h1>
|
||||
// <p className="text-gray-600 mb-6">{error}</p>
|
||||
// <button
|
||||
// onClick={() => navigate("/")}
|
||||
// className="bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700"
|
||||
// >
|
||||
// Go Home
|
||||
// </button>
|
||||
// </div>
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
|
||||
// if (!user) {
|
||||
// return (
|
||||
// <div className="min-h-screen flex items-center justify-center">
|
||||
// <div className="text-center max-w-md">
|
||||
// <h1 className="text-2xl font-bold text-gray-900 mb-4">
|
||||
// Rejoindre Tablo "{tablo_name}"
|
||||
// </h1>
|
||||
// <div className="bg-white p-6 rounded-lg shadow-lg mb-6">
|
||||
// <h2 className="text-xl font-semibold mb-2">{tablo_name}</h2>
|
||||
// <p className="text-gray-600 mb-4">
|
||||
// Vous avez été invité(e) à rejoindre ce tablo
|
||||
// </p>
|
||||
// </div>
|
||||
// <p className="text-gray-600 mb-6">
|
||||
// Veuillez vous connecter pour accepter cette invitation
|
||||
// </p>
|
||||
// <button
|
||||
// onClick={() => navigate("/login")}
|
||||
// className="bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700"
|
||||
// >
|
||||
// Se connecter
|
||||
// </button>
|
||||
// </div>
|
||||
// </div>
|
||||
// );
|
||||
// }
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center bg-gray-50">
|
||||
<div className="max-w-md w-full">
|
||||
<div className="text-center mb-8">
|
||||
<h1 className="text-3xl font-bold text-gray-900">
|
||||
Rejoindre Tablo "{tablo_name}"
|
||||
Rejoindre le tablo "{tablo_name}"
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
|
@ -119,7 +41,7 @@ export const JoinPage = () => {
|
|||
{tablo_name}
|
||||
</h2>
|
||||
<p className="text-gray-600">
|
||||
Vous avez été invité(e) par un enculé à rejoindre ce tablo
|
||||
Vous avez été invité(e) à rejoindre ce tablo
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue