-
-
-
-
- Dashboard
-
+
+
+
-
-
-
-
- Links
-
+
+
-
-
+
+
+
+
+ All Collections
+
+
+
-
- Collections
-
+
+
@@ -145,9 +156,9 @@ export default function Sidebar({ className }: { className?: string }) {
{theme ? (
(() => {
- const storedValue =
- typeof window !== "undefined" &&
- localStorage.getItem("linkPinDisclosure");
- return storedValue ? storedValue === "true" : true;
- });
+ const [showLinks, setShowLinks] = useState(3);
useLinks({ pinnedOnly: true, sort: 0 });
@@ -57,25 +49,18 @@ export default function Dashboard() {
);
}, [collections]);
- useEffect(() => {
- localStorage.setItem(
- "linkPinDisclosure",
- linkPinDisclosure ? "true" : "false"
- );
- }, [linkPinDisclosure]);
-
- const handleNumberOfRecents = () => {
- if (window.innerWidth > 1550) {
- setShowRecents(6);
+ const handleNumberOfLinksToShow = () => {
+ if (window.innerWidth > 1535) {
+ setShowLinks(6);
} else if (window.innerWidth > 1295) {
- setShowRecents(4);
- } else setShowRecents(3);
+ setShowLinks(4);
+ } else setShowLinks(3);
};
const { width } = useWindowDimensions();
useEffect(() => {
- handleNumberOfRecents();
+ handleNumberOfLinksToShow();
}, [width]);
const [importDropdown, setImportDropdown] = useState(false);
@@ -197,7 +182,7 @@ export default function Dashboard() {
- {links.slice(0, showRecents).map((e, i) => (
+ {links.slice(0, showLinks).map((e, i) => (
))}
@@ -314,38 +299,32 @@ export default function Dashboard() {
/>
Pinned Links
- {links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
-
- ) : undefined}
+
+ View All
+
+
- {links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
+ {links[0] ? (
{links
+
.filter((e) => e.pinnedBy && e.pinnedBy[0])
- .map((e, i) => (
-
- ))}
+ .map((e, i) => )
+ .slice(0, showLinks)}
) : (
diff --git a/pages/links/pinned.tsx b/pages/links/pinned.tsx
new file mode 100644
index 0000000..130a4e4
--- /dev/null
+++ b/pages/links/pinned.tsx
@@ -0,0 +1,74 @@
+import LinkCard from "@/components/LinkCard";
+import NoLinksFound from "@/components/NoLinksFound";
+import SortDropdown from "@/components/SortDropdown";
+import useLinks from "@/hooks/useLinks";
+import MainLayout from "@/layouts/MainLayout";
+import useLinkStore from "@/store/links";
+import { Sort } from "@/types/global";
+import { faSort, faThumbTack } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useState } from "react";
+
+export default function PinnedLinks() {
+ const { links } = useLinkStore();
+
+ const [sortDropdown, setSortDropdown] = useState(false);
+ const [sortBy, setSortBy] = useState
(Sort.DateNewestFirst);
+
+ useLinks({ sort: sortBy, pinnedOnly: true });
+
+ return (
+
+
+
+
+
+
+
+ Pinned Links
+
+
+
+ Pinned Links from your Collections
+
+
+
+
+
+
setSortDropdown(!sortDropdown)}
+ id="sort-dropdown"
+ className="inline-flex rounded-md cursor-pointer hover:bg-slate-200 hover:dark:bg-neutral-700 duration-100 p-1"
+ >
+
+
+
+ {sortDropdown ? (
+
setSortDropdown(!sortDropdown)}
+ />
+ ) : null}
+
+
+ {links[0] ? (
+
+ {links.map((e, i) => {
+ return ;
+ })}
+
+ ) : (
+
+ )}
+
+
+ );
+}
diff --git a/pages/settings/account.tsx b/pages/settings/account.tsx
index 45770c3..a34ac99 100644
--- a/pages/settings/account.tsx
+++ b/pages/settings/account.tsx
@@ -334,7 +334,7 @@ export default function Account() {
{user.isPrivate && (
-