Replace useless ternarys with logical ANDs
This commit is contained in:
parent
2264abd384
commit
e79b98d3b0
|
@ -129,12 +129,12 @@ export default function CollectionCard({ collection, className }: Props) {
|
|||
className="flex items-center absolute bottom-3 left-3 z-10 btn px-2 btn-ghost rounded-full"
|
||||
onClick={() => setEditCollectionSharingModal(true)}
|
||||
>
|
||||
{collectionOwner.id ? (
|
||||
{collectionOwner.id && (
|
||||
<ProfilePhoto
|
||||
src={collectionOwner.image || undefined}
|
||||
name={collectionOwner.name}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
{collection.members
|
||||
.sort((a, b) => (a.userId as number) - (b.userId as number))
|
||||
.map((e, i) => {
|
||||
|
@ -159,10 +159,8 @@ export default function CollectionCard({ collection, className }: Props) {
|
|||
<Link
|
||||
href={`/collections/${collection.id}`}
|
||||
style={{
|
||||
backgroundImage: `linear-gradient(45deg, ${collection.color}30 10%, ${
|
||||
settings.theme === "dark" ? "oklch(var(--b2))" : "oklch(var(--b2))"
|
||||
} 50%, ${
|
||||
settings.theme === "dark" ? "oklch(var(--b2))" : "oklch(var(--b2))"
|
||||
backgroundImage: `linear-gradient(45deg, ${collection.color}30 10%, ${settings.theme === "dark" ? "oklch(var(--b2))" : "oklch(var(--b2))"
|
||||
} 50%, ${settings.theme === "dark" ? "oklch(var(--b2))" : "oklch(var(--b2))"
|
||||
} 100%)`,
|
||||
}}
|
||||
className="card card-compact shadow-md hover:shadow-none duration-200 border border-neutral-content"
|
||||
|
@ -178,12 +176,12 @@ export default function CollectionCard({ collection, className }: Props) {
|
|||
<div className="flex justify-end items-center">
|
||||
<div className="text-right">
|
||||
<div className="font-bold text-sm flex justify-end gap-1 items-center">
|
||||
{collection.isPublic ? (
|
||||
{collection.isPublic && (
|
||||
<i
|
||||
className="bi-globe2 drop-shadow text-neutral"
|
||||
title="This collection is being shared publicly."
|
||||
></i>
|
||||
) : undefined}
|
||||
)}
|
||||
<i
|
||||
className="bi-link-45deg text-lg text-neutral"
|
||||
title="This collection is being shared publicly."
|
||||
|
@ -203,24 +201,24 @@ export default function CollectionCard({ collection, className }: Props) {
|
|||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
{editCollectionModal ? (
|
||||
{editCollectionModal && (
|
||||
<EditCollectionModal
|
||||
onClose={() => setEditCollectionModal(false)}
|
||||
activeCollection={collection}
|
||||
/>
|
||||
) : undefined}
|
||||
{editCollectionSharingModal ? (
|
||||
)}
|
||||
{editCollectionSharingModal && (
|
||||
<EditCollectionSharingModal
|
||||
onClose={() => setEditCollectionSharingModal(false)}
|
||||
activeCollection={collection}
|
||||
/>
|
||||
) : undefined}
|
||||
{deleteCollectionModal ? (
|
||||
)}
|
||||
{deleteCollectionModal && (
|
||||
<DeleteCollectionModal
|
||||
onClose={() => setDeleteCollectionModal(false)}
|
||||
activeCollection={collection}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -231,8 +231,7 @@ const renderItem = (
|
|||
return (
|
||||
<div ref={provided.innerRef} {...provided.draggableProps} className="mb-1">
|
||||
<div
|
||||
className={`${
|
||||
currentPath === `/collections/${collection.id}`
|
||||
className={`${currentPath === `/collections/${collection.id}`
|
||||
? "bg-primary/20 is-active"
|
||||
: "hover:bg-neutral/20"
|
||||
} duration-100 flex gap-1 items-center pr-2 pl-1 rounded-md`}
|
||||
|
@ -253,12 +252,12 @@ const renderItem = (
|
|||
></i>
|
||||
<p className="truncate w-full">{collection.name}</p>
|
||||
|
||||
{collection.isPublic ? (
|
||||
{collection.isPublic && (
|
||||
<i
|
||||
className="bi-globe2 text-sm text-black/50 dark:text-white/50 drop-shadow"
|
||||
title="This collection is being shared publicly."
|
||||
></i>
|
||||
) : undefined}
|
||||
)}
|
||||
<div className="drop-shadow text-neutral text-xs">
|
||||
{collection._count?.links}
|
||||
</div>
|
||||
|
|
|
@ -79,8 +79,7 @@ export default function LinkActions({
|
|||
return (
|
||||
<>
|
||||
<div
|
||||
className={`dropdown dropdown-left absolute ${
|
||||
position || "top-3 right-3"
|
||||
className={`dropdown dropdown-left absolute ${position || "top-3 right-3"
|
||||
} ${alignToTop ? "" : "dropdown-end"} z-20`}
|
||||
>
|
||||
<div
|
||||
|
@ -92,8 +91,7 @@ export default function LinkActions({
|
|||
<i title="More" className="bi-three-dots text-xl" />
|
||||
</div>
|
||||
<ul
|
||||
className={`dropdown-content z-[20] menu shadow bg-base-200 border border-neutral-content rounded-box w-44 mr-1 ${
|
||||
alignToTop ? "" : "translate-y-10"
|
||||
className={`dropdown-content z-[20] menu shadow bg-base-200 border border-neutral-content rounded-box w-44 mr-1 ${alignToTop ? "" : "translate-y-10"
|
||||
}`}
|
||||
>
|
||||
<li>
|
||||
|
@ -110,7 +108,7 @@ export default function LinkActions({
|
|||
: t("pin_to_dashboard")}
|
||||
</div>
|
||||
</li>
|
||||
{linkInfo !== undefined && toggleShowInfo ? (
|
||||
{linkInfo !== undefined && toggleShowInfo && (
|
||||
<li>
|
||||
<div
|
||||
role="button"
|
||||
|
@ -123,8 +121,8 @@ export default function LinkActions({
|
|||
{!linkInfo ? t("show_link_details") : t("hide_link_details")}
|
||||
</div>
|
||||
</li>
|
||||
) : undefined}
|
||||
{permissions === true || permissions?.canUpdate ? (
|
||||
)}
|
||||
{permissions === true || permissions?.canUpdate && (
|
||||
<li>
|
||||
<div
|
||||
role="button"
|
||||
|
@ -137,7 +135,7 @@ export default function LinkActions({
|
|||
{t("edit_link")}
|
||||
</div>
|
||||
</li>
|
||||
) : undefined}
|
||||
)}
|
||||
{link.type === "url" && (
|
||||
<li>
|
||||
<div
|
||||
|
@ -152,7 +150,7 @@ export default function LinkActions({
|
|||
</div>
|
||||
</li>
|
||||
)}
|
||||
{permissions === true || permissions?.canDelete ? (
|
||||
{permissions === true || permissions?.canDelete && (
|
||||
<li>
|
||||
<div
|
||||
role="button"
|
||||
|
@ -165,28 +163,28 @@ export default function LinkActions({
|
|||
{t("delete")}
|
||||
</div>
|
||||
</li>
|
||||
) : undefined}
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{editLinkModal ? (
|
||||
{editLinkModal && (
|
||||
<EditLinkModal
|
||||
onClose={() => setEditLinkModal(false)}
|
||||
activeLink={link}
|
||||
/>
|
||||
) : undefined}
|
||||
{deleteLinkModal ? (
|
||||
)}
|
||||
{deleteLinkModal && (
|
||||
<DeleteLinkModal
|
||||
onClose={() => setDeleteLinkModal(false)}
|
||||
activeLink={link}
|
||||
/>
|
||||
) : undefined}
|
||||
{preservedFormatsModal ? (
|
||||
)}
|
||||
{preservedFormatsModal && (
|
||||
<PreservedFormatsModal
|
||||
onClose={() => setPreservedFormatsModal(false)}
|
||||
activeLink={link}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
{/* {expandedLink ? (
|
||||
<ExpandedLink onClose={() => setExpandedLink(false)} link={link} />
|
||||
) : undefined} */}
|
||||
|
|
|
@ -91,8 +91,7 @@ export default function LinkCardCompact({
|
|||
return (
|
||||
<>
|
||||
<div
|
||||
className={`${selectedStyle} border relative items-center flex ${
|
||||
!showInfo && !isPWA() ? "hover:bg-base-300 p-3" : "py-3"
|
||||
className={`${selectedStyle} border relative items-center flex ${!showInfo && !isPWA() ? "hover:bg-base-300 p-3" : "py-3"
|
||||
} duration-200 rounded-lg w-full`}
|
||||
onClick={() =>
|
||||
selectable
|
||||
|
@ -139,9 +138,9 @@ export default function LinkCardCompact({
|
|||
|
||||
<div className="mt-1 flex flex-col sm:flex-row sm:items-center gap-2 text-xs text-neutral">
|
||||
<div className="flex items-center gap-x-3 text-neutral flex-wrap">
|
||||
{collection ? (
|
||||
{collection && (
|
||||
<LinkCollection link={link} collection={collection} />
|
||||
) : undefined}
|
||||
)}
|
||||
{link.name && <LinkTypeBadge link={link} />}
|
||||
<LinkDate link={link} />
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,7 @@ import { useTranslation } from "next-i18next";
|
|||
|
||||
type Props = {};
|
||||
|
||||
export default function MobileNavigation({}: Props) {
|
||||
export default function MobileNavigation({ }: Props) {
|
||||
const { t } = useTranslation();
|
||||
const [newLinkModal, setNewLinkModal] = useState(false);
|
||||
const [newCollectionModal, setNewCollectionModal] = useState(false);
|
||||
|
@ -21,8 +21,7 @@ export default function MobileNavigation({}: Props) {
|
|||
className={`fixed bottom-0 left-0 right-0 z-30 duration-200 sm:hidden`}
|
||||
>
|
||||
<div
|
||||
className={`w-full flex bg-base-100 ${
|
||||
isIphone() && isPWA() ? "pb-5" : ""
|
||||
className={`w-full flex bg-base-100 ${isIphone() && isPWA() ? "pb-5" : ""
|
||||
} border-solid border-t-neutral-content border-t`}
|
||||
>
|
||||
<MobileNavigationButton href={`/dashboard`} icon={"bi-house"} />
|
||||
|
@ -84,15 +83,15 @@ export default function MobileNavigation({}: Props) {
|
|||
<MobileNavigationButton href={`/collections`} icon={"bi-folder"} />
|
||||
</div>
|
||||
</div>
|
||||
{newLinkModal ? (
|
||||
{newLinkModal && (
|
||||
<NewLinkModal onClose={() => setNewLinkModal(false)} />
|
||||
) : undefined}
|
||||
{newCollectionModal ? (
|
||||
)}
|
||||
{newCollectionModal && (
|
||||
<NewCollectionModal onClose={() => setNewCollectionModal(false)} />
|
||||
) : undefined}
|
||||
{uploadFileModal ? (
|
||||
)}
|
||||
{uploadFileModal && (
|
||||
<UploadFileModal onClose={() => setUploadFileModal(false)} />
|
||||
) : undefined}
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ export default function EditLinkModal({ onClose, activeLink }: Props) {
|
|||
|
||||
<div className="divider mb-3 mt-1"></div>
|
||||
|
||||
{link.url ? (
|
||||
{link.url && (
|
||||
<Link
|
||||
href={link.url}
|
||||
className="truncate text-neutral flex gap-2 mb-5 w-fit max-w-full"
|
||||
|
@ -82,7 +82,7 @@ export default function EditLinkModal({ onClose, activeLink }: Props) {
|
|||
<i className="bi-link-45deg text-xl" />
|
||||
<p>{shortenedURL}</p>
|
||||
</Link>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
<div className="w-full">
|
||||
<p className="mb-2">{t("name")}</p>
|
||||
|
|
|
@ -128,7 +128,7 @@ export default function NewLinkModal({ onClose }: Props) {
|
|||
</div>
|
||||
</div>
|
||||
<div className={"mt-2"}>
|
||||
{optionsExpanded ? (
|
||||
{optionsExpanded && (
|
||||
<div className="mt-5">
|
||||
<div className="grid sm:grid-cols-2 gap-3">
|
||||
<div>
|
||||
|
@ -163,7 +163,7 @@ export default function NewLinkModal({ onClose }: Props) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
<div className="flex justify-between items-center mt-5">
|
||||
<div
|
||||
|
|
|
@ -86,7 +86,7 @@ export default function NewUserModal({ onClose }: Props) {
|
|||
/>
|
||||
</div>
|
||||
|
||||
{emailEnabled ? (
|
||||
{emailEnabled && (
|
||||
<div>
|
||||
<p className="mb-2">{t("email")}</p>
|
||||
<TextInput
|
||||
|
@ -96,7 +96,7 @@ export default function NewUserModal({ onClose }: Props) {
|
|||
value={form.email}
|
||||
/>
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
<div>
|
||||
<p className="mb-2">
|
||||
|
|
|
@ -159,7 +159,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
|||
)}
|
||||
|
||||
<div className={`flex flex-col gap-3`}>
|
||||
{monolithAvailable(link) ? (
|
||||
{monolithAvailable(link) && (
|
||||
<PreservedFormatRow
|
||||
name={t("webpage")}
|
||||
icon={"bi-filetype-html"}
|
||||
|
@ -167,9 +167,9 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
|||
activeLink={link}
|
||||
downloadable={true}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
{screenshotAvailable(link) ? (
|
||||
{screenshotAvailable(link) && (
|
||||
<PreservedFormatRow
|
||||
name={t("screenshot")}
|
||||
icon={"bi-file-earmark-image"}
|
||||
|
@ -181,9 +181,9 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
|||
activeLink={link}
|
||||
downloadable={true}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
{pdfAvailable(link) ? (
|
||||
{pdfAvailable(link) && (
|
||||
<PreservedFormatRow
|
||||
name={t("pdf")}
|
||||
icon={"bi-file-earmark-pdf"}
|
||||
|
@ -191,16 +191,16 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
|||
activeLink={link}
|
||||
downloadable={true}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
{readabilityAvailable(link) ? (
|
||||
{readabilityAvailable(link) && (
|
||||
<PreservedFormatRow
|
||||
name={t("readable")}
|
||||
icon={"bi-file-earmark-text"}
|
||||
format={ArchivedFormat.readability}
|
||||
activeLink={link}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
{!isReady() && !atLeastOneFormatAvailable() ? (
|
||||
<div className={`w-full h-full flex flex-col justify-center p-10`}>
|
||||
|
@ -213,7 +213,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
|||
<p className="text-center text-2xl">{t("preservation_in_queue")}</p>
|
||||
<p className="text-center text-lg">{t("check_back_later")}</p>
|
||||
</div>
|
||||
) : !isReady() && atLeastOneFormatAvailable() ? (
|
||||
) : !isReady() && atLeastOneFormatAvailable() && (
|
||||
<div className={`w-full h-full flex flex-col justify-center p-5`}>
|
||||
<BeatLoader
|
||||
color="oklch(var(--p))"
|
||||
|
@ -223,11 +223,10 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
|
|||
<p className="text-center">{t("there_are_more_formats")}</p>
|
||||
<p className="text-center text-sm">{t("check_back_later")}</p>
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
<div
|
||||
className={`flex flex-col sm:flex-row gap-3 items-center justify-center ${
|
||||
isReady() ? "sm:mt " : ""
|
||||
className={`flex flex-col sm:flex-row gap-3 items-center justify-center ${isReady() ? "sm:mt " : ""
|
||||
}`}
|
||||
>
|
||||
<Link
|
||||
|
|
|
@ -157,7 +157,7 @@ export default function UploadFileModal({ onClose }: Props) {
|
|||
</div>
|
||||
<div className="sm:col-span-2 col-span-5">
|
||||
<p className="mb-2">{t("collection")}</p>
|
||||
{link.collection.name ? (
|
||||
{link.collection.name && (
|
||||
<CollectionSelection
|
||||
onChange={setCollection}
|
||||
defaultValue={{
|
||||
|
@ -165,10 +165,10 @@ export default function UploadFileModal({ onClose }: Props) {
|
|||
value: link.collection.id,
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{optionsExpanded ? (
|
||||
{optionsExpanded && (
|
||||
<div className="mt-5">
|
||||
<div className="grid sm:grid-cols-2 gap-3">
|
||||
<div>
|
||||
|
@ -203,7 +203,7 @@ export default function UploadFileModal({ onClose }: Props) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
<div className="flex justify-between items-center mt-5">
|
||||
<div
|
||||
onClick={() => setOptionsExpanded(!optionsExpanded)}
|
||||
|
|
|
@ -120,15 +120,15 @@ export default function Navbar() {
|
|||
</ClickAwayHandler>
|
||||
</div>
|
||||
) : null}
|
||||
{newLinkModal ? (
|
||||
{newLinkModal && (
|
||||
<NewLinkModal onClose={() => setNewLinkModal(false)} />
|
||||
) : undefined}
|
||||
{newCollectionModal ? (
|
||||
)}
|
||||
{newCollectionModal && (
|
||||
<NewCollectionModal onClose={() => setNewCollectionModal(false)} />
|
||||
) : undefined}
|
||||
{uploadFileModal ? (
|
||||
)}
|
||||
{uploadFileModal && (
|
||||
<UploadFileModal onClose={() => setUploadFileModal(false)} />
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -39,9 +39,9 @@ export default function NoLinksFound({ text }: Props) {
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{newLinkModal ? (
|
||||
{newLinkModal && (
|
||||
<NewLinkModal onClose={() => setNewLinkModal(false)} />
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -97,18 +97,17 @@ export default function PreservedFormatRow({
|
|||
</div>
|
||||
|
||||
<div className="flex gap-1">
|
||||
{downloadable || false ? (
|
||||
{downloadable || false && (
|
||||
<div
|
||||
onClick={() => handleDownload()}
|
||||
className="btn btn-sm btn-square"
|
||||
>
|
||||
<i className="bi-cloud-arrow-down text-xl text-neutral" />
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
<Link
|
||||
href={`${
|
||||
isPublic ? "/public" : ""
|
||||
href={`${isPublic ? "/public" : ""
|
||||
}/preserved/${link?.id}?format=${format}`}
|
||||
target="_blank"
|
||||
className="btn btn-sm btn-square"
|
||||
|
|
|
@ -183,7 +183,7 @@ export default function ReadableView({ link }: Props) {
|
|||
link?.name || link?.description || link?.url || ""
|
||||
)}
|
||||
</p>
|
||||
{link?.url ? (
|
||||
{link?.url && (
|
||||
<Link
|
||||
href={link?.url || ""}
|
||||
title={link?.url}
|
||||
|
@ -192,11 +192,9 @@ export default function ReadableView({ link }: Props) {
|
|||
>
|
||||
<i className="bi-link-45deg"></i>
|
||||
|
||||
{isValidUrl(link?.url || "")
|
||||
? new URL(link?.url as string).host
|
||||
: undefined}
|
||||
{isValidUrl(link?.url || "") && new URL(link?.url as string).host}
|
||||
</Link>
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -259,8 +257,7 @@ export default function ReadableView({ link }: Props) {
|
|||
></div>
|
||||
) : (
|
||||
<div
|
||||
className={`w-full h-full flex flex-col justify-center p-10 ${
|
||||
link?.readable === "pending" || !link?.readable ? "skeleton" : ""
|
||||
className={`w-full h-full flex flex-col justify-center p-10 ${link?.readable === "pending" || !link?.readable ? "skeleton" : ""
|
||||
}`}
|
||||
>
|
||||
<svg
|
||||
|
|
|
@ -23,22 +23,21 @@ export default function CenteredForm({
|
|||
data-testid={dataTestId}
|
||||
>
|
||||
<div className="m-auto flex flex-col gap-2 w-full">
|
||||
{settings.theme ? (
|
||||
{settings.theme && (
|
||||
<Image
|
||||
src={`/linkwarden_${
|
||||
settings.theme === "dark" ? "dark" : "light"
|
||||
src={`/linkwarden_${settings.theme === "dark" ? "dark" : "light"
|
||||
}.png`}
|
||||
width={640}
|
||||
height={136}
|
||||
alt="Linkwarden"
|
||||
className="h-12 w-fit mx-auto"
|
||||
/>
|
||||
) : undefined}
|
||||
{text ? (
|
||||
)}
|
||||
{text && (
|
||||
<p className="text-lg max-w-[30rem] min-w-80 w-full mx-auto font-semibold px-2 text-center">
|
||||
{text}
|
||||
</p>
|
||||
) : undefined}
|
||||
)}
|
||||
{children}
|
||||
<p className="text-center text-xs text-neutral mb-5">
|
||||
<Trans
|
||||
|
|
|
@ -34,9 +34,9 @@ export default function MainLayout({ children }: Props) {
|
|||
|
||||
return (
|
||||
<div className="flex" data-testid="dashboard-wrapper">
|
||||
{showAnnouncement ? (
|
||||
{showAnnouncement && (
|
||||
<Announcement toggleAnnouncementBar={toggleAnnouncementBar} />
|
||||
) : undefined}
|
||||
)}
|
||||
<div className="hidden lg:block">
|
||||
<Sidebar className={`fixed top-0`} />
|
||||
</div>
|
||||
|
|
|
@ -115,8 +115,7 @@ export default function Index() {
|
|||
<div
|
||||
className="h-[60rem] p-5 flex gap-3 flex-col"
|
||||
style={{
|
||||
backgroundImage: `linear-gradient(${activeCollection?.color}20 10%, ${
|
||||
settings.theme === "dark" ? "#262626" : "#f3f4f6"
|
||||
backgroundImage: `linear-gradient(${activeCollection?.color}20 10%, ${settings.theme === "dark" ? "#262626" : "#f3f4f6"
|
||||
} 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
|
||||
}}
|
||||
>
|
||||
|
@ -211,12 +210,12 @@ export default function Index() {
|
|||
className="flex items-center btn px-2 btn-ghost rounded-full w-fit"
|
||||
onClick={() => setEditCollectionSharingModal(true)}
|
||||
>
|
||||
{collectionOwner.id ? (
|
||||
{collectionOwner.id && (
|
||||
<ProfilePhoto
|
||||
src={collectionOwner.image || undefined}
|
||||
name={collectionOwner.name}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
{activeCollection.members
|
||||
.sort((a, b) => (a.userId as number) - (b.userId as number))
|
||||
.map((e, i) => {
|
||||
|
|
|
@ -58,7 +58,7 @@ export default function Collections() {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{sortedCollections.filter((e) => e.ownerId !== data?.user.id)[0] ? (
|
||||
{sortedCollections.filter((e) => e.ownerId !== data?.user.id)[0] && (
|
||||
<>
|
||||
<PageHeader
|
||||
icon={"bi-folder"}
|
||||
|
@ -74,11 +74,11 @@ export default function Collections() {
|
|||
})}
|
||||
</div>
|
||||
</>
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
{newCollectionModal ? (
|
||||
{newCollectionModal && (
|
||||
<NewCollectionModal onClose={() => setNewCollectionModal(false)} />
|
||||
) : undefined}
|
||||
)}
|
||||
</MainLayout>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -324,9 +324,9 @@ export default function Dashboard() {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
{newLinkModal ? (
|
||||
{newLinkModal && (
|
||||
<NewLinkModal onClose={() => setNewLinkModal(false)} />
|
||||
) : undefined}
|
||||
)}
|
||||
</MainLayout>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -203,9 +203,9 @@ export default function Login({
|
|||
{t("login")}
|
||||
</Button>
|
||||
|
||||
{availableLogins.buttonAuths.length > 0 ? (
|
||||
{availableLogins.buttonAuths.length > 0 && (
|
||||
<div className="divider my-1">{t("or_continue_with")}</div>
|
||||
) : undefined}
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -224,9 +224,9 @@ export default function Login({
|
|||
loading={submitLoader}
|
||||
>
|
||||
{value.name.toLowerCase() === "google" ||
|
||||
value.name.toLowerCase() === "apple" ? (
|
||||
value.name.toLowerCase() === "apple" && (
|
||||
<i className={"bi-" + value.name.toLowerCase()}></i>
|
||||
) : undefined}
|
||||
)}
|
||||
{value.name}
|
||||
</Button>
|
||||
</React.Fragment>
|
||||
|
|
|
@ -104,16 +104,17 @@ export default function PublicCollections() {
|
|||
// @ts-ignore
|
||||
const LinkComponent = linkView[viewMode];
|
||||
|
||||
return collection ? (
|
||||
if (!collection) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="h-96"
|
||||
style={{
|
||||
backgroundImage: `linear-gradient(${collection?.color}30 10%, ${
|
||||
settings.theme === "dark" ? "#262626" : "#f3f4f6"
|
||||
backgroundImage: `linear-gradient(${collection?.color}30 10%, ${settings.theme === "dark" ? "#262626" : "#f3f4f6"
|
||||
} 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
|
||||
}}
|
||||
>
|
||||
{collection ? (
|
||||
{collection && (
|
||||
<Head>
|
||||
<title>{collection.name} | Linkwarden</title>
|
||||
<meta
|
||||
|
@ -122,7 +123,7 @@ export default function PublicCollections() {
|
|||
key="title"
|
||||
/>
|
||||
</Head>
|
||||
) : undefined}
|
||||
)}
|
||||
<div className="lg:w-3/4 w-full mx-auto p-5 bg">
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-4xl font-thin mb-2 capitalize mt-10">
|
||||
|
@ -151,12 +152,12 @@ export default function PublicCollections() {
|
|||
className="flex items-center btn px-2 btn-ghost rounded-full"
|
||||
onClick={() => setEditCollectionSharingModal(true)}
|
||||
>
|
||||
{collectionOwner.id ? (
|
||||
{collectionOwner.id && (
|
||||
<ProfilePhoto
|
||||
src={collectionOwner.image || undefined}
|
||||
name={collectionOwner.name}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
{collection.members
|
||||
.sort((a, b) => (a.userId as number) - (b.userId as number))
|
||||
.map((e, i) => {
|
||||
|
@ -248,15 +249,13 @@ export default function PublicCollections() {
|
|||
</p> */}
|
||||
</div>
|
||||
</div>
|
||||
{editCollectionSharingModal ? (
|
||||
{editCollectionSharingModal && (
|
||||
<EditCollectionSharingModal
|
||||
onClose={() => setEditCollectionSharingModal(false)}
|
||||
activeCollection={collection}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,9 +133,9 @@ export default function Register({
|
|||
loading={submitLoader}
|
||||
>
|
||||
{value.name.toLowerCase() === "google" ||
|
||||
value.name.toLowerCase() === "apple" ? (
|
||||
value.name.toLowerCase() === "apple" && (
|
||||
<i className={"bi-" + value.name.toLowerCase()}></i>
|
||||
) : undefined}
|
||||
)}
|
||||
{value.name}
|
||||
</Button>
|
||||
</React.Fragment>
|
||||
|
@ -201,7 +201,7 @@ export default function Register({
|
|||
</div>
|
||||
)}
|
||||
|
||||
{emailEnabled ? (
|
||||
{emailEnabled && (
|
||||
<div>
|
||||
<p className="text-sm w-fit font-semibold mb-1">{t("email")}</p>
|
||||
|
||||
|
@ -214,7 +214,7 @@ export default function Register({
|
|||
onChange={(e) => setForm({ ...form, email: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
<div className="w-full">
|
||||
<p className="text-sm w-fit font-semibold mb-1">
|
||||
|
@ -248,7 +248,7 @@ export default function Register({
|
|||
/>
|
||||
</div>
|
||||
|
||||
{process.env.NEXT_PUBLIC_STRIPE ? (
|
||||
{process.env.NEXT_PUBLIC_STRIPE && (
|
||||
<div className="text-xs text-neutral mb-3">
|
||||
<p>
|
||||
<Trans
|
||||
|
@ -270,7 +270,7 @@ export default function Register({
|
|||
/>
|
||||
</p>
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
|
@ -282,9 +282,9 @@ export default function Register({
|
|||
{t("sign_up")}
|
||||
</Button>
|
||||
|
||||
{availableLogins.buttonAuths.length > 0 ? (
|
||||
{availableLogins.buttonAuths.length > 0 && (
|
||||
<div className="divider my-1">{t("or_continue_with")}</div>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
{displayLoginExternalButton()}
|
||||
<div>
|
||||
|
@ -298,7 +298,7 @@ export default function Register({
|
|||
{t("login")}
|
||||
</Link>
|
||||
</div>
|
||||
{process.env.NEXT_PUBLIC_STRIPE ? (
|
||||
{process.env.NEXT_PUBLIC_STRIPE && (
|
||||
<div className="text-neutral text-center flex items-baseline gap-1 justify-center">
|
||||
<p>{t("need_help")}</p>
|
||||
<Link
|
||||
|
@ -309,7 +309,7 @@ export default function Register({
|
|||
{t("get_in_touch")}
|
||||
</Link>
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -48,7 +48,7 @@ export default function AccessTokens() {
|
|||
{t("new_token")}
|
||||
</button>
|
||||
|
||||
{tokens.length > 0 ? (
|
||||
{tokens.length > 0 && (
|
||||
<table className="table mt-2 overflow-x-auto">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -93,12 +93,12 @@ export default function AccessTokens() {
|
|||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
) : undefined}
|
||||
)}
|
||||
</div>
|
||||
|
||||
{newTokenModal ? (
|
||||
{newTokenModal && (
|
||||
<NewTokenModal onClose={() => setNewTokenModal(false)} />
|
||||
) : undefined}
|
||||
)}
|
||||
{revokeTokenModal && selectedToken && (
|
||||
<RevokeTokenModal
|
||||
onClose={() => {
|
||||
|
|
|
@ -176,7 +176,7 @@ export default function Account() {
|
|||
onChange={(e) => setUser({ ...user, username: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
{emailEnabled ? (
|
||||
{emailEnabled && (
|
||||
<div>
|
||||
<p className="mb-2">{t("email")}</p>
|
||||
<TextInput
|
||||
|
@ -185,7 +185,7 @@ export default function Account() {
|
|||
onChange={(e) => setUser({ ...user, email: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
) : undefined}
|
||||
)}
|
||||
<div>
|
||||
<p className="mb-2">{t("language")}</p>
|
||||
<select
|
||||
|
@ -418,9 +418,7 @@ export default function Account() {
|
|||
|
||||
<p>
|
||||
{t("delete_account_warning")}
|
||||
{process.env.NEXT_PUBLIC_STRIPE
|
||||
? " " + t("cancel_subscription_notice")
|
||||
: undefined}
|
||||
{process.env.NEXT_PUBLIC_STRIPE && " " + t("cancel_subscription_notice")}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
@ -429,14 +427,14 @@ export default function Account() {
|
|||
</Link>
|
||||
</div>
|
||||
|
||||
{emailChangeVerificationModal ? (
|
||||
{emailChangeVerificationModal && (
|
||||
<EmailChangeVerificationModal
|
||||
onClose={() => setEmailChangeVerificationModal(false)}
|
||||
onSubmit={submit}
|
||||
oldEmail={account.email || ""}
|
||||
newEmail={user.email || ""}
|
||||
/>
|
||||
) : undefined}
|
||||
)}
|
||||
</SettingsLayout>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ export default function Delete() {
|
|||
/>
|
||||
</div>
|
||||
|
||||
{process.env.NEXT_PUBLIC_STRIPE ? (
|
||||
{process.env.NEXT_PUBLIC_STRIPE && (
|
||||
<fieldset className="border rounded-md p-2 border-primary">
|
||||
<legend className="px-3 py-1 text-sm sm:text-base border rounded-md border-primary">
|
||||
<b>{t("optional")}</b> <i>{t("feedback_help")}</i>
|
||||
|
@ -123,7 +123,7 @@ export default function Delete() {
|
|||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
) : undefined}
|
||||
)}
|
||||
|
||||
<Button
|
||||
className="mx-auto"
|
||||
|
|
Ŝarĝante…
Reference in New Issue