recreated the rest of the dropdowns using daisyui
This commit is contained in:
parent
64a1f352cf
commit
bef8ad976d
|
@ -65,29 +65,26 @@ export default function CollectionCard({ collection, className }: Props) {
|
||||||
role="button"
|
role="button"
|
||||||
className="btn btn-ghost btn-sm btn-square text-neutral"
|
className="btn btn-ghost btn-sm btn-square text-neutral"
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon icon={faEllipsis} title="More" className="w-5 h-5" />
|
||||||
icon={faEllipsis}
|
|
||||||
title="More"
|
|
||||||
className="w-5 h-5"
|
|
||||||
id={"expand-dropdown" + collection.id}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<ul className="dropdown-content z-[1] menu p-2 shadow bg-base-200 border border-neutral-content rounded-box w-52 mt-1">
|
<ul className="dropdown-content z-[1] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-44 mt-1">
|
||||||
{permissions === true ? (
|
{permissions === true ? (
|
||||||
<li>
|
<li>
|
||||||
<div
|
<div
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
collection &&
|
collection &&
|
||||||
setModal({
|
setModal({
|
||||||
modal: "COLLECTION",
|
modal: "COLLECTION",
|
||||||
state: true,
|
state: true,
|
||||||
method: "UPDATE",
|
method: "UPDATE",
|
||||||
isOwner: permissions === true,
|
isOwner: permissions === true,
|
||||||
active: collection,
|
active: collection,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
>
|
>
|
||||||
Edit Collection Info
|
Edit Collection Info
|
||||||
</div>
|
</div>
|
||||||
|
@ -95,38 +92,42 @@ export default function CollectionCard({ collection, className }: Props) {
|
||||||
) : undefined}
|
) : undefined}
|
||||||
<li>
|
<li>
|
||||||
<div
|
<div
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
collection &&
|
collection &&
|
||||||
setModal({
|
setModal({
|
||||||
modal: "COLLECTION",
|
modal: "COLLECTION",
|
||||||
state: true,
|
state: true,
|
||||||
method: "UPDATE",
|
method: "UPDATE",
|
||||||
isOwner: permissions === true,
|
isOwner: permissions === true,
|
||||||
active: collection,
|
active: collection,
|
||||||
defaultIndex: permissions === true ? 1 : 0,
|
defaultIndex: permissions === true ? 1 : 0,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
>
|
>
|
||||||
{permissions === true ? "Share and Collaborate" : "View Team"}
|
{permissions === true ? "Share and Collaborate" : "View Team"}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div
|
<div
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
collection &&
|
collection &&
|
||||||
setModal({
|
setModal({
|
||||||
modal: "COLLECTION",
|
modal: "COLLECTION",
|
||||||
state: true,
|
state: true,
|
||||||
method: "UPDATE",
|
method: "UPDATE",
|
||||||
isOwner: permissions === true,
|
isOwner: permissions === true,
|
||||||
active: collection,
|
active: collection,
|
||||||
defaultIndex: permissions === true ? 2 : 1,
|
defaultIndex: permissions === true ? 2 : 1,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
>
|
>
|
||||||
{permissions === true ? "Delete Collection" : "Leave Collection"}
|
{permissions === true ? "Delete Collection" : "Leave Collection"}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import React, { SetStateAction } from "react";
|
import React from "react";
|
||||||
import ClickAwayHandler from "./ClickAwayHandler";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import Checkbox from "./Checkbox";
|
import { faFilter } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
setFilterDropdown: (value: SetStateAction<boolean>) => void;
|
|
||||||
setSearchFilter: Function;
|
setSearchFilter: Function;
|
||||||
searchFilter: {
|
searchFilter: {
|
||||||
name: boolean;
|
name: boolean;
|
||||||
|
@ -15,62 +14,123 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function FilterSearchDropdown({
|
export default function FilterSearchDropdown({
|
||||||
setFilterDropdown,
|
|
||||||
setSearchFilter,
|
setSearchFilter,
|
||||||
searchFilter,
|
searchFilter,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
return (
|
return (
|
||||||
<ClickAwayHandler
|
<div className="dropdown dropdown-bottom dropdown-end">
|
||||||
onClickOutside={(e: Event) => {
|
<div
|
||||||
const target = e.target as HTMLInputElement;
|
tabIndex={0}
|
||||||
if (target.id !== "filter-dropdown") setFilterDropdown(false);
|
role="button"
|
||||||
}}
|
className="btn btn-sm btn-square btn-ghost"
|
||||||
className="absolute top-8 right-0 border border-neutral-content shadow-md bg-base-200 rounded-md p-2 z-20 w-40"
|
>
|
||||||
>
|
<FontAwesomeIcon
|
||||||
<p className="mb-2 text-center font-semibold">Filter by</p>
|
icon={faFilter}
|
||||||
<div className="flex flex-col gap-2">
|
id="sort-dropdown"
|
||||||
<Checkbox
|
className="w-5 h-5 text-neutral"
|
||||||
label="Name"
|
|
||||||
state={searchFilter.name}
|
|
||||||
onClick={() =>
|
|
||||||
setSearchFilter({ ...searchFilter, name: !searchFilter.name })
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Checkbox
|
|
||||||
label="Link"
|
|
||||||
state={searchFilter.url}
|
|
||||||
onClick={() =>
|
|
||||||
setSearchFilter({ ...searchFilter, url: !searchFilter.url })
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Checkbox
|
|
||||||
label="Description"
|
|
||||||
state={searchFilter.description}
|
|
||||||
onClick={() =>
|
|
||||||
setSearchFilter({
|
|
||||||
...searchFilter,
|
|
||||||
description: !searchFilter.description,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Checkbox
|
|
||||||
label="Full Content"
|
|
||||||
state={searchFilter.textContent}
|
|
||||||
onClick={() =>
|
|
||||||
setSearchFilter({
|
|
||||||
...searchFilter,
|
|
||||||
textContent: !searchFilter.textContent,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Checkbox
|
|
||||||
label="Tags"
|
|
||||||
state={searchFilter.tags}
|
|
||||||
onClick={() =>
|
|
||||||
setSearchFilter({ ...searchFilter, tags: !searchFilter.tags })
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</ClickAwayHandler>
|
<ul className="dropdown-content z-[30] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-52 mt-1">
|
||||||
|
<li>
|
||||||
|
<label
|
||||||
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="search-filter-checkbox"
|
||||||
|
className="checkbox checkbox-primary [--chkfg:white]"
|
||||||
|
checked={searchFilter.name}
|
||||||
|
onChange={() => {
|
||||||
|
setSearchFilter({ ...searchFilter, name: !searchFilter.name });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="label-text">Name</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label
|
||||||
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="search-filter-checkbox"
|
||||||
|
className="checkbox checkbox-primary [--chkfg:white]"
|
||||||
|
checked={searchFilter.url}
|
||||||
|
onChange={() => {
|
||||||
|
setSearchFilter({ ...searchFilter, url: !searchFilter.url });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="label-text">Link</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label
|
||||||
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="search-filter-checkbox"
|
||||||
|
className="checkbox checkbox-primary [--chkfg:white]"
|
||||||
|
checked={searchFilter.description}
|
||||||
|
onChange={() => {
|
||||||
|
setSearchFilter({
|
||||||
|
...searchFilter,
|
||||||
|
description: !searchFilter.description,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="label-text">Description</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label
|
||||||
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="search-filter-checkbox"
|
||||||
|
className="checkbox checkbox-primary [--chkfg:white]"
|
||||||
|
checked={searchFilter.textContent}
|
||||||
|
onChange={() => {
|
||||||
|
setSearchFilter({
|
||||||
|
...searchFilter,
|
||||||
|
textContent: !searchFilter.textContent,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="label-text">Full Content</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label
|
||||||
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="search-filter-checkbox"
|
||||||
|
className="checkbox checkbox-primary [--chkfg:white]"
|
||||||
|
checked={searchFilter.tags}
|
||||||
|
onChange={() => {
|
||||||
|
setSearchFilter({
|
||||||
|
...searchFilter,
|
||||||
|
tags: !searchFilter.tags,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="label-text">Tags</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,24 +142,94 @@ export default function LinkCard({ link, count, className }: Props) {
|
||||||
className || ""
|
className || ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{(permissions === true ||
|
{permissions === true ||
|
||||||
permissions?.canUpdate ||
|
permissions?.canUpdate ||
|
||||||
permissions?.canDelete) && (
|
permissions?.canDelete ? (
|
||||||
<div
|
<div className="dropdown dropdown-left dropdown-start absolute top-3 right-3 z-20">
|
||||||
onClick={(e) => {
|
<div
|
||||||
setExpandDropdown({ x: e.clientX, y: e.clientY });
|
tabIndex={0}
|
||||||
}}
|
role="button"
|
||||||
id={"expand-dropdown" + link.id}
|
className="btn btn-ghost btn-sm btn-square text-neutral"
|
||||||
className="btn btn-ghost btn-sm btn-square absolute right-4 top-4 z-10"
|
>
|
||||||
>
|
<FontAwesomeIcon
|
||||||
<FontAwesomeIcon
|
icon={faEllipsis}
|
||||||
icon={faEllipsis}
|
title="More"
|
||||||
title="More"
|
className="w-5 h-5"
|
||||||
className="w-5 h-5"
|
id={"expand-dropdown" + collection.id}
|
||||||
id={"expand-dropdown" + link.id}
|
/>
|
||||||
/>
|
</div>
|
||||||
|
<ul className="dropdown-content z-[1] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-40 mr-1">
|
||||||
|
{permissions === true ? (
|
||||||
|
<li>
|
||||||
|
<div
|
||||||
|
role="button"
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
pinLink();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{link?.pinnedBy && link.pinnedBy[0]
|
||||||
|
? "Unpin"
|
||||||
|
: "Pin to Dashboard"}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
) : undefined}
|
||||||
|
{permissions === true || permissions?.canUpdate ? (
|
||||||
|
<li>
|
||||||
|
<div
|
||||||
|
role="button"
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
collection &&
|
||||||
|
setModal({
|
||||||
|
modal: "LINK",
|
||||||
|
state: true,
|
||||||
|
method: "UPDATE",
|
||||||
|
active: link,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
) : undefined}
|
||||||
|
{permissions === true ? (
|
||||||
|
<li>
|
||||||
|
<div
|
||||||
|
role="button"
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
updateArchive();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Refresh Link
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
) : undefined}
|
||||||
|
{permissions === true || permissions?.canDelete ? (
|
||||||
|
<li>
|
||||||
|
<div
|
||||||
|
role="button"
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
deleteLink();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
) : undefined}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
)}
|
) : undefined}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
onClick={() => router.push("/links/" + link.id)}
|
onClick={() => router.push("/links/" + link.id)}
|
||||||
|
@ -244,54 +314,6 @@ export default function LinkCard({ link, count, className }: Props) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{expandDropdown ? (
|
|
||||||
<Dropdown
|
|
||||||
points={{ x: expandDropdown.x, y: expandDropdown.y }}
|
|
||||||
items={[
|
|
||||||
permissions === true
|
|
||||||
? {
|
|
||||||
name:
|
|
||||||
link?.pinnedBy && link.pinnedBy[0]
|
|
||||||
? "Unpin"
|
|
||||||
: "Pin to Dashboard",
|
|
||||||
onClick: pinLink,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
permissions === true || permissions?.canUpdate
|
|
||||||
? {
|
|
||||||
name: "Edit",
|
|
||||||
onClick: () => {
|
|
||||||
setModal({
|
|
||||||
modal: "LINK",
|
|
||||||
state: true,
|
|
||||||
method: "UPDATE",
|
|
||||||
active: link,
|
|
||||||
});
|
|
||||||
setExpandDropdown(false);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
permissions === true
|
|
||||||
? {
|
|
||||||
name: "Refresh Link",
|
|
||||||
onClick: updateArchive,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
permissions === true || permissions?.canDelete
|
|
||||||
? {
|
|
||||||
name: "Delete",
|
|
||||||
onClick: deleteLink,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
]}
|
|
||||||
onClickOutside={(e: Event) => {
|
|
||||||
const target = e.target as HTMLInputElement;
|
|
||||||
if (target.id !== "expand-dropdown" + link.id)
|
|
||||||
setExpandDropdown(false);
|
|
||||||
}}
|
|
||||||
className="w-40"
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,10 +75,14 @@ export default function Navbar() {
|
||||||
<FontAwesomeIcon icon={faCaretDown} className="w-3 h-3" />
|
<FontAwesomeIcon icon={faCaretDown} className="w-3 h-3" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul className="dropdown-content z-[1] menu p-2 shadow bg-base-200 border border-neutral-content rounded-box w-40 mt-1">
|
<ul className="dropdown-content z-[1] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-32 mt-1">
|
||||||
<li>
|
<li>
|
||||||
<div
|
<div
|
||||||
onClick={() => setNewLinkModalIsOpen(true)}
|
className="px-2 py-1 rounded-lg"
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
setNewLinkModalIsOpen(true);
|
||||||
|
}}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
@ -87,7 +91,11 @@ export default function Navbar() {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div
|
<div
|
||||||
onClick={() => setNewCollectionModalIsOpen(true)}
|
className="px-2 py-1 rounded-lg"
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
setNewCollectionModalIsOpen(true);
|
||||||
|
}}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
@ -105,19 +113,41 @@ export default function Navbar() {
|
||||||
className=""
|
className=""
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ul className="dropdown-content z-[1] menu p-2 shadow bg-base-200 border border-neutral-content rounded-box w-52 mt-1">
|
<ul className="dropdown-content z-[1] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-40 mt-1">
|
||||||
<li>
|
<li>
|
||||||
<Link href="/settings/account" tabIndex={0} role="button">
|
<Link
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
href="/settings/account"
|
||||||
|
onClick={() => (document?.activeElement as HTMLElement)?.blur()}
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
Settings
|
Settings
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div onClick={handleToggle} tabIndex={0} role="button">
|
<div
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
handleToggle();
|
||||||
|
}}
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
Switch to {settings.theme === "light" ? "Dark" : "Light"}
|
Switch to {settings.theme === "light" ? "Dark" : "Light"}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div onClick={() => signOut()} tabIndex={0} role="button">
|
<div
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
signOut();
|
||||||
|
}}
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
Logout
|
Logout
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default function SortDropdown({ sortBy, setSort }: Props) {
|
||||||
<div
|
<div
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
className="btn btn-sm btn-square btn-ghost m-1"
|
className="btn btn-sm btn-square btn-ghost"
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faSort}
|
icon={faSort}
|
||||||
|
@ -22,10 +22,10 @@ export default function SortDropdown({ sortBy, setSort }: Props) {
|
||||||
className="w-5 h-5 text-neutral"
|
className="w-5 h-5 text-neutral"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ul className="dropdown-content z-[20] menu p-2 shadow bg-base-200 border border-neutral-content rounded-box w-52">
|
<ul className="dropdown-content z-[30] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-52 mt-1">
|
||||||
<li>
|
<li>
|
||||||
<label
|
<label
|
||||||
className="label cursor-pointer flex justify-start"
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
@ -35,14 +35,16 @@ export default function SortDropdown({ sortBy, setSort }: Props) {
|
||||||
className="radio checked:bg-primary"
|
className="radio checked:bg-primary"
|
||||||
value="Date (Newest First)"
|
value="Date (Newest First)"
|
||||||
checked={sortBy === Sort.DateNewestFirst}
|
checked={sortBy === Sort.DateNewestFirst}
|
||||||
onChange={() => setSort(Sort.DateNewestFirst)}
|
onChange={() => {
|
||||||
|
setSort(Sort.DateNewestFirst);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<span className="label-text">Date (Newest First)</span>
|
<span className="label-text">Date (Newest First)</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label
|
<label
|
||||||
className="label cursor-pointer flex justify-start"
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
@ -59,7 +61,7 @@ export default function SortDropdown({ sortBy, setSort }: Props) {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label
|
<label
|
||||||
className="label cursor-pointer flex justify-start"
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
@ -76,7 +78,7 @@ export default function SortDropdown({ sortBy, setSort }: Props) {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label
|
<label
|
||||||
className="label cursor-pointer flex justify-start"
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
@ -93,7 +95,7 @@ export default function SortDropdown({ sortBy, setSort }: Props) {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label
|
<label
|
||||||
className="label cursor-pointer flex justify-start"
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
@ -110,7 +112,7 @@ export default function SortDropdown({ sortBy, setSort }: Props) {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label
|
<label
|
||||||
className="label cursor-pointer flex justify-start"
|
className="label cursor-pointer flex justify-start px-2 py-1 rounded-lg"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import Dropdown from "@/components/Dropdown";
|
|
||||||
import LinkCard from "@/components/LinkCard";
|
import LinkCard from "@/components/LinkCard";
|
||||||
import useCollectionStore from "@/store/collections";
|
import useCollectionStore from "@/store/collections";
|
||||||
import useLinkStore from "@/store/links";
|
import useLinkStore from "@/store/links";
|
||||||
|
@ -26,7 +25,6 @@ export default function Index() {
|
||||||
const { links } = useLinkStore();
|
const { links } = useLinkStore();
|
||||||
const { collections } = useCollectionStore();
|
const { collections } = useCollectionStore();
|
||||||
|
|
||||||
const [expandDropdown, setExpandDropdown] = useState(false);
|
|
||||||
const [sortBy, setSortBy] = useState<Sort>(Sort.DateNewestFirst);
|
const [sortBy, setSortBy] = useState<Sort>(Sort.DateNewestFirst);
|
||||||
|
|
||||||
const [activeCollection, setActiveCollection] =
|
const [activeCollection, setActiveCollection] =
|
||||||
|
@ -118,47 +116,50 @@ export default function Index() {
|
||||||
<div className="flex justify-between items-end gap-5">
|
<div className="flex justify-between items-end gap-5">
|
||||||
<p>{activeCollection?.description}</p>
|
<p>{activeCollection?.description}</p>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
|
<SortDropdown sortBy={sortBy} setSort={setSortBy} />
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<SortDropdown sortBy={sortBy} setSort={setSortBy} />
|
<div className="dropdown dropdown-bottom dropdown-end">
|
||||||
</div>
|
<div
|
||||||
<div className="relative">
|
tabIndex={0}
|
||||||
<div
|
role="button"
|
||||||
onClick={() => setExpandDropdown(!expandDropdown)}
|
className="btn btn-ghost btn-sm btn-square text-neutral"
|
||||||
id="expand-dropdown"
|
>
|
||||||
className="btn btn-ghost btn-square btn-sm"
|
<FontAwesomeIcon
|
||||||
>
|
icon={faEllipsis}
|
||||||
<FontAwesomeIcon
|
title="More"
|
||||||
icon={faEllipsis}
|
className="w-5 h-5"
|
||||||
id="expand-dropdown"
|
/>
|
||||||
title="More"
|
</div>
|
||||||
className="w-5 h-5 text-neutral"
|
<ul className="dropdown-content z-[30] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-44 mt-1">
|
||||||
/>
|
{permissions === true ? (
|
||||||
</div>
|
<li>
|
||||||
{expandDropdown ? (
|
<div
|
||||||
<Dropdown
|
className="px-2 py-1 rounded-lg"
|
||||||
items={[
|
role="button"
|
||||||
permissions === true
|
tabIndex={0}
|
||||||
? {
|
onClick={() => {
|
||||||
name: "Edit Collection Info",
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
onClick: () => {
|
activeCollection &&
|
||||||
activeCollection &&
|
setModal({
|
||||||
setModal({
|
modal: "COLLECTION",
|
||||||
modal: "COLLECTION",
|
state: true,
|
||||||
state: true,
|
method: "UPDATE",
|
||||||
method: "UPDATE",
|
isOwner: permissions === true,
|
||||||
isOwner: permissions === true,
|
active: activeCollection,
|
||||||
active: activeCollection,
|
});
|
||||||
});
|
}}
|
||||||
setExpandDropdown(false);
|
>
|
||||||
},
|
Edit Collection Info
|
||||||
}
|
</div>
|
||||||
: undefined,
|
</li>
|
||||||
{
|
) : undefined}
|
||||||
name:
|
<li>
|
||||||
permissions === true
|
<div
|
||||||
? "Share/Collaborate"
|
className="px-2 py-1 rounded-lg"
|
||||||
: "View Team",
|
role="button"
|
||||||
onClick: () => {
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
activeCollection &&
|
activeCollection &&
|
||||||
setModal({
|
setModal({
|
||||||
modal: "COLLECTION",
|
modal: "COLLECTION",
|
||||||
|
@ -168,16 +169,20 @@ export default function Index() {
|
||||||
active: activeCollection,
|
active: activeCollection,
|
||||||
defaultIndex: permissions === true ? 1 : 0,
|
defaultIndex: permissions === true ? 1 : 0,
|
||||||
});
|
});
|
||||||
setExpandDropdown(false);
|
}}
|
||||||
},
|
>
|
||||||
},
|
{permissions === true
|
||||||
|
? "Share and Collaborate"
|
||||||
{
|
: "View Team"}
|
||||||
name:
|
</div>
|
||||||
permissions === true
|
</li>
|
||||||
? "Delete Collection"
|
<li>
|
||||||
: "Leave Collection",
|
<div
|
||||||
onClick: () => {
|
className="px-2 py-1 rounded-lg"
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
activeCollection &&
|
activeCollection &&
|
||||||
setModal({
|
setModal({
|
||||||
modal: "COLLECTION",
|
modal: "COLLECTION",
|
||||||
|
@ -187,18 +192,15 @@ export default function Index() {
|
||||||
active: activeCollection,
|
active: activeCollection,
|
||||||
defaultIndex: permissions === true ? 2 : 1,
|
defaultIndex: permissions === true ? 2 : 1,
|
||||||
});
|
});
|
||||||
setExpandDropdown(false);
|
}}
|
||||||
},
|
>
|
||||||
},
|
{permissions === true
|
||||||
]}
|
? "Delete Collection"
|
||||||
onClickOutside={(e: Event) => {
|
: "Leave Collection"}
|
||||||
const target = e.target as HTMLInputElement;
|
</div>
|
||||||
if (target.id !== "expand-dropdown")
|
</li>
|
||||||
setExpandDropdown(false);
|
</ul>
|
||||||
}}
|
</div>
|
||||||
className="absolute top-8 right-0 z-10 w-44"
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -50,41 +50,38 @@ export default function Collections() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative mt-2">
|
<div className="relative mt-2">
|
||||||
<div
|
<div className="dropdown dropdown-bottom">
|
||||||
onClick={() => setExpandDropdown(!expandDropdown)}
|
<div
|
||||||
id="expand-dropdown"
|
tabIndex={0}
|
||||||
className="btn btn-ghost btn-square btn-sm"
|
role="button"
|
||||||
>
|
className="btn btn-ghost btn-sm btn-square text-neutral"
|
||||||
<FontAwesomeIcon
|
>
|
||||||
icon={faEllipsis}
|
<FontAwesomeIcon
|
||||||
id="expand-dropdown"
|
icon={faEllipsis}
|
||||||
className="w-5 h-5 text-neutral"
|
title="More"
|
||||||
/>
|
className="w-5 h-5"
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
{expandDropdown ? (
|
<ul className="dropdown-content z-[1] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-40 mt-1">
|
||||||
<Dropdown
|
<li>
|
||||||
items={[
|
<div
|
||||||
{
|
className="px-2 py-1 rounded-lg"
|
||||||
name: "New Collection",
|
role="button"
|
||||||
onClick: () => {
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
setModal({
|
setModal({
|
||||||
modal: "COLLECTION",
|
modal: "COLLECTION",
|
||||||
state: true,
|
state: true,
|
||||||
method: "CREATE",
|
method: "CREATE",
|
||||||
});
|
});
|
||||||
setExpandDropdown(false);
|
}}
|
||||||
},
|
>
|
||||||
},
|
New Collection
|
||||||
]}
|
</div>
|
||||||
onClickOutside={(e: Event) => {
|
</li>
|
||||||
const target = e.target as HTMLInputElement;
|
</ul>
|
||||||
if (target.id !== "expand-dropdown")
|
</div>
|
||||||
setExpandDropdown(false);
|
|
||||||
}}
|
|
||||||
className="absolute top-8 sm:left-0 right-0 sm:right-auto w-36"
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -217,9 +217,13 @@ export default function Dashboard() {
|
||||||
Import Your Bookmarks
|
Import Your Bookmarks
|
||||||
</span>
|
</span>
|
||||||
</summary>
|
</summary>
|
||||||
<ul className="shadow menu dropdown-content z-[1] bg-base-200 border border-neutral-content rounded-box w-60">
|
<ul className="shadow menu dropdown-content z-[1] p-1 bg-base-200 border border-neutral-content rounded-xl mt-1 w-60">
|
||||||
<li>
|
<li>
|
||||||
<label htmlFor="import-linkwarden-file" title="JSON File">
|
<label
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
htmlFor="import-linkwarden-file"
|
||||||
|
title="JSON File"
|
||||||
|
>
|
||||||
From Linkwarden
|
From Linkwarden
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
|
@ -235,9 +239,9 @@ export default function Dashboard() {
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label
|
<label
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
htmlFor="import-html-file"
|
htmlFor="import-html-file"
|
||||||
title="HTML File"
|
title="HTML File"
|
||||||
className="w-full"
|
|
||||||
>
|
>
|
||||||
From Bookmarks HTML file
|
From Bookmarks HTML file
|
||||||
<input
|
<input
|
||||||
|
|
|
@ -16,8 +16,6 @@ import getPublicUserData from "@/lib/client/getPublicUserData";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import PublicSearchBar from "@/components/PublicPage/PublicSearchBar";
|
import PublicSearchBar from "@/components/PublicPage/PublicSearchBar";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
||||||
import { faFilter } from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import FilterSearchDropdown from "@/components/FilterSearchDropdown";
|
import FilterSearchDropdown from "@/components/FilterSearchDropdown";
|
||||||
import SortDropdown from "@/components/SortDropdown";
|
import SortDropdown from "@/components/SortDropdown";
|
||||||
import useLocalSettingsStore from "@/store/localSettings";
|
import useLocalSettingsStore from "@/store/localSettings";
|
||||||
|
@ -206,27 +204,12 @@ export default function PublicCollections() {
|
||||||
placeHolder={`Search ${collection._count?.links} Links`}
|
placeHolder={`Search ${collection._count?.links} Links`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="flex gap-3 items-center">
|
<div className="flex gap-2 items-center">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div
|
<FilterSearchDropdown
|
||||||
onClick={() => setFilterDropdown(!filterDropdown)}
|
searchFilter={searchFilter}
|
||||||
id="filter-dropdown"
|
setSearchFilter={setSearchFilter}
|
||||||
className="btn btn-ghost btn-square btn-sm"
|
/>
|
||||||
>
|
|
||||||
<FontAwesomeIcon
|
|
||||||
icon={faFilter}
|
|
||||||
id="filter-dropdown"
|
|
||||||
className="w-5 h-5 text-neutral"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{filterDropdown ? (
|
|
||||||
<FilterSearchDropdown
|
|
||||||
setFilterDropdown={setFilterDropdown}
|
|
||||||
searchFilter={searchFilter}
|
|
||||||
setSearchFilter={setSearchFilter}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
|
|
|
@ -52,27 +52,12 @@ export default function Search() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-3 items-center">
|
<div className="flex gap-2 items-center">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div
|
<FilterSearchDropdown
|
||||||
onClick={() => setFilterDropdown(!filterDropdown)}
|
searchFilter={searchFilter}
|
||||||
id="filter-dropdown"
|
setSearchFilter={setSearchFilter}
|
||||||
className="btn btn-ghost btn-square btn-sm"
|
/>
|
||||||
>
|
|
||||||
<FontAwesomeIcon
|
|
||||||
icon={faFilter}
|
|
||||||
id="filter-dropdown"
|
|
||||||
className="w-5 h-5 text-neutral"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{filterDropdown ? (
|
|
||||||
<FilterSearchDropdown
|
|
||||||
setFilterDropdown={setFilterDropdown}
|
|
||||||
searchFilter={searchFilter}
|
|
||||||
setSearchFilter={setSearchFilter}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
|
|
|
@ -147,16 +147,46 @@ export default function Index() {
|
||||||
{activeTag?.name}
|
{activeTag?.name}
|
||||||
</p>
|
</p>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div
|
<div className="dropdown dropdown-bottom font-normal">
|
||||||
onClick={() => setExpandDropdown(!expandDropdown)}
|
<div
|
||||||
id="expand-dropdown"
|
tabIndex={0}
|
||||||
className="btn btn-ghost btn-square btn-sm"
|
role="button"
|
||||||
>
|
className="btn btn-ghost btn-sm btn-square text-neutral"
|
||||||
<FontAwesomeIcon
|
>
|
||||||
icon={faEllipsis}
|
<FontAwesomeIcon
|
||||||
id="expand-dropdown"
|
icon={faEllipsis}
|
||||||
className="w-5 h-5 text-neutral"
|
title="More"
|
||||||
/>
|
className="w-5 h-5"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<ul className="dropdown-content z-[30] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-36 mt-1">
|
||||||
|
<li>
|
||||||
|
<div
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
setRenameTag(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Rename Tag
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div
|
||||||
|
className="px-2 py-1 rounded-lg"
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
onClick={() => {
|
||||||
|
(document?.activeElement as HTMLElement)?.blur();
|
||||||
|
remove();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Remove Tag
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{expandDropdown ? (
|
{expandDropdown ? (
|
||||||
|
|
Ŝarĝante…
Reference in New Issue