This commit is contained in:
Isaac Wise
2024-07-27 17:41:13 -05:00
parent 4faf389a2b
commit 94be3a7448
34 changed files with 308 additions and 256 deletions
+1 -3
View File
@@ -104,9 +104,7 @@ export default function Admin() {
<p>{t("no_users_found")}</p>
)}
{newUserModal && (
<NewUserModal onClose={() => setNewUserModal(false)} />
)}
{newUserModal && <NewUserModal onClose={() => setNewUserModal(false)} />}
</div>
);
}
+6 -2
View File
@@ -189,8 +189,12 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
where: { id: linkId },
data: {
preview: isPDF ? "unavailable" : undefined,
image: isImage ? `archives/${collectionPermissions.id}/${linkId + suffix}` : null,
pdf: isPDF ? `archives/${collectionPermissions.id}/${linkId + suffix}` : null,
image: isImage
? `archives/${collectionPermissions.id}/${linkId + suffix}`
: null,
pdf: isPDF
? `archives/${collectionPermissions.id}/${linkId + suffix}`
: null,
lastPreserved: new Date().toISOString(),
},
});
+24 -21
View File
@@ -54,7 +54,9 @@ export default function Index() {
const { account } = useAccountStore();
const [collectionOwner, setCollectionOwner] = useState<Partial<AccountSettings>>({});
const [collectionOwner, setCollectionOwner] = useState<
Partial<AccountSettings>
>({});
useEffect(() => {
const fetchOwner = async () => {
@@ -108,8 +110,9 @@ 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"
} 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
backgroundImage: `linear-gradient(${activeCollection?.color}20 10%, ${
settings.theme === "dark" ? "#262626" : "#f3f4f6"
} 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
}}
>
{activeCollection && (
@@ -210,7 +213,7 @@ export default function Index() {
/>
)}
{activeCollection.members
.sort((a, b) => (a.userId) - (b.userId))
.sort((a, b) => a.userId - b.userId)
.map((e, i) => {
return (
<ProfilePhoto
@@ -233,20 +236,20 @@ export default function Index() {
<p className="text-neutral text-sm">
{activeCollection.members.length > 0 &&
activeCollection.members.length === 1
activeCollection.members.length === 1
? t("by_author_and_other", {
author: collectionOwner.name,
count: activeCollection.members.length,
})
: activeCollection.members.length > 0 &&
activeCollection.members.length !== 1
? t("by_author_and_others", {
author: collectionOwner.name,
count: activeCollection.members.length,
})
: activeCollection.members.length > 0 &&
activeCollection.members.length !== 1
? t("by_author_and_others", {
author: collectionOwner.name,
count: activeCollection.members.length,
})
: t("by_author", {
author: collectionOwner.name,
})}
author: collectionOwner.name,
})}
</p>
</div>
</div>
@@ -291,15 +294,15 @@ export default function Index() {
setSortBy={setSortBy}
editMode={
permissions === true ||
permissions?.canUpdate ||
permissions?.canDelete
permissions?.canUpdate ||
permissions?.canDelete
? editMode
: undefined
}
setEditMode={
permissions === true ||
permissions?.canUpdate ||
permissions?.canDelete
permissions?.canUpdate ||
permissions?.canDelete
? setEditMode
: undefined
}
@@ -307,11 +310,11 @@ export default function Index() {
<p>
{activeCollection?._count?.links === 1
? t("showing_count_result", {
count: activeCollection?._count?.links,
})
count: activeCollection?._count?.links,
})
: t("showing_count_results", {
count: activeCollection?._count?.links,
})}
count: activeCollection?._count?.links,
})}
</p>
</LinkListOptions>
+5 -4
View File
@@ -60,7 +60,10 @@ export default function Dashboard() {
handleNumberOfLinksToShow();
}, [width]);
const importBookmarks = async (e: React.ChangeEvent<HTMLInputElement>, format: MigrationFormat) => {
const importBookmarks = async (
e: React.ChangeEvent<HTMLInputElement>,
format: MigrationFormat
) => {
const file: File | null = e.target.files && e.target.files[0];
if (file) {
@@ -324,9 +327,7 @@ export default function Dashboard() {
)}
</div>
</div>
{newLinkModal && (
<NewLinkModal onClose={() => setNewLinkModal(false)} />
)}
{newLinkModal && <NewLinkModal onClose={() => setNewLinkModal(false)} />}
</MainLayout>
);
}
+2 -2
View File
@@ -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>
)}
))}
{value.name}
</Button>
</React.Fragment>
+19 -16
View File
@@ -37,7 +37,9 @@ export default function PublicCollections() {
const router = useRouter();
const [collectionOwner, setCollectionOwner] = useState<Partial<AccountSettings>>({});
const [collectionOwner, setCollectionOwner] = useState<
Partial<AccountSettings>
>({});
const [searchFilter, setSearchFilter] = useState({
name: true,
@@ -103,8 +105,9 @@ export default function PublicCollections() {
<div
className="h-96"
style={{
backgroundImage: `linear-gradient(${collection?.color}30 10%, ${settings.theme === "dark" ? "#262626" : "#f3f4f6"
} 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
backgroundImage: `linear-gradient(${collection?.color}30 10%, ${
settings.theme === "dark" ? "#262626" : "#f3f4f6"
} 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
}}
>
{collection && (
@@ -175,20 +178,20 @@ export default function PublicCollections() {
<p className="text-neutral text-sm">
{collection.members.length > 0 &&
collection.members.length === 1
collection.members.length === 1
? t("by_author_and_other", {
author: collectionOwner.name,
count: collection.members.length,
})
: collection.members.length > 0 &&
collection.members.length !== 1
? t("by_author_and_others", {
author: collectionOwner.name,
count: collection.members.length,
})
: collection.members.length > 0 &&
collection.members.length !== 1
? t("by_author_and_others", {
author: collectionOwner.name,
count: collection.members.length,
})
: t("by_author", {
author: collectionOwner.name,
})}
author: collectionOwner.name,
})}
</p>
</div>
</div>
@@ -212,11 +215,11 @@ export default function PublicCollections() {
placeholder={
collection._count?.links === 1
? t("search_count_link", {
count: collection._count?.links,
})
count: collection._count?.links,
})
: t("search_count_links", {
count: collection._count?.links,
})
count: collection._count?.links,
})
}
/>
</LinkListOptions>
+4 -4
View File
@@ -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>
)}
))}
{value.name}
</Button>
</React.Fragment>
@@ -149,8 +149,8 @@ export default function Register({
text={
process.env.NEXT_PUBLIC_STRIPE
? t("trial_offer_desc", {
count: Number(process.env.NEXT_PUBLIC_TRIAL_PERIOD_DAYS || 14),
})
count: Number(process.env.NEXT_PUBLIC_TRIAL_PERIOD_DAYS || 14),
})
: t("register_desc")
}
data-testid="registration-form"
+19 -15
View File
@@ -29,19 +29,19 @@ export default function Account() {
!objectIsEmpty(account)
? account
: ({
// @ts-ignore
id: null,
name: "",
username: "",
email: "",
emailVerified: null,
password: undefined,
image: "",
isPrivate: true,
// @ts-ignore
createdAt: null,
whitelistedUsers: [],
} as unknown as AccountSettings)
// @ts-ignore
id: null,
name: "",
username: "",
email: "",
emailVerified: null,
password: undefined,
image: "",
isPrivate: true,
// @ts-ignore
createdAt: null,
whitelistedUsers: [],
} as unknown as AccountSettings)
);
const { t } = useTranslation();
@@ -102,7 +102,10 @@ export default function Account() {
setSubmitLoader(false);
};
const importBookmarks = async (e: ChangeEvent<HTMLInputElement>, format: MigrationFormat) => {
const importBookmarks = async (
e: ChangeEvent<HTMLInputElement>,
format: MigrationFormat
) => {
setSubmitLoader(true);
const file = e.target.files?.[0];
@@ -421,7 +424,8 @@ export default function Account() {
<p>
{t("delete_account_warning")}
{process.env.NEXT_PUBLIC_STRIPE && " " + t("cancel_subscription_notice")}
{process.env.NEXT_PUBLIC_STRIPE &&
" " + t("cancel_subscription_notice")}
</p>
</div>