feat: implement hard delete, email notifications, watermark, and fix bulk download
This commit is contained in:
1 parent
8dd1e10fea
commit
4667615ed0
15 files changed
+369
-65
No files matched your search
@@ -22,20 +22,20 @@ type AlbumGridProps = {
|
||||
editorialId: string;
|
||||
grantAction: AlbumGridAction;
|
||||
revokeAction: AlbumGridAction;
|
||||
notifyAction: AlbumGridAction;
|
||||
};
|
||||
|
||||
function AlbumCard({
|
||||
album,
|
||||
editorialId,
|
||||
grantAction,
|
||||
revokeAction,
|
||||
}: {
|
||||
album: AlbumGridProps["albums"][0];
|
||||
type AlbumCardProps = {
|
||||
album: AlbumGridProps["albums"][number];
|
||||
editorialId: string;
|
||||
grantAction: AlbumGridAction;
|
||||
revokeAction: AlbumGridAction;
|
||||
}) {
|
||||
notifyAction: AlbumGridAction;
|
||||
};
|
||||
|
||||
function AlbumCard({ album, editorialId, grantAction, revokeAction, notifyAction }: AlbumCardProps) {
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const [notifyStatus, setNotifyStatus] = useState<"idle" | "pending" | "success" | "error">("idle");
|
||||
|
||||
const handleAction = (formData: FormData) => {
|
||||
startTransition(async () => {
|
||||
@@ -75,7 +75,7 @@ function AlbumCard({
|
||||
{album.albumName}
|
||||
</h2>
|
||||
<p className="text-sm text-gray-500 mb-4">{album.assetCount} Fotos</p>
|
||||
<div className="mt-auto">
|
||||
<div className="mt-auto space-y-2">
|
||||
<form action={handleAction}>
|
||||
<input name="immichAlbumId" type="hidden" value={album.id} />
|
||||
<button
|
||||
@@ -90,13 +90,39 @@ function AlbumCard({
|
||||
{isPending ? "Wird verarbeitet..." : album.isGranted ? "Zuweisung aufheben" : "Album zuweisen"}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
{album.isGranted && (
|
||||
<form action={(formData) => {
|
||||
setNotifyStatus("pending");
|
||||
notifyAction(editorialId, { ok: true, message: "" }, formData).then((res) => {
|
||||
setNotifyStatus(res.ok ? "success" : "error");
|
||||
setTimeout(() => setNotifyStatus("idle"), 3000);
|
||||
});
|
||||
}}>
|
||||
<input name="albumName" type="hidden" value={album.albumName} />
|
||||
<button
|
||||
type="submit"
|
||||
className={`w-full py-2 px-4 rounded-lg font-semibold text-sm transition-colors duration-200 border ${
|
||||
notifyStatus === "success" ? "bg-green-50 text-green-700 border-green-200" :
|
||||
notifyStatus === "error" ? "bg-red-50 text-red-700 border-red-200" :
|
||||
"bg-white text-gray-700 hover:bg-gray-50 border-gray-200 focus:ring-2 focus:ring-gray-200 focus:outline-none"
|
||||
}`}
|
||||
disabled={notifyStatus === "pending" || notifyStatus === "success"}
|
||||
>
|
||||
{notifyStatus === "pending" ? "Wird gesendet..." :
|
||||
notifyStatus === "success" ? "E-Mail gesendet!" :
|
||||
notifyStatus === "error" ? "Fehler beim Senden" :
|
||||
"Redaktion benachrichtigen"}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
export function AlbumGrid({ albums, editorialId, grantAction, revokeAction }: AlbumGridProps) {
|
||||
export function AlbumGrid({ albums, editorialId, grantAction, revokeAction, notifyAction }: AlbumGridProps) {
|
||||
const [search, setSearch] = useState("");
|
||||
|
||||
const filteredAlbums = albums.filter((album) =>
|
||||
@@ -125,6 +151,7 @@ export function AlbumGrid({ albums, editorialId, grantAction, revokeAction }: Al
|
||||
editorialId={editorialId}
|
||||
grantAction={grantAction}
|
||||
revokeAction={revokeAction}
|
||||
notifyAction={notifyAction}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
Reference in new issue
Block a user