From 4f6368fcbf36716c235731356dab469599aa9d8e Mon Sep 17 00:00:00 2001 From: Isaac Wise Date: Tue, 23 Apr 2024 20:53:33 -0500 Subject: [PATCH] Format & Lint --- components/LinkViews/Layouts/MasonryView.tsx | 65 ++++++++++---------- components/LinkViews/LinkCard.tsx | 12 ++-- components/ViewDropdown.tsx | 27 ++++---- pages/api/v1/auth/[...nextauth].ts | 64 ++++++++++--------- pages/api/v1/logins/index.ts | 2 +- pages/collections/[id].tsx | 16 +++-- pages/links/index.tsx | 11 ++-- pages/links/pinned.tsx | 11 ++-- pages/tags/[id].tsx | 16 +++-- types/enviornment.d.ts | 2 +- 10 files changed, 124 insertions(+), 102 deletions(-) diff --git a/components/LinkViews/Layouts/MasonryView.tsx b/components/LinkViews/Layouts/MasonryView.tsx index 7cd707c..743dcd4 100644 --- a/components/LinkViews/Layouts/MasonryView.tsx +++ b/components/LinkViews/Layouts/MasonryView.tsx @@ -1,40 +1,43 @@ - import LinkCard from "@/components/LinkViews/LinkCard"; import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; import { GridLoader } from "react-spinners"; -import Masonry from 'react-masonry-css' +import Masonry from "react-masonry-css"; export default function MasonryView({ - links, - editMode, - isLoading, + links, + editMode, + isLoading, }: { - links: LinkIncludingShortenedCollectionAndTags[]; - editMode?: boolean; - isLoading?: boolean; + links: LinkIncludingShortenedCollectionAndTags[]; + editMode?: boolean; + isLoading?: boolean; }) { - return ( - - {links.map((e, i) => { - return ( - - ); - })} + return ( + + {links.map((e, i) => { + return ( + + ); + })} - {isLoading && links.length > 0 && ( - - )} - - ); + {isLoading && links.length > 0 && ( + + )} + + ); } diff --git a/components/LinkViews/LinkCard.tsx b/components/LinkViews/LinkCard.tsx index 5c3417d..0ab4eee 100644 --- a/components/LinkViews/LinkCard.tsx +++ b/components/LinkViews/LinkCard.tsx @@ -122,8 +122,8 @@ export default function LinkCard({ link, flipDropdown, editMode }: Props) { ? handleCheckboxClick(link) : editMode ? toast.error( - "You don't have permission to edit or delete this item." - ) + "You don't have permission to edit or delete this item." + ) : undefined } > @@ -133,7 +133,7 @@ export default function LinkCard({ link, flipDropdown, editMode }: Props) { !editMode && window.open(generateLinkHref(link, account), "_blank") } > - {viewMode === 'masonry' && !(previewAvailable(link)) ? null : ( + {viewMode === "masonry" && !previewAvailable(link) ? null : ( <>
{previewAvailable(link) ? ( @@ -234,7 +234,11 @@ export default function LinkCard({ link, flipDropdown, editMode }: Props) { setShowInfo(!showInfo)} linkInfo={showInfo} flipDropdown={flipDropdown} diff --git a/components/ViewDropdown.tsx b/components/ViewDropdown.tsx index 9e5a189..ec4fb8c 100644 --- a/components/ViewDropdown.tsx +++ b/components/ViewDropdown.tsx @@ -26,30 +26,33 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
diff --git a/pages/api/v1/auth/[...nextauth].ts b/pages/api/v1/auth/[...nextauth].ts index 5935d83..c8ca51f 100644 --- a/pages/api/v1/auth/[...nextauth].ts +++ b/pages/api/v1/auth/[...nextauth].ts @@ -98,19 +98,19 @@ if ( const user = await prisma.user.findFirst({ where: emailEnabled ? { - OR: [ - { - username: username.toLowerCase(), - }, - { - email: username?.toLowerCase(), - }, - ], - emailVerified: { not: null }, - } + OR: [ + { + username: username.toLowerCase(), + }, + { + email: username?.toLowerCase(), + }, + ], + emailVerified: { not: null }, + } : { - username: username.toLowerCase(), - }, + username: username.toLowerCase(), + }, }); let passwordMatches: boolean = false; @@ -242,27 +242,25 @@ if (process.env.NEXT_PUBLIC_AUTH0_ENABLED === "true") { // Authelia if (process.env.NEXT_PUBLIC_AUTHELIA_ENABLED === "true") { - providers.push( - { - id: "authelia", - name: "Authelia", - type: "oauth", - clientId: process.env.AUTHELIA_CLIENT_ID!, - clientSecret: process.env.AUTHELIA_CLIENT_SECRET!, - wellKnown: process.env.AUTHELIA_WELLKNOWN_URL!, - authorization: { params: { scope: "openid email profile" } }, - idToken: true, - checks: ["pkce", "state"], - profile(profile) { - return { - id: profile.sub, - name: profile.name, - email: profile.email, - username: profile.preferred_username, - } - }, - } - ); + providers.push({ + id: "authelia", + name: "Authelia", + type: "oauth", + clientId: process.env.AUTHELIA_CLIENT_ID!, + clientSecret: process.env.AUTHELIA_CLIENT_SECRET!, + wellKnown: process.env.AUTHELIA_WELLKNOWN_URL!, + authorization: { params: { scope: "openid email profile" } }, + idToken: true, + checks: ["pkce", "state"], + profile(profile) { + return { + id: profile.sub, + name: profile.name, + email: profile.email, + username: profile.preferred_username, + }; + }, + }); const _linkAccount = adapter.linkAccount; adapter.linkAccount = (account) => { diff --git a/pages/api/v1/logins/index.ts b/pages/api/v1/logins/index.ts index bdf6588..d2ac875 100644 --- a/pages/api/v1/logins/index.ts +++ b/pages/api/v1/logins/index.ts @@ -401,7 +401,7 @@ export function getLogins() { return { credentialsEnabled: process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === "true" || - process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === undefined + process.env.NEXT_PUBLIC_CREDENTIALS_ENABLED === undefined ? "true" : "false", emailEnabled: diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx index 3a23940..e1ba2b8 100644 --- a/pages/collections/[id].tsx +++ b/pages/collections/[id].tsx @@ -127,7 +127,8 @@ export default function Index() { const bulkDeleteLinks = async () => { const load = toast.loading( - `Deleting ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : "" + `Deleting ${selectedLinks.length} Link${ + selectedLinks.length > 1 ? "s" : "" }...` ); @@ -139,7 +140,8 @@ export default function Index() { response.ok && toast.success( - `Deleted ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : "" + `Deleted ${selectedLinks.length} Link${ + selectedLinks.length > 1 ? "s" : "" }!` ); }; @@ -149,8 +151,9 @@ export default function Index() {
{activeCollection && ( @@ -325,10 +328,11 @@ export default function Index() { setEditMode(!editMode); setSelectedLinks([]); }} - className={`btn btn-square btn-sm btn-ghost ${editMode + className={`btn btn-square btn-sm btn-ghost ${ + editMode ? "bg-primary/20 hover:bg-primary/20" : "hover:bg-neutral/20" - }`} + }`} >
diff --git a/pages/links/index.tsx b/pages/links/index.tsx index 949f6be..2b1e67b 100644 --- a/pages/links/index.tsx +++ b/pages/links/index.tsx @@ -52,7 +52,8 @@ export default function Links() { const bulkDeleteLinks = async () => { const load = toast.loading( - `Deleting ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : "" + `Deleting ${selectedLinks.length} Link${ + selectedLinks.length > 1 ? "s" : "" }...` ); @@ -64,7 +65,8 @@ export default function Links() { response.ok && toast.success( - `Deleted ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : "" + `Deleted ${selectedLinks.length} Link${ + selectedLinks.length > 1 ? "s" : "" }!` ); }; @@ -97,10 +99,11 @@ export default function Links() { setEditMode(!editMode); setSelectedLinks([]); }} - className={`btn btn-square btn-sm btn-ghost ${editMode + className={`btn btn-square btn-sm btn-ghost ${ + editMode ? "bg-primary/20 hover:bg-primary/20" : "hover:bg-neutral/20" - }`} + }`} >
diff --git a/pages/links/pinned.tsx b/pages/links/pinned.tsx index 5e53886..f201844 100644 --- a/pages/links/pinned.tsx +++ b/pages/links/pinned.tsx @@ -50,7 +50,8 @@ export default function PinnedLinks() { const bulkDeleteLinks = async () => { const load = toast.loading( - `Deleting ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : "" + `Deleting ${selectedLinks.length} Link${ + selectedLinks.length > 1 ? "s" : "" }...` ); @@ -62,7 +63,8 @@ export default function PinnedLinks() { response.ok && toast.success( - `Deleted ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : "" + `Deleted ${selectedLinks.length} Link${ + selectedLinks.length > 1 ? "s" : "" }!` ); }; @@ -94,10 +96,11 @@ export default function PinnedLinks() { setEditMode(!editMode); setSelectedLinks([]); }} - className={`btn btn-square btn-sm btn-ghost ${editMode + className={`btn btn-square btn-sm btn-ghost ${ + editMode ? "bg-primary/20 hover:bg-primary/20" : "hover:bg-neutral/20" - }`} + }`} >
diff --git a/pages/tags/[id].tsx b/pages/tags/[id].tsx index 1b286c8..3c8b7c4 100644 --- a/pages/tags/[id].tsx +++ b/pages/tags/[id].tsx @@ -125,7 +125,8 @@ export default function Index() { const bulkDeleteLinks = async () => { const load = toast.loading( - `Deleting ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : "" + `Deleting ${selectedLinks.length} Link${ + selectedLinks.length > 1 ? "s" : "" }...` ); @@ -137,7 +138,8 @@ export default function Index() { response.ok && toast.success( - `Deleted ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : "" + `Deleted ${selectedLinks.length} Link${ + selectedLinks.length > 1 ? "s" : "" }!` ); }; @@ -197,10 +199,11 @@ export default function Index() {

8 + className={`dropdown dropdown-bottom font-normal ${ + activeTag?.name.length && activeTag?.name.length > 8 ? "dropdown-end" : "" - }`} + }`} >
diff --git a/types/enviornment.d.ts b/types/enviornment.d.ts index e8c5a7c..3dccc63 100644 --- a/types/enviornment.d.ts +++ b/types/enviornment.d.ts @@ -418,4 +418,4 @@ declare global { } } -export { }; +export {};