diff --git a/README.md b/README.md
index 975114cc..6b914c7f 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ The objective is to have a self-hosted place to keep useful links in one place,
* 🏷 Set multiple tags to each link.
-* 🗂 Assign each link to a list where we can further group links.
+* 🗂 Assign each link to a collection where we can further group links.
**Also take a look at our planned features in the [project roadmap section](https://github.com/Daniel31x13/link-warden/wiki#project-roadmap).**
diff --git a/src/App.js b/src/App.js
index ec93a269..b6e2f5fa 100644
--- a/src/App.js
+++ b/src/App.js
@@ -7,12 +7,12 @@ import Filters from "./componets/Filters";
import sortList from "./modules/sortList";
import filter from "./modules/filterData";
import concatTags from "./modules/concatTags";
-import concatLists from "./modules/concatLists";
+import concatCollections from "./modules/concatCollections";
import NoResults from "./componets/NoResults";
import Loader from "./componets/Loader";
import SideBar from "./componets/SideBar";
import Tags from "./routes/Tags.js";
-import Lists from "./routes/Lists.js";
+import Collections from "./routes/Collections.js";
import { Route, Routes } from "react-router-dom";
function App() {
@@ -96,7 +96,7 @@ function App() {
@@ -154,7 +154,7 @@ function App() {
reFetch={fetchData}
lightMode={lightMode}
tags={() => concatTags(data)}
- lists={() => concatLists(data)}
+ collections={() => concatCollections(data)}
/>
) : null}
@@ -173,7 +173,7 @@ function App() {
SetLoader={SetLoader}
data={filteredData}
tags={concatTags(data)}
- lists={concatLists(data)}
+ collections={concatCollections(data)}
reFetch={fetchData}
/>
@@ -188,21 +188,21 @@ function App() {
SetLoader={SetLoader}
data={filteredData}
tags={concatTags(data)}
- lists={concatLists(data)}
+ collections={concatCollections(data)}
reFetch={fetchData}
/>
}
/>
}
diff --git a/src/componets/AddItem.js b/src/componets/AddItem.js
index f42bac82..e17ac164 100644
--- a/src/componets/AddItem.js
+++ b/src/componets/AddItem.js
@@ -2,17 +2,24 @@ import { useState } from "react";
import "../styles/SendItem.css";
import TagSelection from "./TagSelection";
import addItem from "../modules/send";
-import ListSelection from "./ListSelection";
+import CollectionSelection from "./CollectionSelection";
-const AddItem = ({ onExit, reFetch, tags, lists, SetLoader, lightMode }) => {
+const AddItem = ({
+ onExit,
+ reFetch,
+ tags,
+ collections,
+ SetLoader,
+ lightMode,
+}) => {
const [name, setName] = useState(""),
[link, setLink] = useState(""),
[tag, setTag] = useState([]),
- [list, setList] = useState([]);
+ [collection, setCollection] = useState("Unsorted");
function newItem() {
SetLoader(true);
- addItem(name, link, tag, list, reFetch, onExit, SetLoader, "POST");
+ addItem(name, link, tag, collection, reFetch, onExit, SetLoader, "POST");
}
function SetName(e) {
@@ -27,8 +34,8 @@ const AddItem = ({ onExit, reFetch, tags, lists, SetLoader, lightMode }) => {
setTag(value.map((e) => e.value.toLowerCase()));
}
- function SetList(value) {
- setList(value.value);
+ function SetCollection(value) {
+ setCollection(value.value);
}
function abort(e) {
@@ -67,11 +74,11 @@ const AddItem = ({ onExit, reFetch, tags, lists, SetLoader, lightMode }) => {
- List: (Optional)
+ Collections: (Optional)
-
diff --git a/src/componets/ListSelection.js b/src/componets/CollectionSelection.js
similarity index 81%
rename from src/componets/ListSelection.js
rename to src/componets/CollectionSelection.js
index 1282cd18..d5b999e7 100644
--- a/src/componets/ListSelection.js
+++ b/src/componets/CollectionSelection.js
@@ -1,6 +1,11 @@
import CreatableSelect from "react-select/creatable";
-export default function ListSelection({ setList, lists, list = 'Unsorted', lightMode }) {
+export default function CollectionSelection({
+ setCollection,
+ collections,
+ collection = "Unsorted",
+ lightMode,
+}) {
const customStyles = {
container: (provided) => ({
...provided,
@@ -46,17 +51,17 @@ export default function ListSelection({ setList, lists, list = 'Unsorted', light
}),
};
- const data = lists().map((e) => {
+ const data = collections().map((e) => {
return { value: e, label: e };
});
- const defaultList = { value: list, label: list };
+ const defaultCollection = { value: collection, label: collection };
return (
);
diff --git a/src/componets/EditItem.js b/src/componets/EditItem.js
index 9638a095..c23eb772 100644
--- a/src/componets/EditItem.js
+++ b/src/componets/EditItem.js
@@ -3,12 +3,20 @@ import deleteEntity from "../modules/deleteEntity";
import "../styles/SendItem.css";
import TagSelection from "./TagSelection";
import editItem from "../modules/send";
-import ListSelection from "./ListSelection";
+import CollectionSelection from "./CollectionSelection";
-const EditItem = ({ tags, lists, item, onExit, SetLoader, reFetch, lightMode }) => {
+const EditItem = ({
+ tags,
+ collections,
+ item,
+ onExit,
+ SetLoader,
+ reFetch,
+ lightMode,
+}) => {
const [name, setName] = useState(item.name),
- [tag, setTag] = useState(item.tag),
- [list, setList] = useState(item.list);
+ [tag, setTag] = useState(item.tag),
+ [collection, setCollection] = useState(item.collection);
function EditItem() {
SetLoader(true);
@@ -16,7 +24,7 @@ const EditItem = ({ tags, lists, item, onExit, SetLoader, reFetch, lightMode })
name,
item.link,
tag,
- list,
+ collection,
reFetch,
onExit,
SetLoader,
@@ -39,8 +47,8 @@ const EditItem = ({ tags, lists, item, onExit, SetLoader, reFetch, lightMode })
setTag(value.map((e) => e.value.toLowerCase()));
}
- function SetList(value) {
- setList(value.value);
+ function SetCollection(value) {
+ setCollection(value.value);
}
function abort(e) {
@@ -96,12 +104,12 @@ const EditItem = ({ tags, lists, item, onExit, SetLoader, reFetch, lightMode })
lightMode={lightMode}
/>
- List: (Optional)
+ Collection: (Optional)
-
diff --git a/src/componets/List.js b/src/componets/List.js
index 84974923..bfcf05d1 100644
--- a/src/componets/List.js
+++ b/src/componets/List.js
@@ -5,7 +5,7 @@ import EditItem from "./EditItem";
import { useState } from "react";
import { Link } from "react-router-dom";
-const List = ({ data, tags, lists, reFetch, SetLoader, lightMode }) => {
+const List = ({ data, tags, collections, reFetch, SetLoader, lightMode }) => {
const [editBox, setEditBox] = useState(false);
const [editIndex, setEditIndex] = useState(0);
@@ -24,7 +24,7 @@ const List = ({ data, tags, lists, reFetch, SetLoader, lightMode }) => {
tags}
- lists={() => lists}
+ collections={() => collections}
onExit={exitEditing}
SetLoader={SetLoader}
reFetch={reFetch}
diff --git a/src/componets/SideBar.js b/src/componets/SideBar.js
index 4e3a3a19..33172bfd 100644
--- a/src/componets/SideBar.js
+++ b/src/componets/SideBar.js
@@ -11,7 +11,7 @@ import "react-pro-sidebar/dist/css/styles.css";
import "../styles/SideBar.css";
import { Link } from "react-router-dom";
-const SideBar = ({ tags, lists, handleToggleSidebar, toggle }) => {
+const SideBar = ({ tags, collections, handleToggleSidebar, toggle }) => {
const sortedTags = tags.sort((a, b) => {
const A = a.toLowerCase(),
B = b.toLowerCase();
@@ -20,7 +20,7 @@ const SideBar = ({ tags, lists, handleToggleSidebar, toggle }) => {
return 0;
});
- const sortedLists = lists
+ const sortedCollections = collections
.sort((a, b) => {
const A = a.toLowerCase(),
B = b.toLowerCase();
@@ -52,11 +52,14 @@ const SideBar = ({ tags, lists, handleToggleSidebar, toggle }) => {
}
- suffix={{sortedTags.length} }
- title={Lists
}
+ suffix={{sortedCollections.length} }
+ title={Collections
}
>
- {sortedLists.map((e, i) => {
- const path = `/lists/${e}`;
+ }>
+ Unsorted
+
+ {sortedCollections.map((e, i) => {
+ const path = `/collections/${e}`;
return (
} key={i}>
{e}
diff --git a/src/modules/concatCollections.js b/src/modules/concatCollections.js
new file mode 100644
index 00000000..f22315a2
--- /dev/null
+++ b/src/modules/concatCollections.js
@@ -0,0 +1,13 @@
+const concatCollections = (data) => {
+ let collections = [];
+
+ for (let i = 0; i < data.length; i++) {
+ collections = collections.concat(data[i].collection);
+ }
+
+ collections = collections.filter((v, i, a) => a.indexOf(v) === i);
+
+ return collections;
+};
+
+export default concatCollections;
diff --git a/src/modules/concatLists.js b/src/modules/concatLists.js
deleted file mode 100644
index 31b496db..00000000
--- a/src/modules/concatLists.js
+++ /dev/null
@@ -1,13 +0,0 @@
-const concatLists = (data) => {
- let lists = [];
-
- for (let i = 0; i < data.length; i++) {
- lists = lists.concat(data[i].list);
- }
-
- lists = lists.filter((v, i, a) => a.indexOf(v) === i);
-
- return lists;
-};
-
-export default concatLists;
diff --git a/src/modules/send.js b/src/modules/send.js
index 72c6b416..715382ab 100644
--- a/src/modules/send.js
+++ b/src/modules/send.js
@@ -5,7 +5,7 @@ const addItem = async (
name,
link,
tag,
- list,
+ collection,
reFetch,
onExit,
SetLoader,
@@ -37,7 +37,7 @@ const addItem = async (
title: title,
link: link,
tag: tag,
- list: list,
+ collection: collection,
date: dateCreated,
}),
headers: {
diff --git a/src/routes/Lists.js b/src/routes/Collections.js
similarity index 60%
rename from src/routes/Lists.js
rename to src/routes/Collections.js
index 64366fd0..a08f1963 100644
--- a/src/routes/Lists.js
+++ b/src/routes/Collections.js
@@ -1,10 +1,10 @@
import { useParams } from "react-router-dom";
import List from "../componets/List";
-const Lists = ({ data, tags, lists, SetLoader, lightMode, reFetch }) => {
- const { listId } = useParams();
+const Collections = ({ data, tags, collections, SetLoader, lightMode, reFetch }) => {
+ const { collectionId } = useParams();
const dataWithMatchingTag = data.filter((e) => {
- return e.list.includes(listId);
+ return e.collection.includes(collectionId);
});
return (
@@ -13,7 +13,7 @@ const Lists = ({ data, tags, lists, SetLoader, lightMode, reFetch }) => {
lightMode={lightMode}
data={dataWithMatchingTag}
tags={tags}
- lists={lists}
+ collections={collections}
SetLoader={SetLoader}
reFetch={reFetch}
/>
@@ -21,4 +21,4 @@ const Lists = ({ data, tags, lists, SetLoader, lightMode, reFetch }) => {
);
};
-export default Lists;
+export default Collections;