fixes and improvements
This commit is contained in:
parent
ee05975e10
commit
1f20180a51
|
@ -218,7 +218,7 @@ export default function LinkCard({ link, count, className }: Props) {
|
||||||
width={64}
|
width={64}
|
||||||
height={64}
|
height={64}
|
||||||
alt=""
|
alt=""
|
||||||
className={`absolute w-12 duration-100 bg-white rounded-md p-1 bottom-5 right-5 select-none z-10`}
|
className={`absolute w-12 duration-100 bg-white shadow rounded-md p-1 bottom-5 right-5 select-none z-10`}
|
||||||
draggable="false"
|
draggable="false"
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
const target = e.target as HTMLElement;
|
const target = e.target as HTMLElement;
|
||||||
|
|
|
@ -92,7 +92,7 @@ export default function PreservedFormats() {
|
||||||
{link?.screenshotPath && link?.screenshotPath !== "pending" ? (
|
{link?.screenshotPath && link?.screenshotPath !== "pending" ? (
|
||||||
<div className="flex justify-between items-center pr-1 border border-neutral-content rounded-md">
|
<div className="flex justify-between items-center pr-1 border border-neutral-content rounded-md">
|
||||||
<div className="flex gap-2 items-center">
|
<div className="flex gap-2 items-center">
|
||||||
<div className="text-white bg-primary p-2 rounded-l-md">
|
<div className="bg-primary text-primary-content p-2 rounded-l-md">
|
||||||
<FontAwesomeIcon icon={faFileImage} className="w-6 h-6" />
|
<FontAwesomeIcon icon={faFileImage} className="w-6 h-6" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ export default function PreservedFormats() {
|
||||||
{link?.pdfPath && link.pdfPath !== "pending" ? (
|
{link?.pdfPath && link.pdfPath !== "pending" ? (
|
||||||
<div className="flex justify-between items-center pr-1 border border-neutral-content rounded-md">
|
<div className="flex justify-between items-center pr-1 border border-neutral-content rounded-md">
|
||||||
<div className="flex gap-2 items-center">
|
<div className="flex gap-2 items-center">
|
||||||
<div className="text-white bg-primary p-2 rounded-l-md">
|
<div className="bg-primary text-primary-content p-2 rounded-l-md">
|
||||||
<FontAwesomeIcon icon={faFilePdf} className="w-6 h-6" />
|
<FontAwesomeIcon icon={faFilePdf} className="w-6 h-6" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ export default function PreservedFormats() {
|
||||||
<div className="flex flex-col-reverse sm:flex-row gap-5 items-center justify-center">
|
<div className="flex flex-col-reverse sm:flex-row gap-5 items-center justify-center">
|
||||||
{link?.collection.ownerId === session.data?.user.id ? (
|
{link?.collection.ownerId === session.data?.user.id ? (
|
||||||
<div
|
<div
|
||||||
className={`w-full text-center bg-sky-700 p-1 rounded-md cursor-pointer select-none hover:bg-sky-600 duration-100 ${
|
className={`btn btn-accent text-white ${
|
||||||
link?.pdfPath &&
|
link?.pdfPath &&
|
||||||
link?.screenshotPath &&
|
link?.screenshotPath &&
|
||||||
link?.pdfPath !== "pending" &&
|
link?.pdfPath !== "pending" &&
|
||||||
|
@ -176,12 +176,14 @@ export default function PreservedFormats() {
|
||||||
}`}
|
}`}
|
||||||
onClick={() => updateArchive()}
|
onClick={() => updateArchive()}
|
||||||
>
|
>
|
||||||
|
<div>
|
||||||
<p>Update Preserved Formats</p>
|
<p>Update Preserved Formats</p>
|
||||||
<p className="text-xs">(Refresh Link)</p>
|
<p className="text-xs">(Refresh Link)</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
) : undefined}
|
) : undefined}
|
||||||
<Link
|
<Link
|
||||||
href={`https://web.archive.org/web/${link?.url.replace(
|
href={`https://web.archive.org/web/${link?.url?.replace(
|
||||||
/(^\w+:|^)\/\//,
|
/(^\w+:|^)\/\//,
|
||||||
""
|
""
|
||||||
)}`}
|
)}`}
|
||||||
|
|
|
@ -110,7 +110,10 @@ export default function EditCollectionModal({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button className="btn btn-accent w-fit ml-auto" onClick={submit}>
|
<button
|
||||||
|
className="btn btn-accent text-white w-fit ml-auto"
|
||||||
|
onClick={submit}
|
||||||
|
>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -180,7 +180,7 @@ export default function EditCollectionSharingModal({
|
||||||
setMemberState
|
setMemberState
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
className="btn btn-primary btn-square btn-sm h-10 w-10"
|
className="btn btn-accent text-white btn-square btn-sm h-10 w-10"
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={faUserPlus} className="w-5 h-5" />
|
<FontAwesomeIcon icon={faUserPlus} className="w-5 h-5" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -436,7 +436,7 @@ export default function EditCollectionSharingModal({
|
||||||
|
|
||||||
{permissions === true && (
|
{permissions === true && (
|
||||||
<button
|
<button
|
||||||
className="btn btn-accent w-fit ml-auto mt-3"
|
className="btn btn-accent text-white w-fit ml-auto mt-3"
|
||||||
onClick={submit}
|
onClick={submit}
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
|
|
|
@ -159,7 +159,7 @@ export default function EditLinkModal({ onClose, activeLink }: Props) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end items-center mt-5">
|
<div className="flex justify-end items-center mt-5">
|
||||||
<button className="btn btn-accent" onClick={submit}>
|
<button className="btn btn-accent text-white" onClick={submit}>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -115,7 +115,10 @@ export default function NewCollectionModal({ onClose }: Props) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button className="btn btn-accent w-fit ml-auto" onClick={submit}>
|
<button
|
||||||
|
className="btn btn-accent text-white w-fit ml-auto"
|
||||||
|
onClick={submit}
|
||||||
|
>
|
||||||
Create Collection
|
Create Collection
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -193,7 +193,7 @@ export default function NewLinkModal({ onClose }: Props) {
|
||||||
<p>{optionsExpanded ? "Hide" : "More"} Options</p>
|
<p>{optionsExpanded ? "Hide" : "More"} Options</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button className="btn btn-accent" onClick={submit}>
|
<button className="btn btn-accent text-white" onClick={submit}>
|
||||||
Create Link
|
Create Link
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -110,7 +110,6 @@ export default function UploadFileModal({ onClose }: Props) {
|
||||||
else if (file.type === "image/png") fileType = ArchivedFormat.png;
|
else if (file.type === "image/png") fileType = ArchivedFormat.png;
|
||||||
else if (file.type === "application/pdf") fileType = ArchivedFormat.pdf;
|
else if (file.type === "application/pdf") fileType = ArchivedFormat.pdf;
|
||||||
|
|
||||||
console.log(fileType);
|
|
||||||
if (fileType !== null) {
|
if (fileType !== null) {
|
||||||
setSubmitLoader(true);
|
setSubmitLoader(true);
|
||||||
|
|
||||||
|
@ -227,7 +226,7 @@ export default function UploadFileModal({ onClose }: Props) {
|
||||||
<p>{optionsExpanded ? "Hide" : "More"} Options</p>
|
<p>{optionsExpanded ? "Hide" : "More"} Options</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button className="btn btn-accent" onClick={submit}>
|
<button className="btn btn-accent text-white" onClick={submit}>
|
||||||
Create Link
|
Create Link
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default function SubmitButton({
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
type={type ? type : undefined}
|
type={type ? type : undefined}
|
||||||
className={`btn btn-primary text-white tracking-wider w-fit flex items-center gap-2 ${
|
className={`btn btn-accent text-white tracking-wider w-fit flex items-center gap-2 ${
|
||||||
className || ""
|
className || ""
|
||||||
}`}
|
}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
@ -75,7 +75,6 @@ export default async function postLink(
|
||||||
name: link.name,
|
name: link.name,
|
||||||
description,
|
description,
|
||||||
type: linkType,
|
type: linkType,
|
||||||
readabilityPath: "pending",
|
|
||||||
collection: {
|
collection: {
|
||||||
connectOrCreate: {
|
connectOrCreate: {
|
||||||
where: {
|
where: {
|
||||||
|
@ -118,11 +117,33 @@ export default async function postLink(
|
||||||
? urlHandler(newLink.id, newLink.url, userId)
|
? urlHandler(newLink.id, newLink.url, userId)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
linkType === "pdf" ? pdfHandler(newLink.id, newLink.url) : undefined;
|
newLink.url && linkType === "pdf"
|
||||||
|
? pdfHandler(newLink.id, newLink.url)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
linkType === "image"
|
newLink.url && linkType === "image"
|
||||||
? imageHandler(newLink.id, newLink.url, imageExtension)
|
? imageHandler(newLink.id, newLink.url, imageExtension)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
!newLink.url && linkType === "pdf"
|
||||||
|
? await prisma.link.update({
|
||||||
|
where: { id: newLink.id },
|
||||||
|
data: {
|
||||||
|
pdfPath: "pending",
|
||||||
|
lastPreserved: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
!newLink.url && linkType === "image"
|
||||||
|
? await prisma.link.update({
|
||||||
|
where: { id: newLink.id },
|
||||||
|
data: {
|
||||||
|
screenshotPath: "pending",
|
||||||
|
lastPreserved: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: undefined;
|
||||||
|
|
||||||
return { response: newLink, status: 200 };
|
return { response: newLink, status: 200 };
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default function App({
|
||||||
reverseOrder={false}
|
reverseOrder={false}
|
||||||
toastOptions={{
|
toastOptions={{
|
||||||
className:
|
className:
|
||||||
"border border-sky-100 dark:border-neutral-700 dark:bg-neutral-900 dark:text-white",
|
"border border-sky-100 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
|
|
|
@ -89,8 +89,6 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||||
});
|
});
|
||||||
|
|
||||||
form.parse(req, async (err, fields, files) => {
|
form.parse(req, async (err, fields, files) => {
|
||||||
console.log(files);
|
|
||||||
|
|
||||||
const allowedMIMETypes = [
|
const allowedMIMETypes = [
|
||||||
"application/pdf",
|
"application/pdf",
|
||||||
"image/png",
|
"image/png",
|
||||||
|
@ -109,17 +107,31 @@ export default async function Index(req: NextApiRequest, res: NextApiResponse) {
|
||||||
response: `Sorry, we couldn't process your file. Please ensure it's a PDF, PNG, or JPG format and doesn't exceed ${MAX_UPLOAD_SIZE}MB.`,
|
response: `Sorry, we couldn't process your file. Please ensure it's a PDF, PNG, or JPG format and doesn't exceed ${MAX_UPLOAD_SIZE}MB.`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(files.file[0].mimetype);
|
|
||||||
|
|
||||||
const fileBuffer = fs.readFileSync(files.file[0].filepath);
|
const fileBuffer = fs.readFileSync(files.file[0].filepath);
|
||||||
|
|
||||||
console.log(fileBuffer);
|
const linkStillExists = await prisma.link.findUnique({
|
||||||
|
where: { id: linkId },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (linkStillExists) {
|
||||||
await createFile({
|
await createFile({
|
||||||
filePath: `archives/${collectionPermissions?.id}/${linkId + suffix}`,
|
filePath: `archives/${collectionPermissions?.id}/${
|
||||||
|
linkId + suffix
|
||||||
|
}`,
|
||||||
data: fileBuffer,
|
data: fileBuffer,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await prisma.link.update({
|
||||||
|
where: { id: linkId },
|
||||||
|
data: {
|
||||||
|
screenshotPath: `archives/${collectionPermissions?.id}/${
|
||||||
|
linkId + suffix
|
||||||
|
}`,
|
||||||
|
lastPreserved: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
fs.unlinkSync(files.file[0].filepath);
|
fs.unlinkSync(files.file[0].filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ export default function Index() {
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<p className="text-neutral text-xs">
|
<p className="text-neutral text-sm font-semibold">
|
||||||
By {collectionOwner.name}
|
By {collectionOwner.name}
|
||||||
{activeCollection.members.length > 0
|
{activeCollection.members.length > 0
|
||||||
? ` and ${activeCollection.members.length} others`
|
? ` and ${activeCollection.members.length} others`
|
||||||
|
|
|
@ -169,7 +169,7 @@ export default function PublicCollections() {
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p className="text-neutral text-xs">
|
<p className="text-neutral text-sm font-semibold">
|
||||||
By {collectionOwner.name}
|
By {collectionOwner.name}
|
||||||
{collection.members.length > 0
|
{collection.members.length > 0
|
||||||
? ` and ${collection.members.length} others`
|
? ` and ${collection.members.length} others`
|
||||||
|
|
|
@ -6,9 +6,9 @@ module.exports = {
|
||||||
themes: [
|
themes: [
|
||||||
{
|
{
|
||||||
light: {
|
light: {
|
||||||
primary: "#0284c7",
|
primary: "#0369a1",
|
||||||
secondary: "#0891b2",
|
secondary: "#0891b2",
|
||||||
accent: "#6366f1",
|
accent: "#6d28d9",
|
||||||
neutral: "#6b7280",
|
neutral: "#6b7280",
|
||||||
"neutral-content": "#d1d5db",
|
"neutral-content": "#d1d5db",
|
||||||
"base-100": "#ffffff",
|
"base-100": "#ffffff",
|
||||||
|
@ -22,9 +22,9 @@ module.exports = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dark: {
|
dark: {
|
||||||
primary: "#38bdf8",
|
primary: "#7dd3fc",
|
||||||
secondary: "#22d3ee",
|
secondary: "#22d3ee",
|
||||||
accent: "#6366f1",
|
accent: "#6d28d9",
|
||||||
neutral: "#9ca3af",
|
neutral: "#9ca3af",
|
||||||
"neutral-content": "#404040",
|
"neutral-content": "#404040",
|
||||||
"base-100": "#171717",
|
"base-100": "#171717",
|
||||||
|
|
Ŝarĝante…
Reference in New Issue