improvements

This commit is contained in:
daniel31x13
2024-11-07 01:12:05 -05:00
parent 7eaff332a9
commit 736e98ac7d
21 changed files with 277 additions and 281 deletions
@@ -64,7 +64,7 @@ export default function LinkActions({ link, btnStyle }: Props) {
onClick={() => setLinkModal(true)}
>
<div className={clsx("btn btn-sm btn-square text-neutral", btnStyle)}>
<i title="More" className="bi-three-dots text-xl" />
<i title="More" className="bi-info-circle text-xl" />
</div>
</div>
) : (
@@ -127,22 +127,6 @@ export default function LinkActions({ link, btnStyle }: Props) {
</div>
</li>
)}
{link.type === "url" &&
(permissions === true || permissions?.canUpdate) && (
<li>
<div
role="button"
tabIndex={0}
onClick={() => {
(document?.activeElement as HTMLElement)?.blur();
updateArchive();
}}
className="whitespace-nowrap"
>
{t("refresh_preserved_formats")}
</div>
</li>
)}
{(permissions === true || permissions?.canDelete) && (
<li>
<div
@@ -146,6 +146,8 @@ export default function LinkCard({ link, columns, editMode }: Props) {
editMode &&
(permissions === true || permissions?.canCreate || permissions?.canDelete);
const isPublicRoute = router.pathname.startsWith("/public") ? true : false;
return (
<div
ref={ref}
@@ -233,7 +235,7 @@ export default function LinkCard({ link, columns, editMode }: Props) {
{/* Overlay on hover */}
<div className="absolute pointer-events-none top-0 left-0 right-0 bottom-0 bg-base-100 bg-opacity-0 group-hover:bg-opacity-20 group-focus-within:opacity-20 rounded-2xl duration-100"></div>
<LinkActions link={link} collection={collection} />
<LinkPin link={link} />
{!isPublicRoute && <LinkPin link={link} />}
</div>
);
}
@@ -14,7 +14,7 @@ export default function LinkCollection({
link: LinkIncludingShortenedCollectionAndTags;
collection: CollectionIncludingMembersAndLinkCount;
}) {
return (
return collection?.name ? (
<>
<Link
href={`/collections/${link.collection.id}`}
@@ -40,5 +40,7 @@ export default function LinkCollection({
<p className="truncate capitalize">{collection?.name}</p>
</Link>
</>
) : (
<></>
);
}
@@ -20,6 +20,7 @@ import { useUser } from "@/hooks/store/user";
import { useLinks } from "@/hooks/store/links";
import useLocalSettingsStore from "@/store/localSettings";
import LinkPin from "./LinkPin";
import { useRouter } from "next/router";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -91,6 +92,9 @@ export default function LinkCardCompact({ link, editMode }: Props) {
editMode &&
(permissions === true || permissions?.canCreate || permissions?.canDelete);
const router = useRouter();
let isPublic = router.pathname.startsWith("/public") ? true : undefined;
return (
<>
<div
@@ -135,7 +139,7 @@ export default function LinkCardCompact({ link, editMode }: Props) {
</div>
</div>
</div>
<LinkPin link={link} btnStyle="btn-ghost" />
{!isPublic && <LinkPin link={link} btnStyle="btn-ghost" />}
<LinkActions link={link} collection={collection} btnStyle="btn-ghost" />
</div>
<div className="last:hidden rounded-none my-0 mx-1 border-t border-base-300 h-[1px]"></div>
@@ -25,6 +25,7 @@ import { useGetLink, useLinks } from "@/hooks/store/links";
import useLocalSettingsStore from "@/store/localSettings";
import clsx from "clsx";
import LinkPin from "./LinkPin";
import { useRouter } from "next/router";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -108,6 +109,10 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {
const isVisible = useOnScreen(ref);
const permissions = usePermissions(collection?.id as number);
const router = useRouter();
let isPublic = router.pathname.startsWith("/public") ? true : undefined;
useEffect(() => {
let interval: NodeJS.Timeout | null = null;
@@ -241,7 +246,7 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {
{/* Overlay on hover */}
<div className="absolute pointer-events-none top-0 left-0 right-0 bottom-0 bg-base-100 bg-opacity-0 group-hover:bg-opacity-20 group-focus-within:opacity-20 rounded-2xl duration-100"></div>
<LinkActions link={link} collection={collection} />
<LinkPin link={link} />
{!isPublic && <LinkPin link={link} />}
</div>
);
}