-
+
+
+
+
+ {props.status ? (
+
+ ) : (
- {props.status ? (
-
- ) : (
-
- )}
-
-
-
- {props.title_ru && (
-
- {props.title_ru}
-
- )}
- {props.title_original && (
-
- {props.title_original}
-
- )}
-
+ )}
+
+
+
+ {props.title_ru && (
+
+ {props.title_ru}
+
+ )}
+ {props.title_original && (
+
+ {props.title_original}
+
+ )}
diff --git a/app/pages/CreateCollection.tsx b/app/pages/CreateCollection.tsx
index 0f2cd40..9269b56 100644
--- a/app/pages/CreateCollection.tsx
+++ b/app/pages/CreateCollection.tsx
@@ -1,6 +1,8 @@
"use client";
+import useSWR from "swr";
+import useSWRInfinite from "swr/infinite";
import { useUserStore } from "#/store/auth";
-import { useEffect, useState } from "react";
+import { useEffect, useState, useCallback } from "react";
import { useSearchParams, useRouter } from "next/navigation";
import { ENDPOINTS } from "#/api/config";
import {
@@ -11,7 +13,24 @@ import {
Textarea,
FileInput,
Label,
+ Modal,
} from "flowbite-react";
+import { ReleaseSection } from "#/components/ReleaseSection/ReleaseSection";
+import { ReleaseLink } from "#/components/ReleaseLink/ReleaseLink";
+
+const fetcher = async (url: string) => {
+ const res = await fetch(url);
+
+ if (!res.ok) {
+ const error = new Error(
+ `An error occurred while fetching the data. status: ${res.status}`
+ );
+ error.message = await res.json();
+ throw error;
+ }
+
+ return res.json();
+};
export const CreateCollectionPage = () => {
const userStore = useUserStore();
@@ -31,6 +50,9 @@ export const CreateCollectionPage = () => {
title: 0,
description: 0,
});
+ const [addedReleases, setAddedReleases] = useState([]);
+ const [addedReleasesIds, setAddedReleasesIds] = useState([]);
+ const [releasesEditModalOpen, setReleasesEditModalOpen] = useState(false);
const collection_id = searchParams.get("id") || null;
const mode = searchParams.get("mode") || null;
@@ -105,6 +127,21 @@ export const CreateCollectionPage = () => {
});
}
+ function _deleteRelease(release: any) {
+ let releasesArray = [];
+ let idsArray = [];
+
+ for (let i = 0; i < addedReleases.length; i++) {
+ if (addedReleases[i].id != release.id) {
+ releasesArray.push(addedReleases[i]);
+ idsArray.push(addedReleasesIds[i]);
+ }
+ }
+
+ setAddedReleases(releasesArray);
+ setAddedReleasesIds(idsArray);
+ }
+
return (
@@ -112,14 +149,14 @@ export const CreateCollectionPage = () => {
{edit ? "Редактирование коллекции" : "Создание коллекции"}