2023-11-11 13:57:46 -06:00
|
|
|
import SortDropdown from "@/components/SortDropdown";
|
|
|
|
import useLinks from "@/hooks/useLinks";
|
|
|
|
import MainLayout from "@/layouts/MainLayout";
|
|
|
|
import useLinkStore from "@/store/links";
|
2023-12-16 09:33:33 -06:00
|
|
|
import React, { useState } from "react";
|
|
|
|
import PageHeader from "@/components/PageHeader";
|
2023-12-17 00:25:46 -06:00
|
|
|
import { Sort, ViewMode } from "@/types/global";
|
|
|
|
import ViewDropdown from "@/components/ViewDropdown";
|
|
|
|
import DefaultView from "@/components/LinkViews/DefaultView";
|
|
|
|
import ListView from "@/components/LinkViews/ListView";
|
2023-11-11 13:57:46 -06:00
|
|
|
|
|
|
|
export default function PinnedLinks() {
|
|
|
|
const { links } = useLinkStore();
|
|
|
|
|
2023-12-17 00:25:46 -06:00
|
|
|
const [viewMode, setViewMode] = useState<string>(
|
|
|
|
localStorage.getItem("viewMode") || ViewMode.Default
|
|
|
|
);
|
2023-11-11 13:57:46 -06:00
|
|
|
const [sortBy, setSortBy] = useState<Sort>(Sort.DateNewestFirst);
|
|
|
|
|
|
|
|
useLinks({ sort: sortBy, pinnedOnly: true });
|
|
|
|
|
2023-12-17 00:25:46 -06:00
|
|
|
const linkView = {
|
|
|
|
[ViewMode.Default]: DefaultView,
|
|
|
|
// [ViewMode.Grid]: GridView,
|
|
|
|
[ViewMode.List]: ListView,
|
|
|
|
};
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
const LinkComponent = linkView[viewMode];
|
|
|
|
|
2023-11-11 13:57:46 -06:00
|
|
|
return (
|
|
|
|
<MainLayout>
|
|
|
|
<div className="p-5 flex flex-col gap-5 w-full h-full">
|
2023-12-16 09:33:33 -06:00
|
|
|
<PageHeader
|
|
|
|
icon={"bi-pin-angle"}
|
|
|
|
title={"Pinned Links"}
|
|
|
|
description={"Pinned Links from your Collections"}
|
|
|
|
/>
|
2023-12-17 02:47:32 -06:00
|
|
|
<div className="mt-2 flex items-center justify-end gap-2">
|
|
|
|
<SortDropdown sortBy={sortBy} setSort={setSortBy}/>
|
|
|
|
<ViewDropdown viewMode={viewMode} setViewMode={setViewMode}/>
|
2023-11-11 13:57:46 -06:00
|
|
|
</div>
|
2023-12-17 02:47:32 -06:00
|
|
|
|
2023-11-11 15:06:50 -06:00
|
|
|
{links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
|
2023-12-17 01:35:09 -06:00
|
|
|
<LinkComponent links={links}/>
|
2023-11-11 13:57:46 -06:00
|
|
|
) : (
|
2023-11-11 15:06:50 -06:00
|
|
|
<div
|
|
|
|
style={{ flex: "1 1 auto" }}
|
2023-11-25 04:54:43 -06:00
|
|
|
className="sky-shadow flex flex-col justify-center h-full border border-solid border-neutral-content w-full mx-auto p-10 rounded-2xl bg-base-200"
|
2023-11-11 15:06:50 -06:00
|
|
|
>
|
2023-11-24 07:39:55 -06:00
|
|
|
<p className="text-center text-2xl">
|
2023-11-11 15:06:50 -06:00
|
|
|
Pin Your Favorite Links Here!
|
|
|
|
</p>
|
2023-11-25 04:39:56 -06:00
|
|
|
<p className="text-center mx-auto max-w-96 w-fit text-neutral text-sm mt-2">
|
2023-11-11 15:06:50 -06:00
|
|
|
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>
|
2023-11-11 13:57:46 -06:00
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</MainLayout>
|
|
|
|
);
|
|
|
|
}
|