Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b868318548 | |||
| 09ee81bf11 | |||
| 31663faa5a | |||
| 88a8c21aa4 | |||
| cd8081e610 | |||
| 1e0aaed833 | |||
| 34eec78ba4 | |||
| 11c834c61b | |||
| aefcd6d311 | |||
| dd09fd9026 | |||
| b19d6694ec | |||
| 49b1ea4875 |
@@ -28,9 +28,7 @@ export default function Checkbox({ label, state, className, onClick }: Props) {
|
|||||||
icon={faSquare}
|
icon={faSquare}
|
||||||
className="w-5 h-5 text-sky-500 dark:text-sky-500 peer-checked:hidden block"
|
className="w-5 h-5 text-sky-500 dark:text-sky-500 peer-checked:hidden block"
|
||||||
/>
|
/>
|
||||||
<span className="text-black dark:text-white rounded select-none">
|
<span className="rounded select-none">{label}</span>
|
||||||
{label}
|
|
||||||
</span>
|
|
||||||
</label>
|
</label>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,13 +165,15 @@ export default function LinkCard({ link, count, className }: Props) {
|
|||||||
onClick={() => router.push("/links/" + link.id)}
|
onClick={() => router.push("/links/" + link.id)}
|
||||||
className="flex items-start cursor-pointer gap-5 sm:gap-10 h-full w-full p-5"
|
className="flex items-start cursor-pointer gap-5 sm:gap-10 h-full w-full p-5"
|
||||||
>
|
>
|
||||||
{url && account.blurredFavicons && (
|
{url && account.displayLinkIcons && (
|
||||||
<Image
|
<Image
|
||||||
src={`https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${url.origin}&size=32`}
|
src={`https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${url.origin}&size=32`}
|
||||||
width={64}
|
width={64}
|
||||||
height={64}
|
height={64}
|
||||||
alt=""
|
alt=""
|
||||||
className="blur-sm absolute w-16 group-hover:opacity-80 duration-100 rounded-2xl bottom-5 right-5 opacity-60 select-none"
|
className={`${
|
||||||
|
account.blurredFavicons ? "blur-sm " : ""
|
||||||
|
}absolute w-16 group-hover:opacity-80 duration-100 rounded-2xl bottom-5 right-5 opacity-60 select-none`}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
const target = e.target as HTMLElement;
|
const target = e.target as HTMLElement;
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
import { faFolder, faLink } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import Image from "next/image";
|
||||||
|
import { faCalendarDays } from "@fortawesome/free-regular-svg-icons";
|
||||||
|
import isValidUrl from "@/lib/client/isValidUrl";
|
||||||
|
import A from "next/link";
|
||||||
|
import unescapeString from "@/lib/client/unescapeString";
|
||||||
|
import { Link } from "@prisma/client";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
link?: Partial<Link>;
|
||||||
|
className?: string;
|
||||||
|
settings: {
|
||||||
|
blurredFavicons: boolean;
|
||||||
|
displayLinkIcons: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function LinkPreview({ link, className, settings }: Props) {
|
||||||
|
if (!link) {
|
||||||
|
link = {
|
||||||
|
name: "Linkwarden",
|
||||||
|
url: "https://linkwarden.app",
|
||||||
|
createdAt: Date.now() as unknown as Date,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let shortendURL;
|
||||||
|
|
||||||
|
try {
|
||||||
|
shortendURL = new URL(link.url as string).host.toLowerCase();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = isValidUrl(link.url as string)
|
||||||
|
? new URL(link.url as string)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
const formattedDate = new Date(link.createdAt as Date).toLocaleString(
|
||||||
|
"en-US",
|
||||||
|
{
|
||||||
|
year: "numeric",
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
className={`h-fit border border-solid border-sky-100 dark:border-neutral-700 bg-gradient-to-tr from-slate-200 dark:from-neutral-800 from-10% to-gray-50 dark:to-[#303030] via-20% shadow hover:shadow-none duration-100 rounded-2xl relative group ${
|
||||||
|
className || ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<div className="flex items-start cursor-pointer gap-5 sm:gap-10 h-full w-full p-5">
|
||||||
|
{url && settings?.displayLinkIcons && (
|
||||||
|
<Image
|
||||||
|
src={`https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${url.origin}&size=32`}
|
||||||
|
width={64}
|
||||||
|
height={64}
|
||||||
|
alt=""
|
||||||
|
className={`${
|
||||||
|
settings.blurredFavicons ? "blur-sm " : ""
|
||||||
|
}absolute w-16 group-hover:opacity-80 duration-100 rounded-2xl bottom-5 right-5 opacity-60 select-none`}
|
||||||
|
draggable="false"
|
||||||
|
onError={(e) => {
|
||||||
|
const target = e.target as HTMLElement;
|
||||||
|
target.style.display = "none";
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="flex justify-between gap-5 w-full h-full z-0">
|
||||||
|
<div className="flex flex-col justify-between w-full">
|
||||||
|
<div className="flex items-baseline gap-1">
|
||||||
|
<p className="text-sm text-gray-500 dark:text-gray-300">{1}</p>
|
||||||
|
<p className="text-lg text-black dark:text-white truncate capitalize w-full pr-8">
|
||||||
|
{unescapeString(link.name as string)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-1 max-w-full w-fit my-1 hover:opacity-70 duration-100">
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={faFolder}
|
||||||
|
className="w-4 h-4 mt-1 drop-shadow text-sky-400"
|
||||||
|
/>
|
||||||
|
<p className="text-black dark:text-white truncate capitalize w-full">
|
||||||
|
Landing Pages ⚡️
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<A
|
||||||
|
href={link.url as string}
|
||||||
|
target="_blank"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
}}
|
||||||
|
className="flex items-center gap-1 max-w-full w-fit text-gray-500 dark:text-gray-300 hover:opacity-70 duration-100"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={faLink} className="mt-1 w-4 h-4" />
|
||||||
|
<p className="truncate w-full">{shortendURL}</p>
|
||||||
|
</A>
|
||||||
|
<div className="flex items-center gap-1 text-gray-500 dark:text-gray-300">
|
||||||
|
<FontAwesomeIcon icon={faCalendarDays} className="w-4 h-4" />
|
||||||
|
<p>{formattedDate}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
} from "@fortawesome/free-brands-svg-icons";
|
} from "@fortawesome/free-brands-svg-icons";
|
||||||
|
|
||||||
export default function SettingsSidebar({ className }: { className?: string }) {
|
export default function SettingsSidebar({ className }: { className?: string }) {
|
||||||
const LINKWARDEN_VERSION = "v2.1.0";
|
const LINKWARDEN_VERSION = "v2.2.1";
|
||||||
|
|
||||||
const { collections } = useCollectionStore();
|
const { collections } = useCollectionStore();
|
||||||
|
|
||||||
@@ -43,9 +43,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === `/settings/account`
|
active === `/settings/account`
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
? "bg-sky-500"
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
: "hover:bg-slate-500"
|
||||||
} duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
} duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faUser}
|
icon={faUser}
|
||||||
@@ -62,9 +62,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === `/settings/appearance`
|
active === `/settings/appearance`
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
? "bg-sky-500"
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
: "hover:bg-slate-500"
|
||||||
} duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
} duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faPalette}
|
icon={faPalette}
|
||||||
@@ -81,9 +81,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === `/settings/archive`
|
active === `/settings/archive`
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
? "bg-sky-500"
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
: "hover:bg-slate-500"
|
||||||
} duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
} duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faBoxArchive}
|
icon={faBoxArchive}
|
||||||
@@ -100,9 +100,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === `/settings/password`
|
active === `/settings/password`
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
? "bg-sky-500"
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
: "hover:bg-slate-500"
|
||||||
} duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
} duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faKey}
|
icon={faKey}
|
||||||
@@ -120,9 +120,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === `/settings/billing`
|
active === `/settings/billing`
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
? "bg-sky-500"
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
: "hover:bg-slate-500"
|
||||||
} duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
} duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faCreditCard}
|
icon={faCreditCard}
|
||||||
@@ -139,7 +139,7 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
|
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<Link
|
<Link
|
||||||
href={`https://github.com/linkwarden/linkwarden/releases/tag/${LINKWARDEN_VERSION}`}
|
href={`https://github.com/linkwarden/linkwarden/releases`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="dark:text-gray-300 text-gray-500 text-sm ml-2 hover:opacity-50 duration-100"
|
className="dark:text-gray-300 text-gray-500 text-sm ml-2 hover:opacity-50 duration-100"
|
||||||
>
|
>
|
||||||
@@ -147,7 +147,7 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
</Link>
|
</Link>
|
||||||
<Link href="https://docs.linkwarden.app" target="_blank">
|
<Link href="https://docs.linkwarden.app" target="_blank">
|
||||||
<div
|
<div
|
||||||
className={`hover:bg-slate-200 hover:dark:bg-neutral-700 duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
className={`hover:bg-slate-500 duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faCircleQuestion as any}
|
icon={faCircleQuestion as any}
|
||||||
@@ -162,7 +162,7 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
|
|
||||||
<Link href="https://github.com/linkwarden/linkwarden" target="_blank">
|
<Link href="https://github.com/linkwarden/linkwarden" target="_blank">
|
||||||
<div
|
<div
|
||||||
className={`hover:bg-slate-200 hover:dark:bg-neutral-700 duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
className={`hover:bg-slate-500 duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faGithub as any}
|
icon={faGithub as any}
|
||||||
@@ -177,7 +177,7 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
|
|
||||||
<Link href="https://twitter.com/LinkwardenHQ" target="_blank">
|
<Link href="https://twitter.com/LinkwardenHQ" target="_blank">
|
||||||
<div
|
<div
|
||||||
className={`hover:bg-slate-200 hover:dark:bg-neutral-700 duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
className={`hover:bg-slate-500 duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faXTwitter as any}
|
icon={faXTwitter as any}
|
||||||
@@ -192,7 +192,7 @@ export default function SettingsSidebar({ className }: { className?: string }) {
|
|||||||
|
|
||||||
<Link href="https://fosstodon.org/@linkwarden" target="_blank">
|
<Link href="https://fosstodon.org/@linkwarden" target="_blank">
|
||||||
<div
|
<div
|
||||||
className={`hover:bg-slate-200 hover:dark:bg-neutral-700 duration-100 py-2 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
className={`hover:bg-slate-500 duration-100 py-2 px-2 hover:bg-opacity-20 bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faMastodon as any}
|
icon={faMastodon as any}
|
||||||
|
|||||||
+65
-54
@@ -7,6 +7,7 @@ import {
|
|||||||
faChevronDown,
|
faChevronDown,
|
||||||
faLink,
|
faLink,
|
||||||
faGlobe,
|
faGlobe,
|
||||||
|
faThumbTack,
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import useTagStore from "@/store/tags";
|
import useTagStore from "@/store/tags";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
@@ -55,59 +56,69 @@ export default function Sidebar({ className }: { className?: string }) {
|
|||||||
className || ""
|
className || ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="flex justify-center gap-2 mt-2">
|
<div className="flex flex-col gap-2 mt-2">
|
||||||
<Link
|
<Link href={`/dashboard`}>
|
||||||
href="/dashboard"
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === "/dashboard"
|
active === `/dashboard` ? "bg-sky-500" : "hover:bg-slate-500"
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
} duration-100 py-5 px-2 bg-opacity-20 hover:bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8 capitalize`}
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
>
|
||||||
} outline-sky-100 outline-1 duration-100 py-1 px-2 rounded-md cursor-pointer flex justify-center flex-col items-center gap-1 w-full`}
|
<FontAwesomeIcon
|
||||||
>
|
icon={faChartSimple}
|
||||||
<FontAwesomeIcon
|
className="w-7 h-7 drop-shadow text-sky-500 dark:text-sky-500"
|
||||||
icon={faChartSimple}
|
/>
|
||||||
className={`w-8 h-8 drop-shadow text-sky-500 dark:text-sky-500`}
|
<p className="text-black dark:text-white truncate w-full">
|
||||||
/>
|
Dashboard
|
||||||
|
</p>
|
||||||
<p className="text-black dark:text-white text-xs xl:text-sm font-semibold">
|
</div>
|
||||||
Dashboard
|
|
||||||
</p>
|
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<Link
|
<Link href={`/links`}>
|
||||||
href="/links"
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === "/links"
|
active === `/links` ? "bg-sky-500" : "hover:bg-slate-500"
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
} duration-100 py-5 px-2 bg-opacity-20 hover:bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8 capitalize`}
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
>
|
||||||
} outline-sky-100 outline-1 duration-100 py-1 px-2 rounded-md cursor-pointer flex justify-center flex-col items-center gap-1 w-full`}
|
<FontAwesomeIcon
|
||||||
>
|
icon={faLink}
|
||||||
<FontAwesomeIcon
|
className="w-7 h-7 drop-shadow text-sky-500 dark:text-sky-500"
|
||||||
icon={faLink}
|
/>
|
||||||
className={`w-8 h-8 drop-shadow text-sky-500 dark:text-sky-500`}
|
<p className="text-black dark:text-white truncate w-full">
|
||||||
/>
|
All Links
|
||||||
|
</p>
|
||||||
<p className="text-black dark:text-white text-xs xl:text-sm font-semibold">
|
</div>
|
||||||
Links
|
|
||||||
</p>
|
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<Link
|
<Link href={`/collections`}>
|
||||||
href="/collections"
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === "/collections"
|
active === `/collections` ? "bg-sky-500" : "hover:bg-slate-500"
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
} duration-100 py-5 px-2 bg-opacity-20 hover:bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8 capitalize`}
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
>
|
||||||
} outline-sky-100 outline-1 duration-100 py-1 px-2 rounded-md cursor-pointer flex justify-center flex-col items-center gap-1 w-full`}
|
<FontAwesomeIcon
|
||||||
>
|
icon={faFolder}
|
||||||
<FontAwesomeIcon
|
className="w-7 h-7 drop-shadow text-sky-500 dark:text-sky-500"
|
||||||
icon={faFolder}
|
/>
|
||||||
className={`w-8 h-8 drop-shadow text-sky-500 dark:text-sky-500`}
|
<p className="text-black dark:text-white truncate w-full">
|
||||||
/>
|
All Collections
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
|
||||||
<p className="text-black dark:text-white text-xs xl:text-sm font-semibold">
|
<Link href={`/links/pinned`}>
|
||||||
Collections
|
<div
|
||||||
</p>
|
className={`${
|
||||||
|
active === `/links/pinned` ? "bg-sky-500" : "hover:bg-slate-500"
|
||||||
|
} duration-100 py-5 px-2 bg-opacity-20 hover:bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8 capitalize`}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={faThumbTack}
|
||||||
|
className="w-7 h-7 drop-shadow text-sky-500 dark:text-sky-500"
|
||||||
|
/>
|
||||||
|
<p className="text-black dark:text-white truncate w-full">
|
||||||
|
Pinned Links
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -145,9 +156,9 @@ export default function Sidebar({ className }: { className?: string }) {
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === `/collections/${e.id}`
|
active === `/collections/${e.id}`
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
? "bg-sky-500"
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
: "hover:bg-slate-500"
|
||||||
} duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8 capitalize`}
|
} duration-100 py-1 px-2 bg-opacity-20 hover:bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8 capitalize`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faFolder}
|
icon={faFolder}
|
||||||
@@ -212,9 +223,9 @@ export default function Sidebar({ className }: { className?: string }) {
|
|||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === `/tags/${e.id}`
|
active === `/tags/${e.id}`
|
||||||
? "bg-sky-200 dark:bg-sky-800"
|
? "bg-sky-500"
|
||||||
: "hover:bg-slate-200 hover:dark:bg-neutral-700"
|
: "hover:bg-slate-500"
|
||||||
} duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
} duration-100 py-1 px-2 bg-opacity-20 hover:bg-opacity-20 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faHashtag}
|
icon={faHashtag}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default function CenteredForm({ text, children }: Props) {
|
|||||||
<div className="m-auto flex flex-col gap-2 w-full">
|
<div className="m-auto flex flex-col gap-2 w-full">
|
||||||
{theme ? (
|
{theme ? (
|
||||||
<Image
|
<Image
|
||||||
src={`/linkwarden_${theme === "dark" ? "dark" : "li"}.png`}
|
src={`/linkwarden_${theme === "dark" ? "dark" : "light"}.png`}
|
||||||
width={640}
|
width={640}
|
||||||
height={136}
|
height={136}
|
||||||
alt="Linkwarden"
|
alt="Linkwarden"
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ export default async function getDashboardData(
|
|||||||
else if (query.sort === Sort.DescriptionZA) order = { description: "desc" };
|
else if (query.sort === Sort.DescriptionZA) order = { description: "desc" };
|
||||||
|
|
||||||
const pinnedLinks = await prisma.link.findMany({
|
const pinnedLinks = await prisma.link.findMany({
|
||||||
take: Number(process.env.PAGINATION_TAKE_COUNT) || 20,
|
take: 6,
|
||||||
skip: query.cursor ? 1 : undefined,
|
|
||||||
cursor: query.cursor ? { id: query.cursor } : undefined,
|
|
||||||
where: {
|
where: {
|
||||||
AND: [
|
AND: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ export default async function updateUserById(
|
|||||||
archiveAsScreenshot: data.archiveAsScreenshot,
|
archiveAsScreenshot: data.archiveAsScreenshot,
|
||||||
archiveAsPDF: data.archiveAsPDF,
|
archiveAsPDF: data.archiveAsPDF,
|
||||||
archiveAsWaybackMachine: data.archiveAsWaybackMachine,
|
archiveAsWaybackMachine: data.archiveAsWaybackMachine,
|
||||||
|
displayLinkIcons: data.displayLinkIcons,
|
||||||
blurredFavicons: data.blurredFavicons,
|
blurredFavicons: data.blurredFavicons,
|
||||||
password:
|
password:
|
||||||
data.newPassword && data.newPassword !== ""
|
data.newPassword && data.newPassword !== ""
|
||||||
|
|||||||
+25
-46
@@ -1,7 +1,6 @@
|
|||||||
import useCollectionStore from "@/store/collections";
|
import useCollectionStore from "@/store/collections";
|
||||||
import {
|
import {
|
||||||
faChartSimple,
|
faChartSimple,
|
||||||
faChevronDown,
|
|
||||||
faChevronRight,
|
faChevronRight,
|
||||||
faClockRotateLeft,
|
faClockRotateLeft,
|
||||||
faFileImport,
|
faFileImport,
|
||||||
@@ -36,14 +35,7 @@ export default function Dashboard() {
|
|||||||
|
|
||||||
const [numberOfLinks, setNumberOfLinks] = useState(0);
|
const [numberOfLinks, setNumberOfLinks] = useState(0);
|
||||||
|
|
||||||
const [showRecents, setShowRecents] = useState(3);
|
const [showLinks, setShowLinks] = useState(3);
|
||||||
|
|
||||||
const [linkPinDisclosure, setLinkPinDisclosure] = useState<boolean>(() => {
|
|
||||||
const storedValue =
|
|
||||||
typeof window !== "undefined" &&
|
|
||||||
localStorage.getItem("linkPinDisclosure");
|
|
||||||
return storedValue ? storedValue === "true" : true;
|
|
||||||
});
|
|
||||||
|
|
||||||
useLinks({ pinnedOnly: true, sort: 0 });
|
useLinks({ pinnedOnly: true, sort: 0 });
|
||||||
|
|
||||||
@@ -57,25 +49,18 @@ export default function Dashboard() {
|
|||||||
);
|
);
|
||||||
}, [collections]);
|
}, [collections]);
|
||||||
|
|
||||||
useEffect(() => {
|
const handleNumberOfLinksToShow = () => {
|
||||||
localStorage.setItem(
|
if (window.innerWidth > 1535) {
|
||||||
"linkPinDisclosure",
|
setShowLinks(6);
|
||||||
linkPinDisclosure ? "true" : "false"
|
|
||||||
);
|
|
||||||
}, [linkPinDisclosure]);
|
|
||||||
|
|
||||||
const handleNumberOfRecents = () => {
|
|
||||||
if (window.innerWidth > 1550) {
|
|
||||||
setShowRecents(6);
|
|
||||||
} else if (window.innerWidth > 1295) {
|
} else if (window.innerWidth > 1295) {
|
||||||
setShowRecents(4);
|
setShowLinks(4);
|
||||||
} else setShowRecents(3);
|
} else setShowLinks(3);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { width } = useWindowDimensions();
|
const { width } = useWindowDimensions();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleNumberOfRecents();
|
handleNumberOfLinksToShow();
|
||||||
}, [width]);
|
}, [width]);
|
||||||
|
|
||||||
const [importDropdown, setImportDropdown] = useState(false);
|
const [importDropdown, setImportDropdown] = useState(false);
|
||||||
@@ -139,7 +124,7 @@ export default function Dashboard() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div className="flex justify-between flex-col md:flex-row md:items-center gap-2 md:w-full h-full rounded-2xl p-8 border border-sky-100 dark:border-neutral-700 bg-gray-100 dark:bg-neutral-800">
|
<div className="flex justify-evenly flex-col md:flex-row md:items-center gap-2 md:w-full h-full rounded-2xl p-8 border border-sky-100 dark:border-neutral-700 bg-gray-100 dark:bg-neutral-800">
|
||||||
<DashboardItem
|
<DashboardItem
|
||||||
name={numberOfLinks === 1 ? "Link" : "Links"}
|
name={numberOfLinks === 1 ? "Link" : "Links"}
|
||||||
value={numberOfLinks}
|
value={numberOfLinks}
|
||||||
@@ -147,7 +132,7 @@ export default function Dashboard() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<hr className="border-sky-100 dark:border-neutral-700 md:hidden my-5" />
|
<hr className="border-sky-100 dark:border-neutral-700 md:hidden my-5" />
|
||||||
<div className="h-full border-1 border-l border-sky-100 dark:border-neutral-700 hidden md:block"></div>
|
<div className="h-24 border-1 border-l border-sky-100 dark:border-neutral-700 hidden md:block"></div>
|
||||||
|
|
||||||
<DashboardItem
|
<DashboardItem
|
||||||
name={collections.length === 1 ? "Collection" : "Collections"}
|
name={collections.length === 1 ? "Collection" : "Collections"}
|
||||||
@@ -156,7 +141,7 @@ export default function Dashboard() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<hr className="border-sky-100 dark:border-neutral-700 md:hidden my-5" />
|
<hr className="border-sky-100 dark:border-neutral-700 md:hidden my-5" />
|
||||||
<div className="h-full border-1 border-r border-sky-100 dark:border-neutral-700 hidden md:block"></div>
|
<div className="h-24 border-1 border-r border-sky-100 dark:border-neutral-700 hidden md:block"></div>
|
||||||
|
|
||||||
<DashboardItem
|
<DashboardItem
|
||||||
name={tags.length === 1 ? "Tag" : "Tags"}
|
name={tags.length === 1 ? "Tag" : "Tags"}
|
||||||
@@ -197,7 +182,7 @@ export default function Dashboard() {
|
|||||||
<div
|
<div
|
||||||
className={`grid overflow-hidden 2xl:grid-cols-3 xl:grid-cols-2 grid-cols-1 gap-5 w-full`}
|
className={`grid overflow-hidden 2xl:grid-cols-3 xl:grid-cols-2 grid-cols-1 gap-5 w-full`}
|
||||||
>
|
>
|
||||||
{links.slice(0, showRecents).map((e, i) => (
|
{links.slice(0, showLinks).map((e, i) => (
|
||||||
<LinkCard key={i} link={e} count={i} />
|
<LinkCard key={i} link={e} count={i} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -314,20 +299,16 @@ export default function Dashboard() {
|
|||||||
/>
|
/>
|
||||||
<p className="text-2xl text-black dark:text-white">Pinned Links</p>
|
<p className="text-2xl text-black dark:text-white">Pinned Links</p>
|
||||||
</div>
|
</div>
|
||||||
{links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
|
<Link
|
||||||
<button
|
href="/links/pinned"
|
||||||
className="text-black dark:text-white flex items-center gap-2 cursor-pointer"
|
className="text-black dark:text-white flex items-center gap-2 cursor-pointer"
|
||||||
onClick={() => setLinkPinDisclosure(!linkPinDisclosure)}
|
>
|
||||||
>
|
View All
|
||||||
{linkPinDisclosure ? "Show Less" : "Show More"}
|
<FontAwesomeIcon
|
||||||
<FontAwesomeIcon
|
icon={faChevronRight}
|
||||||
icon={faChevronDown}
|
className={`w-4 h-4 text-black dark:text-white`}
|
||||||
className={`w-4 h-4 text-black dark:text-white ${
|
/>
|
||||||
linkPinDisclosure ? "rotate-reverse" : "rotate"
|
</Link>
|
||||||
}`}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
) : undefined}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -337,15 +318,13 @@ export default function Dashboard() {
|
|||||||
{links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
|
{links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div
|
<div
|
||||||
className={`grid overflow-hidden 2xl:grid-cols-3 xl:grid-cols-2 grid-cols-1 gap-5 w-full ${
|
className={`grid overflow-hidden 2xl:grid-cols-3 xl:grid-cols-2 grid-cols-1 gap-5 w-full`}
|
||||||
linkPinDisclosure ? "h-full" : "max-h-[22rem]"
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
{links
|
{links
|
||||||
|
|
||||||
.filter((e) => e.pinnedBy && e.pinnedBy[0])
|
.filter((e) => e.pinnedBy && e.pinnedBy[0])
|
||||||
.map((e, i) => (
|
.map((e, i) => <LinkCard key={i} link={e} count={i} />)
|
||||||
<LinkCard key={i} link={e} count={i} />
|
.slice(0, showLinks)}
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
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>(Sort.DateNewestFirst);
|
||||||
|
|
||||||
|
useLinks({ sort: sortBy, pinnedOnly: true });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MainLayout>
|
||||||
|
<div className="p-5 flex flex-col gap-5 w-full h-full">
|
||||||
|
<div className="flex gap-3 justify-between">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={faThumbTack}
|
||||||
|
className="sm:w-10 sm:h-10 w-6 h-6 text-sky-500 dark:text-sky-500 drop-shadow"
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<p className="text-3xl capitalize text-black dark:text-white font-thin">
|
||||||
|
Pinned Links
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p className="text-black dark:text-white">
|
||||||
|
Pinned Links from your Collections
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="relative mt-2">
|
||||||
|
<div
|
||||||
|
onClick={() => 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"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={faSort}
|
||||||
|
id="sort-dropdown"
|
||||||
|
className="w-5 h-5 text-gray-500 dark:text-gray-300"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{sortDropdown ? (
|
||||||
|
<SortDropdown
|
||||||
|
sortBy={sortBy}
|
||||||
|
setSort={setSortBy}
|
||||||
|
toggleSortDropdown={() => setSortDropdown(!sortDropdown)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
|
||||||
|
<div className="grid 2xl:grid-cols-3 xl:grid-cols-2 grid-cols-1 gap-5">
|
||||||
|
{links.map((e, i) => {
|
||||||
|
return <LinkCard key={i} link={e} count={i} />;
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
style={{ flex: "1 1 auto" }}
|
||||||
|
className="sky-shadow flex flex-col justify-center h-full border border-solid border-sky-100 dark:border-neutral-700 w-full mx-auto p-10 rounded-2xl bg-gray-50 dark:bg-neutral-800"
|
||||||
|
>
|
||||||
|
<p className="text-center text-2xl text-black dark:text-white">
|
||||||
|
Pin Your Favorite Links Here!
|
||||||
|
</p>
|
||||||
|
<p className="text-center mx-auto max-w-96 w-fit text-gray-500 dark:text-gray-300 text-sm mt-2">
|
||||||
|
You can Pin your favorite Links by clicking on the three dots on
|
||||||
|
each Link and clicking{" "}
|
||||||
|
<span className="font-semibold">Pin to Dashboard</span>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</MainLayout>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -334,7 +334,7 @@ export default function Account() {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
{user.isPrivate && (
|
{user.isPrivate && (
|
||||||
<div>
|
<div className="pl-5">
|
||||||
<p className="text-black dark:text-white mt-2">
|
<p className="text-black dark:text-white mt-2">
|
||||||
Whitelisted Users
|
Whitelisted Users
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import ProfilePhoto from "@/components/ProfilePhoto";
|
|||||||
import SubmitButton from "@/components/SubmitButton";
|
import SubmitButton from "@/components/SubmitButton";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import Checkbox from "@/components/Checkbox";
|
import Checkbox from "@/components/Checkbox";
|
||||||
|
import LinkPreview from "@/components/LinkPreview";
|
||||||
|
|
||||||
export default function Appearance() {
|
export default function Appearance() {
|
||||||
const { theme, setTheme } = useTheme();
|
const { theme, setTheme } = useTheme();
|
||||||
@@ -67,7 +68,7 @@ export default function Appearance() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingsLayout>
|
<SettingsLayout>
|
||||||
<div className="flex flex-col gap-3">
|
<div className="flex flex-col gap-10">
|
||||||
<div>
|
<div>
|
||||||
<p className="mb-3">Select Theme</p>
|
<p className="mb-3">Select Theme</p>
|
||||||
<div className="flex gap-3 w-full">
|
<div className="flex gap-3 w-full">
|
||||||
@@ -100,13 +101,37 @@ export default function Appearance() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
<div className="flex items-center gap-2 w-full rounded-md h-8">
|
||||||
|
<p className="text-black dark:text-white truncate w-full pr-7 text-3xl font-thin">
|
||||||
|
Link Card
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<hr className="my-3 border-1 border-sky-100 dark:border-neutral-700" />
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label="Blurred Link Icons"
|
label="Display Icons"
|
||||||
state={user.blurredFavicons}
|
state={user.displayLinkIcons}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setUser({ ...user, blurredFavicons: !user.blurredFavicons })
|
setUser({ ...user, displayLinkIcons: !user.displayLinkIcons })
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
{user.displayLinkIcons ? (
|
||||||
|
<Checkbox
|
||||||
|
label="Blurred"
|
||||||
|
className="pl-5 mt-1"
|
||||||
|
state={user.blurredFavicons}
|
||||||
|
onClick={() =>
|
||||||
|
setUser({ ...user, blurredFavicons: !user.blurredFavicons })
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
) : undefined}
|
||||||
|
<p className="my-3">Preview:</p>
|
||||||
|
|
||||||
|
<LinkPreview
|
||||||
|
settings={{
|
||||||
|
blurredFavicons: user.blurredFavicons,
|
||||||
|
displayLinkIcons: user.displayLinkIcons,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<SubmitButton
|
<SubmitButton
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export default function Archive() {
|
|||||||
state={archiveAsScreenshot}
|
state={archiveAsScreenshot}
|
||||||
onClick={() => setArchiveAsScreenshot(!archiveAsScreenshot)}
|
onClick={() => setArchiveAsScreenshot(!archiveAsScreenshot)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label="PDF"
|
label="PDF"
|
||||||
state={archiveAsPDF}
|
state={archiveAsPDF}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "User" ADD COLUMN "displayLinkIcons" BOOLEAN NOT NULL DEFAULT true;
|
||||||
@@ -33,6 +33,7 @@ model User {
|
|||||||
|
|
||||||
isPrivate Boolean @default(false)
|
isPrivate Boolean @default(false)
|
||||||
|
|
||||||
|
displayLinkIcons Boolean @default(true)
|
||||||
blurredFavicons Boolean @default(true)
|
blurredFavicons Boolean @default(true)
|
||||||
|
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
|||||||
Reference in New Issue
Block a user