2023-12-16 09:11:35 -06:00
|
|
|
import MainLayout from "@/layouts/MainLayout";
|
2024-11-09 22:07:01 -06:00
|
|
|
import { useEffect, useMemo, useState } from "react";
|
2023-10-23 09:45:48 -05:00
|
|
|
import Link from "next/link";
|
|
|
|
import React from "react";
|
|
|
|
import { toast } from "react-hot-toast";
|
2023-12-24 05:46:08 -06:00
|
|
|
import { MigrationFormat, MigrationRequest, ViewMode } from "@/types/global";
|
2023-11-09 10:44:49 -06:00
|
|
|
import DashboardItem from "@/components/DashboardItem";
|
2023-12-01 16:44:34 -06:00
|
|
|
import NewLinkModal from "@/components/ModalContent/NewLinkModal";
|
2023-12-16 09:15:56 -06:00
|
|
|
import PageHeader from "@/components/PageHeader";
|
2023-12-24 05:46:08 -06:00
|
|
|
import ViewDropdown from "@/components/ViewDropdown";
|
2024-01-14 09:09:09 -06:00
|
|
|
import { dropdownTriggerer } from "@/lib/client/utils";
|
2024-06-04 15:59:49 -05:00
|
|
|
import getServerSideProps from "@/lib/client/getServerSideProps";
|
|
|
|
import { useTranslation } from "next-i18next";
|
2024-07-30 13:57:09 -05:00
|
|
|
import { useCollections } from "@/hooks/store/collections";
|
2024-08-01 16:23:51 -05:00
|
|
|
import { useTags } from "@/hooks/store/tags";
|
2024-08-12 23:08:57 -05:00
|
|
|
import { useDashboardData } from "@/hooks/store/dashboardData";
|
|
|
|
import Links from "@/components/LinkViews/Links";
|
2024-09-09 23:09:33 -05:00
|
|
|
import useLocalSettingsStore from "@/store/localSettings";
|
2024-11-07 10:09:36 -06:00
|
|
|
import { useUpdateUser, useUser } from "@/hooks/store/user";
|
|
|
|
import SurveyModal from "@/components/ModalContent/SurveyModal";
|
2023-05-14 10:41:08 -05:00
|
|
|
|
2023-06-09 17:31:14 -05:00
|
|
|
export default function Dashboard() {
|
2024-06-04 15:59:49 -05:00
|
|
|
const { t } = useTranslation();
|
2024-08-12 23:08:57 -05:00
|
|
|
const { data: collections = [] } = useCollections();
|
2024-09-11 00:38:38 -05:00
|
|
|
const {
|
|
|
|
data: { links = [], numberOfPinnedLinks } = { links: [] },
|
|
|
|
...dashboardData
|
|
|
|
} = useDashboardData();
|
2024-08-12 23:08:57 -05:00
|
|
|
const { data: tags = [] } = useTags();
|
2024-11-07 10:09:36 -06:00
|
|
|
const { data: account = [] } = useUser();
|
2023-05-14 10:41:08 -05:00
|
|
|
|
2023-06-16 08:02:02 -05:00
|
|
|
const [numberOfLinks, setNumberOfLinks] = useState(0);
|
|
|
|
|
2024-09-09 23:09:33 -05:00
|
|
|
const { settings } = useLocalSettingsStore();
|
|
|
|
|
2023-06-16 08:02:02 -05:00
|
|
|
useEffect(() => {
|
|
|
|
setNumberOfLinks(
|
|
|
|
collections.reduce(
|
2023-06-20 09:39:03 -05:00
|
|
|
(accumulator, collection) =>
|
|
|
|
accumulator + (collection._count as any).links,
|
2023-12-17 22:32:33 -06:00
|
|
|
0
|
|
|
|
)
|
2023-06-16 08:02:02 -05:00
|
|
|
);
|
|
|
|
}, [collections]);
|
|
|
|
|
2024-11-07 10:09:36 -06:00
|
|
|
useEffect(() => {
|
|
|
|
if (
|
|
|
|
process.env.NEXT_PUBLIC_STRIPE === "true" &&
|
2024-11-07 15:46:26 -06:00
|
|
|
account &&
|
2024-11-07 10:09:36 -06:00
|
|
|
account.id &&
|
|
|
|
account.referredBy === null &&
|
|
|
|
// if user is using Linkwarden for more than 3 days
|
|
|
|
new Date().getTime() - new Date(account.createdAt).getTime() >
|
|
|
|
3 * 24 * 60 * 60 * 1000
|
|
|
|
) {
|
2024-11-09 23:27:13 -06:00
|
|
|
setTimeout(() => {
|
|
|
|
setShowsSurveyModal(true);
|
|
|
|
}, 1000);
|
2024-11-07 10:09:36 -06:00
|
|
|
}
|
|
|
|
}, [account]);
|
|
|
|
|
2024-09-11 00:38:38 -05:00
|
|
|
const numberOfLinksToShow = useMemo(() => {
|
2023-12-24 05:46:08 -06:00
|
|
|
if (window.innerWidth > 1900) {
|
2024-09-11 00:38:38 -05:00
|
|
|
return 10;
|
2024-05-24 18:13:04 -05:00
|
|
|
} else if (window.innerWidth > 1500) {
|
2024-09-11 00:38:38 -05:00
|
|
|
return 8;
|
2024-05-24 18:13:04 -05:00
|
|
|
} else if (window.innerWidth > 880) {
|
2024-09-11 00:38:38 -05:00
|
|
|
return 6;
|
2024-05-24 18:13:04 -05:00
|
|
|
} else if (window.innerWidth > 550) {
|
2024-09-11 00:38:38 -05:00
|
|
|
return 4;
|
|
|
|
} else {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}, []);
|
2023-10-23 09:45:48 -05:00
|
|
|
|
2024-07-27 17:41:13 -05:00
|
|
|
const importBookmarks = async (
|
|
|
|
e: React.ChangeEvent<HTMLInputElement>,
|
|
|
|
format: MigrationFormat
|
|
|
|
) => {
|
2024-07-27 16:17:38 -05:00
|
|
|
const file: File | null = e.target.files && e.target.files[0];
|
2023-10-23 09:45:48 -05:00
|
|
|
|
|
|
|
if (file) {
|
2024-07-27 16:17:38 -05:00
|
|
|
const reader = new FileReader();
|
2023-10-23 09:45:48 -05:00
|
|
|
reader.readAsText(file, "UTF-8");
|
|
|
|
reader.onload = async function (e) {
|
|
|
|
const load = toast.loading("Importing...");
|
|
|
|
|
|
|
|
const request: string = e.target?.result as string;
|
|
|
|
|
|
|
|
const body: MigrationRequest = {
|
|
|
|
format,
|
|
|
|
data: request,
|
|
|
|
};
|
|
|
|
|
2024-11-09 22:07:01 -06:00
|
|
|
try {
|
|
|
|
const response = await fetch("/api/v1/migration", {
|
|
|
|
method: "POST",
|
|
|
|
body: JSON.stringify(body),
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
const errorData = await response.json();
|
|
|
|
toast.dismiss(load);
|
|
|
|
|
|
|
|
toast.error(
|
|
|
|
errorData.response ||
|
|
|
|
"Failed to import bookmarks. Please try again."
|
|
|
|
);
|
|
|
|
return;
|
|
|
|
}
|
2023-10-23 09:45:48 -05:00
|
|
|
|
2024-11-09 22:07:01 -06:00
|
|
|
await response.json();
|
|
|
|
toast.dismiss(load);
|
|
|
|
toast.success("Imported the Bookmarks! Reloading the page...");
|
2023-10-23 09:45:48 -05:00
|
|
|
|
2024-11-09 22:07:01 -06:00
|
|
|
setTimeout(() => {
|
|
|
|
location.reload();
|
|
|
|
}, 2000);
|
|
|
|
} catch (error) {
|
|
|
|
console.error("Request failed", error);
|
|
|
|
toast.dismiss(load);
|
|
|
|
toast.error(
|
|
|
|
"An error occurred while importing bookmarks. Please check the logs for more info."
|
|
|
|
);
|
|
|
|
}
|
2023-10-23 09:45:48 -05:00
|
|
|
};
|
2024-11-09 22:07:01 -06:00
|
|
|
|
2023-10-23 09:45:48 -05:00
|
|
|
reader.onerror = function (e) {
|
2024-11-09 22:07:01 -06:00
|
|
|
console.log("Error reading file:", e);
|
|
|
|
toast.error(
|
|
|
|
"Failed to read the file. Please make sure the file is correct and try again."
|
|
|
|
);
|
2023-10-23 09:45:48 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-12-01 15:29:17 -06:00
|
|
|
const [newLinkModal, setNewLinkModal] = useState(false);
|
|
|
|
|
2024-08-12 23:08:57 -05:00
|
|
|
const [viewMode, setViewMode] = useState<ViewMode>(
|
|
|
|
(localStorage.getItem("viewMode") as ViewMode) || ViewMode.Card
|
2023-12-24 05:46:08 -06:00
|
|
|
);
|
|
|
|
|
2024-11-07 10:09:36 -06:00
|
|
|
const [showSurveyModal, setShowsSurveyModal] = useState(false);
|
|
|
|
|
|
|
|
const { data: user } = useUser();
|
|
|
|
const updateUser = useUpdateUser();
|
|
|
|
|
|
|
|
const [submitLoader, setSubmitLoader] = useState(false);
|
|
|
|
|
|
|
|
const submitSurvey = async (referer: string, other?: string) => {
|
|
|
|
if (submitLoader) return;
|
|
|
|
|
|
|
|
setSubmitLoader(true);
|
|
|
|
|
|
|
|
const load = toast.loading(t("applying"));
|
|
|
|
|
|
|
|
await updateUser.mutateAsync(
|
|
|
|
{
|
|
|
|
...user,
|
|
|
|
referredBy: referer === "other" ? "Other: " + other : referer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
onSettled: (data, error) => {
|
|
|
|
console.log(data, error);
|
|
|
|
setSubmitLoader(false);
|
|
|
|
toast.dismiss(load);
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
toast.error(error.message);
|
|
|
|
} else {
|
|
|
|
toast.success(t("thanks_for_feedback"));
|
|
|
|
setShowsSurveyModal(false);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-05-14 10:41:08 -05:00
|
|
|
return (
|
|
|
|
<MainLayout>
|
2023-09-01 17:04:11 -05:00
|
|
|
<div style={{ flex: "1 1 auto" }} className="p-5 flex flex-col gap-5">
|
2023-12-24 05:46:08 -06:00
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
<PageHeader
|
|
|
|
icon={"bi-house "}
|
|
|
|
title={"Dashboard"}
|
2024-06-04 15:59:49 -05:00
|
|
|
description={t("dashboard_desc")}
|
2023-12-24 05:46:08 -06:00
|
|
|
/>
|
|
|
|
<ViewDropdown viewMode={viewMode} setViewMode={setViewMode} />
|
|
|
|
</div>
|
|
|
|
|
2024-11-07 01:09:56 -06:00
|
|
|
<div className="xl:flex flex flex-col sm:grid grid-cols-2 gap-3 xl:flex-row xl:justify-evenly xl:w-full h-full">
|
2024-09-11 00:38:38 -05:00
|
|
|
<DashboardItem
|
|
|
|
name={numberOfLinks === 1 ? t("link") : t("links")}
|
|
|
|
value={numberOfLinks}
|
|
|
|
icon={"bi-link-45deg"}
|
|
|
|
/>
|
2024-05-24 16:12:47 -05:00
|
|
|
|
2024-09-11 00:38:38 -05:00
|
|
|
<DashboardItem
|
|
|
|
name={collections.length === 1 ? t("collection") : t("collections")}
|
|
|
|
value={collections.length}
|
|
|
|
icon={"bi-folder"}
|
|
|
|
/>
|
2024-05-24 16:12:47 -05:00
|
|
|
|
2024-09-11 00:38:38 -05:00
|
|
|
<DashboardItem
|
|
|
|
name={tags.length === 1 ? t("tag") : t("tags")}
|
|
|
|
value={tags.length}
|
|
|
|
icon={"bi-hash"}
|
|
|
|
/>
|
2024-05-24 16:12:47 -05:00
|
|
|
|
2024-09-11 00:38:38 -05:00
|
|
|
<DashboardItem
|
|
|
|
name={t("pinned")}
|
|
|
|
value={numberOfPinnedLinks}
|
|
|
|
icon={"bi-pin-angle"}
|
|
|
|
/>
|
2023-05-14 10:41:08 -05:00
|
|
|
</div>
|
|
|
|
|
2023-10-23 09:45:48 -05:00
|
|
|
<div className="flex justify-between items-center">
|
|
|
|
<div className="flex gap-2 items-center">
|
2023-12-19 10:50:43 -06:00
|
|
|
<PageHeader
|
|
|
|
icon={"bi-clock-history"}
|
2024-06-04 15:59:49 -05:00
|
|
|
title={t("recent")}
|
|
|
|
description={t("recent_links_desc")}
|
2023-12-19 10:50:43 -06:00
|
|
|
/>
|
2023-10-23 09:45:48 -05:00
|
|
|
</div>
|
|
|
|
<Link
|
|
|
|
href="/links"
|
2023-12-16 09:11:35 -06:00
|
|
|
className="flex items-center text-sm text-black/75 dark:text-white/75 gap-2 cursor-pointer"
|
2023-10-23 09:45:48 -05:00
|
|
|
>
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("view_all")}
|
2023-12-19 10:50:43 -06:00
|
|
|
<i className="bi-chevron-right text-sm"></i>
|
2023-10-23 09:45:48 -05:00
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
2024-08-12 23:08:57 -05:00
|
|
|
style={{
|
2024-09-09 23:09:33 -05:00
|
|
|
flex: links || dashboardData.isLoading ? "0 1 auto" : "1 1 auto",
|
2024-08-12 23:08:57 -05:00
|
|
|
}}
|
2023-10-23 09:45:48 -05:00
|
|
|
className="flex flex-col 2xl:flex-row items-start 2xl:gap-2"
|
|
|
|
>
|
2024-08-12 23:08:57 -05:00
|
|
|
{dashboardData.isLoading ? (
|
2023-10-23 09:45:48 -05:00
|
|
|
<div className="w-full">
|
2024-08-12 23:08:57 -05:00
|
|
|
<Links
|
|
|
|
layout={viewMode}
|
2024-09-11 00:38:38 -05:00
|
|
|
placeholderCount={settings.columns || 1}
|
2024-08-12 23:08:57 -05:00
|
|
|
useData={dashboardData}
|
|
|
|
/>
|
|
|
|
</div>
|
2024-09-09 23:09:33 -05:00
|
|
|
) : links && links[0] && !dashboardData.isLoading ? (
|
2024-08-12 23:08:57 -05:00
|
|
|
<div className="w-full">
|
2024-09-11 00:38:38 -05:00
|
|
|
<Links
|
|
|
|
links={links.slice(
|
|
|
|
0,
|
|
|
|
settings.columns ? settings.columns * 2 : numberOfLinksToShow
|
|
|
|
)}
|
|
|
|
layout={viewMode}
|
|
|
|
/>
|
2023-10-23 09:45:48 -05:00
|
|
|
</div>
|
|
|
|
) : (
|
2024-11-09 22:07:01 -06:00
|
|
|
<div className="flex flex-col justify-center h-full border border-solid border-neutral-content w-full mx-auto p-10 rounded-2xl bg-base-200 bg-gradient-to-tr from-neutral-content/70 to-50% to-base-200">
|
2023-11-24 07:39:55 -06:00
|
|
|
<p className="text-center text-2xl">
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("view_added_links_here")}
|
2023-10-23 09:45:48 -05:00
|
|
|
</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">
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("view_added_links_here_desc")}
|
2023-10-23 09:45:48 -05:00
|
|
|
</p>
|
|
|
|
|
2023-11-24 07:39:55 -06:00
|
|
|
<div className="text-center w-full mt-4 flex flex-wrap gap-4 justify-center">
|
2023-10-23 09:45:48 -05:00
|
|
|
<div
|
|
|
|
onClick={() => {
|
2023-12-01 15:29:17 -06:00
|
|
|
setNewLinkModal(true);
|
2023-10-23 09:45:48 -05:00
|
|
|
}}
|
2023-12-19 10:50:43 -06:00
|
|
|
className="inline-flex items-center gap-2 text-sm btn btn-accent dark:border-violet-400 text-white"
|
2023-10-23 09:45:48 -05:00
|
|
|
>
|
2024-05-24 18:13:04 -05:00
|
|
|
<i className="bi-plus-lg text-xl"></i>
|
|
|
|
<span className="group-hover:opacity-0 text-right">
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("add_link")}
|
2023-10-23 09:45:48 -05:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
2023-12-01 15:29:17 -06:00
|
|
|
<div className="dropdown dropdown-bottom">
|
|
|
|
<div
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
2024-01-14 09:09:09 -06:00
|
|
|
onMouseDown={dropdownTriggerer}
|
2024-05-24 18:13:04 -05:00
|
|
|
className="inline-flex items-center gap-2 text-sm btn bg-neutral-content text-secondary-foreground hover:bg-neutral-content/80 border border-neutral/30 hover:border hover:border-neutral/30"
|
2023-12-01 15:29:17 -06:00
|
|
|
id="import-dropdown"
|
|
|
|
>
|
2023-12-16 09:11:35 -06:00
|
|
|
<i className="bi-cloud-upload text-xl duration-100"></i>
|
2024-06-04 15:59:49 -05:00
|
|
|
<p>{t("import_links")}</p>
|
2023-12-01 15:29:17 -06:00
|
|
|
</div>
|
2024-08-14 18:13:19 -05:00
|
|
|
<ul className="shadow menu dropdown-content z-[1] bg-base-200 border border-neutral-content rounded-box mt-1">
|
2023-11-27 15:38:38 -06:00
|
|
|
<li>
|
2023-11-30 03:36:40 -06:00
|
|
|
<label
|
2023-12-01 15:29:17 -06:00
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
2023-11-30 03:36:40 -06:00
|
|
|
htmlFor="import-linkwarden-file"
|
2024-06-04 15:59:49 -05:00
|
|
|
title={t("from_linkwarden")}
|
2024-08-14 18:13:19 -05:00
|
|
|
className="whitespace-nowrap"
|
2023-11-30 03:36:40 -06:00
|
|
|
>
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("from_linkwarden")}
|
2023-11-27 15:38:38 -06:00
|
|
|
<input
|
|
|
|
type="file"
|
|
|
|
name="photo"
|
|
|
|
id="import-linkwarden-file"
|
|
|
|
accept=".json"
|
|
|
|
className="hidden"
|
|
|
|
onChange={(e) =>
|
|
|
|
importBookmarks(e, MigrationFormat.linkwarden)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</label>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<label
|
2023-12-01 15:29:17 -06:00
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
2023-11-27 15:38:38 -06:00
|
|
|
htmlFor="import-html-file"
|
2024-06-04 15:59:49 -05:00
|
|
|
title={t("from_html")}
|
2024-08-14 18:13:19 -05:00
|
|
|
className="whitespace-nowrap"
|
2023-11-27 15:38:38 -06:00
|
|
|
>
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("from_html")}
|
2023-11-27 15:38:38 -06:00
|
|
|
<input
|
|
|
|
type="file"
|
|
|
|
name="photo"
|
|
|
|
id="import-html-file"
|
|
|
|
accept=".html"
|
|
|
|
className="hidden"
|
|
|
|
onChange={(e) =>
|
|
|
|
importBookmarks(e, MigrationFormat.htmlFile)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</label>
|
|
|
|
</li>
|
2024-06-04 15:59:49 -05:00
|
|
|
<li>
|
|
|
|
<label
|
|
|
|
tabIndex={0}
|
|
|
|
role="button"
|
|
|
|
htmlFor="import-wallabag-file"
|
|
|
|
title={t("from_wallabag")}
|
2024-08-14 18:13:19 -05:00
|
|
|
className="whitespace-nowrap"
|
2024-06-04 15:59:49 -05:00
|
|
|
>
|
|
|
|
{t("from_wallabag")}
|
|
|
|
<input
|
|
|
|
type="file"
|
|
|
|
name="photo"
|
|
|
|
id="import-wallabag-file"
|
|
|
|
accept=".json"
|
|
|
|
className="hidden"
|
|
|
|
onChange={(e) =>
|
|
|
|
importBookmarks(e, MigrationFormat.wallabag)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</label>
|
|
|
|
</li>
|
2023-11-27 15:38:38 -06:00
|
|
|
</ul>
|
2023-12-01 15:29:17 -06:00
|
|
|
</div>
|
2023-10-23 09:45:48 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
|
2023-08-28 13:03:06 -05:00
|
|
|
<div className="flex justify-between items-center">
|
|
|
|
<div className="flex gap-2 items-center">
|
2023-12-19 10:50:43 -06:00
|
|
|
<PageHeader
|
|
|
|
icon={"bi-pin-angle"}
|
2024-06-04 15:59:49 -05:00
|
|
|
title={t("pinned")}
|
|
|
|
description={t("pinned_links_desc")}
|
2023-12-19 10:50:43 -06:00
|
|
|
/>
|
2023-08-28 13:03:06 -05:00
|
|
|
</div>
|
2023-11-11 13:57:46 -06:00
|
|
|
<Link
|
|
|
|
href="/links/pinned"
|
2023-12-16 09:11:35 -06:00
|
|
|
className="flex items-center text-sm text-black/75 dark:text-white/75 gap-2 cursor-pointer"
|
2023-11-11 13:57:46 -06:00
|
|
|
>
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("view_all")}
|
2023-12-16 09:11:35 -06:00
|
|
|
<i className="bi-chevron-right text-sm "></i>
|
2023-11-11 13:57:46 -06:00
|
|
|
</Link>
|
2023-08-28 13:03:06 -05:00
|
|
|
</div>
|
2023-06-12 13:23:11 -05:00
|
|
|
|
2023-09-01 17:04:11 -05:00
|
|
|
<div
|
2023-11-11 14:56:45 -06:00
|
|
|
style={{ flex: "1 1 auto" }}
|
2023-10-12 13:59:24 -05:00
|
|
|
className="flex flex-col 2xl:flex-row items-start 2xl:gap-2"
|
2023-09-01 17:04:11 -05:00
|
|
|
>
|
2024-08-12 23:08:57 -05:00
|
|
|
{dashboardData.isLoading ? (
|
|
|
|
<div className="w-full">
|
|
|
|
<Links
|
|
|
|
layout={viewMode}
|
2024-09-11 00:38:38 -05:00
|
|
|
placeholderCount={settings.columns || 1}
|
2024-08-12 23:08:57 -05:00
|
|
|
useData={dashboardData}
|
|
|
|
/>
|
|
|
|
</div>
|
2024-09-09 23:09:33 -05:00
|
|
|
) : links?.some((e: any) => e.pinnedBy && e.pinnedBy[0]) ? (
|
2023-10-12 13:59:24 -05:00
|
|
|
<div className="w-full">
|
2024-08-12 23:08:57 -05:00
|
|
|
<Links
|
2024-09-09 23:09:33 -05:00
|
|
|
links={links
|
|
|
|
.filter((e: any) => e.pinnedBy && e.pinnedBy[0])
|
2024-09-11 00:38:38 -05:00
|
|
|
.slice(
|
|
|
|
0,
|
|
|
|
settings.columns
|
|
|
|
? settings.columns * 2
|
|
|
|
: numberOfLinksToShow
|
|
|
|
)}
|
2024-08-12 23:08:57 -05:00
|
|
|
layout={viewMode}
|
2024-01-15 02:39:53 -06:00
|
|
|
/>
|
2023-08-28 13:03:06 -05:00
|
|
|
</div>
|
2023-07-18 10:34:43 -05:00
|
|
|
) : (
|
2023-09-01 17:04:11 -05:00
|
|
|
<div
|
|
|
|
style={{ flex: "1 1 auto" }}
|
2024-11-09 22:07:01 -06:00
|
|
|
className="flex flex-col gap-2 justify-center h-full border border-solid border-neutral-content w-full mx-auto p-10 rounded-2xl bg-base-200 bg-gradient-to-tr from-neutral-content/70 to-50% to-base-200"
|
2023-09-01 17:04:11 -05:00
|
|
|
>
|
2024-05-24 18:13:04 -05:00
|
|
|
<i className="bi-pin mx-auto text-6xl text-primary"></i>
|
2023-11-24 07:39:55 -06:00
|
|
|
<p className="text-center text-2xl">
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("pin_favorite_links_here")}
|
2023-07-18 10:34:43 -05:00
|
|
|
</p>
|
2024-05-24 18:13:04 -05:00
|
|
|
<p className="text-center mx-auto max-w-96 w-fit text-neutral text-sm">
|
2024-06-04 15:59:49 -05:00
|
|
|
{t("pin_favorite_links_here_desc")}
|
2023-07-18 10:34:43 -05:00
|
|
|
</p>
|
2023-05-14 10:41:08 -05:00
|
|
|
</div>
|
2023-07-18 10:34:43 -05:00
|
|
|
)}
|
2023-05-14 10:41:08 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-11-07 10:09:36 -06:00
|
|
|
{showSurveyModal && (
|
|
|
|
<SurveyModal
|
|
|
|
submit={submitSurvey}
|
|
|
|
onClose={() => {
|
|
|
|
setShowsSurveyModal(false);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
2024-07-27 17:41:13 -05:00
|
|
|
{newLinkModal && <NewLinkModal onClose={() => setNewLinkModal(false)} />}
|
2023-05-14 10:41:08 -05:00
|
|
|
</MainLayout>
|
|
|
|
);
|
|
|
|
}
|
2024-06-04 15:59:49 -05:00
|
|
|
|
|
|
|
export { getServerSideProps };
|