Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

refactor(web): use the new button component for consistency and improved styling

daniel31x13e668b67a3de2
diff --git a/apps/web/components/Announcement.tsx b/apps/web/components/Announcement.tsx
index 03540e38..bf7bcb8b 100644
--- a/apps/web/components/Announcement.tsx
+++ b/apps/web/components/Announcement.tsx
@@ -1,6 +1,7 @@
import Link from "next/link";
import React, { MouseEventHandler } from "react";
import { Trans } from "next-i18next";
+import { Button } from "./ui/button";
type Props = {
toggleAnnouncementBar: MouseEventHandler<HTMLButtonElement>;
@@ -27,12 +28,9 @@ export default function Announcement({ toggleAnnouncementBar }: Props) {
]}
/>
</p>
- <button
- onClick={toggleAnnouncementBar}
- className="btn btn-ghost btn-square btn-sm"
- >
+ <Button variant="ghost" size="icon" onClick={toggleAnnouncementBar}>
<i className="bi-x text-xl"></i>
- </button>
+ </Button>
</div>
</div>
);
diff --git a/apps/web/components/CollectionCard.tsx b/apps/web/components/CollectionCard.tsx
index d9dace99..a2d4e8b4 100644
--- a/apps/web/components/CollectionCard.tsx
+++ b/apps/web/components/CollectionCard.tsx
@@ -20,6 +20,7 @@ import {
DropdownMenuItem,
DropdownMenuSeparator,
} from "@/components/ui/dropdown-menu";
+import { Button } from "./ui/button";
export default function CollectionCard({
collection,
@@ -75,16 +76,20 @@ export default function CollectionCard({
<div className="relative">
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <button className="absolute top-3 right-3 z-20 btn btn-ghost btn-sm btn-square text-neutral">
+ <Button
+ variant="ghost"
+ size="icon"
+ className="absolute top-3 right-3 z-20"
+ >
<i title="More" className="bi-three-dots text-xl" />
- </button>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent
sideOffset={4}
side="bottom"
align="end"
- className="mt-1 z-[30]"
+ className="z-[30]"
>
{permissions === true && (
<DropdownMenuItem onSelect={() => setEditCollectionModal(true)}>
@@ -120,8 +125,9 @@ export default function CollectionCard({
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
+
<div
- className="flex items-center absolute bottom-3 left-3 z-10 btn px-2 btn-ghost rounded-full"
+ className="flex items-center absolute bottom-3 left-3 z-10 px-1 py-1 rounded-full cursor-pointer hover:bg-base-content/20 transition-colors duration-200"
onClick={() => setEditCollectionSharingModal(true)}
>
{collectionOwner.id && (
diff --git a/apps/web/components/CopyButton.tsx b/apps/web/components/CopyButton.tsx
index cf1ad50b..bcfeba0b 100644
--- a/apps/web/components/CopyButton.tsx
+++ b/apps/web/components/CopyButton.tsx
@@ -1,4 +1,5 @@
import React, { useState } from "react";
+import { Button } from "./ui/button";
type Props = {
text: string;
@@ -20,11 +21,7 @@ const CopyButton: React.FC<Props> = ({ text }) => {
};
return (
- <button
- type="button"
- className="text-xl text-neutral btn btn-sm btn-square btn-ghost"
- onClick={handleCopy}
- >
+ <Button variant="ghost" type="button" size="icon" onClick={handleCopy}>
{copied ? (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -56,7 +53,7 @@ const CopyButton: React.FC<Props> = ({ text }) => {
/>
</svg>
)}
- </button>
+ </Button>
);
};
diff --git a/apps/web/components/IconPicker.tsx b/apps/web/components/IconPicker.tsx
index 1f2fd0b8..68e52eb9 100644
--- a/apps/web/components/IconPicker.tsx
+++ b/apps/web/components/IconPicker.tsx
@@ -1,13 +1,10 @@
import React, { useState } from "react";
-import TextInput from "./TextInput";
-import Popover from "./Popover";
-import { HexColorPicker } from "react-colorful";
import { useTranslation } from "next-i18next";
import Icon from "./Icon";
import { IconWeight } from "@phosphor-icons/react";
-import IconGrid from "./IconGrid";
import IconPopover from "./IconPopover";
import clsx from "clsx";
+import { Button } from "./ui/button";
type Props = {
alignment?: string;
@@ -39,9 +36,11 @@ const IconPicker = ({
return (
<div className="relative">
- <div
+ <Button
onClick={() => setIconPicker(!iconPicker)}
- className="btn btn-square w-20 h-20"
+ variant="ghost"
+ className="w-20 h-20"
+ size="icon"
>
{iconName ? (
<Icon
@@ -55,7 +54,7 @@ const IconPicker = ({
) : (
<i className="bi-folder-fill text-6xl" style={{ color: color }}></i>
)}
- </div>
+ </Button>
{iconPicker && (
<IconPopover
alignment={alignment}
diff --git a/apps/web/components/IconPopover.tsx b/apps/web/components/IconPopover.tsx
index 553ead4a..42cc0f5a 100644
--- a/apps/web/components/IconPopover.tsx
+++ b/apps/web/components/IconPopover.tsx
@@ -6,7 +6,7 @@ import { HexColorPicker } from "react-colorful";
import { useTranslation } from "next-i18next";
import IconGrid from "./IconGrid";
import clsx from "clsx";
-import useWindowDimensions from "@/hooks/useWindowDimensions";
+import { Button } from "./ui/button";
type Props = {
alignment?: string;
@@ -139,12 +139,9 @@ const IconPopover = ({
</div>
</div>
<div className="flex flex-row gap-2 justify-between items-center mt-2">
- <div
- className="btn btn-ghost btn-xs w-fit"
- onClick={reset as React.MouseEventHandler<HTMLDivElement>}
- >
+ <Button size="sm" variant="ghost" onClick={() => reset()}>
{t("reset_defaults")}
- </div>
+ </Button>
<p className="text-neutral text-xs">{t("click_out_to_apply")}</p>
</div>
</div>
diff --git a/apps/web/components/InputSelect/TagSelection.tsx b/apps/web/components/InputSelect/TagSelection.tsx
index 3d818f0b..9ed81419 100644
--- a/apps/web/components/InputSelect/TagSelection.tsx
+++ b/apps/web/components/InputSelect/TagSelection.tsx
@@ -41,7 +41,7 @@ export default function TagSelection({
return (
<CreatableSelect
isClearable={false}
- className="react-select-container"
+ className="react-select-container text-sm"
classNamePrefix="react-select"
onChange={onChange}
options={isArchivalSelection ? options : tagOptions}
diff --git a/apps/web/components/InstallApp.tsx b/apps/web/components/InstallApp.tsx
index 647fb037..0d6dda64 100644
--- a/apps/web/components/InstallApp.tsx
+++ b/apps/web/components/InstallApp.tsx
@@ -1,6 +1,7 @@
import { isPWA } from "@/lib/utils";
import React, { useState } from "react";
import { Trans } from "next-i18next";
+import { Button } from "./ui/button";
type Props = {};
@@ -38,12 +39,9 @@ const InstallApp = (props: Props) => {
]}
/>
</p>
- <button
- onClick={() => setIsOpen(false)}
- className="btn btn-ghost btn-square btn-sm"
- >
+ <Button onClick={() => setIsOpen(false)} variant="ghost" size="icon">
<i className="bi-x text-xl"></i>
- </button>
+ </Button>
</div>
</div>
) : (
diff --git a/apps/web/components/LinkDetails.tsx b/apps/web/components/LinkDetails.tsx
index cf044c52..5a981fc7 100644
--- a/apps/web/components/LinkDetails.tsx
+++ b/apps/web/components/LinkDetails.tsx
@@ -33,6 +33,7 @@ import IconPopover from "./IconPopover";
import TextInput from "./TextInput";
import usePermissions from "@/hooks/usePermissions";
import oklchVariableToHex from "@/lib/client/oklchVariableToHex";
+import { Button } from "./ui/button";
type Props = {
className?: string;
@@ -224,39 +225,44 @@ export default function LinkDetails({
(permissions === true || permissions?.canUpdate) &&
!isPublicRoute && (
<div className="absolute top-0 bottom-0 left-0 right-0 opacity-0 group-hover:opacity-100 duration-100 flex justify-end items-end">
- <label className="btn btn-xs mb-2 mr-3 opacity-50 hover:opacity-100">
- {t("upload_banner")}
- <input
- type="file"
- accept="image/jpg, image/jpeg, image/png"
- onChange={async (e) => {
- const file = e.target.files?.[0];
- if (!file) return;
-
- const load = toast.loading(t("updating"));
-
- await updateFile.mutateAsync(
- {
- linkId: link.id as number,
- file,
- },
- {
- onSettled: (data, error) => {
- toast.dismiss(load);
-
- if (error) {
- toast.error(error.message);
- } else {
- toast.success(t("updated"));
- setLink({ updatedAt: data.updatedAt, ...link });
- }
+ <Button
+ className="mb-2 mr-3 opacity-50 hover:opacity-100 p-0"
+ size="sm"
+ >
+ <label className="cursor-pointer py-1 px-2 w-full">
+ {t("upload_banner")}
+ <input
+ type="file"
+ accept="image/jpg, image/jpeg"
+ onChange={async (e) => {
+ const file = e.target.files?.[0];
+ if (!file) return;
+
+ const load = toast.loading(t("updating"));
+
+ await updateFile.mutateAsync(
+ {
+ linkId: link.id as number,
+ file,
},
- }
- );
- }}
- className="hidden"
- />
- </label>
+ {
+ onSettled: (data, error) => {
+ toast.dismiss(load);
+
+ if (error) {
+ toast.error(error.message);
+ } else {
+ toast.success(t("updated"));
+ setLink({ updatedAt: data.updatedAt, ...link });
+ }
+ },
+ }
+ );
+ }}
+ className="hidden"
+ />
+ </label>
+ </Button>
</div>
)}
</div>
@@ -441,7 +447,7 @@ export default function LinkDetails({
<Link
href={"/tags/" + tag.id}
key={tag.id}
- className="bg-base-200 p-1 hover:bg-neutral-content btn btn-xs btn-ghost rounded-md"
+ className="bg-base-200 py-1 px-2 hover:bg-neutral-content rounded-sm duration-150"
>
{tag.name}
</Link>
@@ -508,12 +514,14 @@ export default function LinkDetails({
className="tooltip tooltip-bottom"
data-tip={t("refresh_preserved_formats")}
>
- <button
- className="btn btn-xs btn-ghost btn-square text-neutral"
+ <Button
+ variant="ghost"
+ size="sm"
+ className="text-neutral"
onClick={() => onUpdateArchive()}
>
<i className="bi-arrow-clockwise text-sm" />
- </button>
+ </Button>
</div>
)}
</div>
@@ -650,17 +658,13 @@ export default function LinkDetails({
<>
<br />
<div className="flex justify-end items-center">
- <button
- className={clsx(
- "btn btn-accent text-white",
- JSON.stringify(activeLink) === JSON.stringify(link)
- ? "btn-disabled"
- : "dark:border-violet-400"
- )}
+ <Button
+ variant="accent"
+ disabled={JSON.stringify(activeLink) === JSON.stringify(link)}
onClick={submit}
>
{t("save_changes")}
- </button>
+ </Button>
</div>
</>
)}
diff --git a/apps/web/components/LinkListOptions.tsx b/apps/web/components/LinkListOptions.tsx
index ab8ba9eb..731c3907 100644
--- a/apps/web/components/LinkListOptions.tsx
+++ b/apps/web/components/LinkListOptions.tsx
@@ -14,6 +14,7 @@ import {
} from "@linkwarden/types";
import { useArchiveAction, useBulkDeleteLinks } from "@linkwarden/router/links";
import toast from "react-hot-toast";
+import { Button } from "@/components/ui/button";
type Props = {
children: React.ReactNode;
@@ -116,20 +117,19 @@ const LinkListOptions = ({
links.length > 0 &&
editMode !== undefined &&
setEditMode && (
- <div
- role="button"
+ <Button
+ variant="ghost"
+ size="icon"
onClick={() => {
setEditMode(!editMode);
setSelectedLinks([]);
}}
- className={`btn btn-square btn-sm btn-ghost ${
- editMode
- ? "bg-primary/20 hover:bg-primary/20"
- : "hover:bg-neutral/20"
- }`}
+ className={
+ editMode ? "bg-primary/20 hover:bg-primary/20" : ""
+ }
>
- <i className="bi-pencil-fill text-neutral text-xl"></i>
- </div>
+ <i className="bi-pencil-fill text-neutral text-xl" />
+ </Button>
)}
<SortDropdown
sortBy={sortBy}
@@ -169,17 +169,20 @@ const LinkListOptions = ({
className="tooltip tooltip-top"
data-tip={t("refresh_preserved_formats")}
>
- <button
- disabled={selectedLinks.length === 0}
- className="btn btn-sm btn-ghost text-white"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => bulkRefreshPreservations()}
+ disabled={selectedLinks.length === 0}
+ className="text-white"
>
<i className="bi-arrow-clockwise text-sm" />
- </button>
+ </Button>
</div>
- <button
+ <Button
onClick={() => setBulkEditLinksModal(true)}
- className="btn btn-sm btn-accent text-white w-fit ml-auto"
+ variant="accent"
+ size="sm"
disabled={
selectedLinks.length === 0 ||
!(
@@ -189,12 +192,13 @@ const LinkListOptions = ({
}
>
{t("edit")}
- </button>
- <button
+ </Button>
+ <Button
onClick={(e) => {
e.shiftKey ? bulkDeleteLinks() : setBulkDeleteLinksModal(true);
}}
- className="btn btn-sm bg-red-500 hover:bg-red-400 text-white w-fit ml-auto"
+ variant="destructive"
+ size="sm"
disabled={
selectedLinks.length === 0 ||
!(
@@ -204,7 +208,7 @@ const LinkListOptions = ({
}
>
{t("delete")}
- </button>
+ </Button>
</div>
</div>
)}
diff --git a/apps/web/components/LinkViews/LinkComponents/LinkActions.tsx b/apps/web/components/LinkViews/LinkComponents/LinkActions.tsx
index 0bf9c754..0f096d74 100644
--- a/apps/web/components/LinkViews/LinkComponents/LinkActions.tsx
+++ b/apps/web/components/LinkViews/LinkComponents/LinkActions.tsx
@@ -19,6 +19,7 @@ import {
DropdownMenuItem,
DropdownMenuSeparator,
} from "@/components/ui/dropdown-menu";
+import { Button } from "@/components/ui/button";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -40,7 +41,7 @@ export default function LinkActions({
const router = useRouter();
- const isPublicRoute = router.pathname.startsWith("/public") ? true : false;
+ const isPublicRoute = router.pathname.startsWith("/public");
const getLink = useGetLink(isPublicRoute);
@@ -71,29 +72,37 @@ export default function LinkActions({
return (
<>
{isPublicRoute ? (
- <div
- className="absolute top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100 text-neutral z-20 focus:outline-none"
+ <Button
+ variant="simple"
+ size="icon"
+ className={clsx(
+ "absolute top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100 text-neutral z-20",
+ btnStyle
+ )}
onClick={() => setLinkModal(true)}
>
- <div className={clsx("btn btn-sm btn-square text-neutral", btnStyle)}>
- <i title="More" className="bi-info-circle text-xl" />
- </div>
- </div>
+ <i title="More" className="bi-info-circle text-xl" />
+ </Button>
) : (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <button
- onMouseDown={(e) => e.preventDefault()}
+ <Button
+ asChild
+ variant="simple"
+ size="icon"
className={clsx(
- "absolute top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100 btn btn-sm btn-square text-neutral z-20 focus:outline-none",
+ "absolute top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100 text-neutral z-20",
btnStyle
)}
+ onMouseDown={(e) => e.preventDefault()}
>
- <i title="More" className="bi-three-dots text-xl" />
- </button>
+ <button>
+ <i title="More" className="bi-three-dots text-xl" />
+ </button>
+ </Button>
</DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={4} align="end" className="mt-1">
+ <DropdownMenuContent sideOffset={4} align="end">
<DropdownMenuItem onSelect={() => pinLink(link)}>
<i className="bi-pin" />
diff --git a/apps/web/components/LinkViews/LinkComponents/LinkList.tsx b/apps/web/components/LinkViews/LinkComponents/LinkList.tsx
index 774529f5..cc710f9f 100644
--- a/apps/web/components/LinkViews/LinkComponents/LinkList.tsx
+++ b/apps/web/components/LinkViews/LinkComponents/LinkList.tsx
@@ -153,11 +153,10 @@ export default function LinkCardCompact({ link, editMode }: Props) {
</div>
</div>
</div>
- {!isPublic && <LinkPin link={link} btnStyle="btn-ghost" />}
+ {!isPublic && <LinkPin link={link} />}
<LinkActions
link={link}
collection={collection}
- btnStyle="btn-ghost"
linkModal={linkModal}
setLinkModal={(e) => setLinkModal(e)}
/>
diff --git a/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx b/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx
index b56bab70..03df64eb 100644
--- a/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx
+++ b/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx
@@ -30,6 +30,7 @@ import LinkPin from "./LinkPin";
import { useRouter } from "next/router";
import LinkFormats from "./LinkFormats";
import openLink from "@/lib/client/openLink";
+import { Button } from "@/components/ui/button";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -226,16 +227,17 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {
{show.tags && link.tags && link.tags[0] && (
<div className="flex gap-1 items-center flex-wrap">
{link.tags.map((e, i) => (
- <Link
- href={"/tags/" + e.id}
- key={i}
- onClick={(e) => {
- e.stopPropagation();
- }}
- className="btn btn-xs btn-ghost truncate max-w-[19rem]"
- >
- #{e.name}
- </Link>
+ <Button variant="ghost" size="sm" key={i}>
+ <Link
+ href={"/tags/" + e.id}
+ onClick={(e) => {
+ e.stopPropagation();
+ }}
+ className="truncate max-w-[19rem]"
+ >
+ #{e.name}
+ </Link>
+ </Button>
))}
</div>
)}
diff --git a/apps/web/components/LinkViews/LinkComponents/LinkPin.tsx b/apps/web/components/LinkViews/LinkComponents/LinkPin.tsx
index d82d013b..1cd063fa 100644
--- a/apps/web/components/LinkViews/LinkComponents/LinkPin.tsx
+++ b/apps/web/components/LinkViews/LinkComponents/LinkPin.tsx
@@ -2,6 +2,7 @@ import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types";
import { useRouter } from "next/router";
import clsx from "clsx";
import usePinLink from "@/lib/client/pinLink";
+import { Button } from "@/components/ui/button";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -16,19 +17,19 @@ export default function LinkPin({ link, btnStyle }: Props) {
const isAlreadyPinned = link?.pinnedBy && link.pinnedBy[0] ? true : false;
return (
- <div
- className="absolute top-3 right-[3.25rem] group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100"
+ <Button
+ variant="simple"
+ size="icon"
+ className={clsx(
+ "absolute top-3 right-[3.25rem] group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100 text-neutral",
+ btnStyle
+ )}
onClick={() => pinLink(link)}
>
- <div className={clsx("btn btn-sm btn-square text-neutral", btnStyle)}>
- <i
- title="Pin"
- className={clsx(
- "text-xl",
- isAlreadyPinned ? "bi-pin-fill" : "bi-pin"
- )}
- />
- </div>
- </div>
+ <i
+ title="Pin"
+ className={clsx("text-xl", isAlreadyPinned ? "bi-pin-fill" : "bi-pin")}
+ />
+ </Button>
);
}
diff --git a/apps/web/components/MobileNavigation.tsx b/apps/web/components/MobileNavigation.tsx
index 96013401..9575ec13 100644
--- a/apps/web/components/MobileNavigation.tsx
+++ b/apps/web/components/MobileNavigation.tsx
@@ -12,6 +12,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
} from "@/components/ui/dropdown-menu";
+import { Button } from "./ui/button";
type Props = {};
@@ -38,9 +39,12 @@ export default function MobileNavigation({}: Props) {
/>
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <div className="-mt-4 flex items-center btn btn-accent dark:border-violet-400 text-white btn-circle w-20 h-20 px-2 relative">
+ <Button
+ className="-mt-4 flex items-center w-20 h-20 aspect-square px-2 relative rounded-full"
+ variant="accent"
+ >
<i className="bi-plus text-5xl pointer-events-none"></i>
- </div>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
diff --git a/apps/web/components/Modal.tsx b/apps/web/components/Modal.tsx
index 7406df4f..224e1e07 100644
--- a/apps/web/components/Modal.tsx
+++ b/apps/web/components/Modal.tsx
@@ -2,6 +2,7 @@ import React, { MouseEventHandler, ReactNode, useEffect } from "react";
import ClickAwayHandler from "@/components/ClickAwayHandler";
import { Drawer } from "vaul";
import useWindowDimensions from "@/hooks/useWindowDimensions";
+import { Button } from "@/components/ui/button";
type Props = {
toggleModal: Function;
@@ -73,15 +74,17 @@ export default function Modal({
data-testid="modal-container"
>
{dismissible && (
- <div
- onClick={toggleModal as MouseEventHandler<HTMLDivElement>}
- className="absolute top-4 right-3 btn btn-sm outline-none btn-circle btn-ghost z-10"
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={toggleModal as MouseEventHandler<HTMLButtonElement>}
+ className="absolute top-4 right-3 z-10 rounded-full"
>
<i
className="bi-x text-neutral text-xl"
data-testid="close-modal-button"
- ></i>
- </div>
+ />
+ </Button>
)}
{children}
</div>
diff --git a/apps/web/components/ModalContent/BulkEditLinksModal.tsx b/apps/web/components/ModalContent/BulkEditLinksModal.tsx
index 5e7c1f0c..ac4fb670 100644
--- a/apps/web/components/ModalContent/BulkEditLinksModal.tsx
+++ b/apps/web/components/ModalContent/BulkEditLinksModal.tsx
@@ -7,6 +7,7 @@ import toast from "react-hot-toast";
import Modal from "../Modal";
import { useTranslation } from "next-i18next";
import { useBulkEditLinks } from "@linkwarden/router/links";
+import { Button } from "../ui/button";
type Props = {
onClose: Function;
@@ -100,12 +101,9 @@ export default function BulkEditLinksModal({ onClose }: Props) {
</div>
<div className="flex justify-end items-center mt-5">
- <button
- className="btn btn-accent dark:border-violet-400 text-white"
- onClick={submit}
- >
+ <Button variant="accent" onClick={submit}>
{t("save_changes")}
- </button>
+ </Button>
</div>
</Modal>
);
diff --git a/apps/web/components/ModalContent/EditCollectionModal.tsx b/apps/web/components/ModalContent/EditCollectionModal.tsx
index d95e00a6..45b5a7be 100644
--- a/apps/web/components/ModalContent/EditCollectionModal.tsx
+++ b/apps/web/components/ModalContent/EditCollectionModal.tsx
@@ -8,6 +8,7 @@ import toast from "react-hot-toast";
import IconPicker from "../IconPicker";
import { IconWeight } from "@phosphor-icons/react";
import oklchVariableToHex from "@/lib/client/oklchVariableToHex";
+import { Button } from "../ui/button";
type Props = {
onClose: Function;
@@ -107,12 +108,9 @@ export default function EditCollectionModal({
</div>
</div>
- <button
- className="btn btn-accent dark:border-violet-400 text-white w-fit ml-auto"
- onClick={submit}
- >
+ <Button variant="accent" className="ml-auto" onClick={submit}>
{t("save_changes")}
- </button>
+ </Button>
</div>
</Modal>
);
diff --git a/apps/web/components/ModalContent/EditCollectionSharingModal.tsx b/apps/web/components/ModalContent/EditCollectionSharingModal.tsx
index 6bdaddbc..16980403 100644
--- a/apps/web/components/ModalContent/EditCollectionSharingModal.tsx
+++ b/apps/web/components/ModalContent/EditCollectionSharingModal.tsx
@@ -23,6 +23,7 @@ import {
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
} from "@/components/ui/dropdown-menu";
+import { Button } from "@/components/ui/button";
type Props = {
onClose: Function;
@@ -97,12 +98,10 @@ export default function EditCollectionSharingModal({
...collection,
members: [...collection.members, newMember],
});
-
setMemberIdentifier("");
};
const router = useRouter();
-
const isPublicRoute = router.pathname.startsWith("/public") ? true : false;
return (
@@ -113,7 +112,7 @@ export default function EditCollectionSharingModal({
: t("team")}
</p>
- <div className="divider mb-3 mt-1"></div>
+ <div className="divider mb-3 mt-1" />
<div className="flex flex-col gap-3">
{permissions === true && !isPublicRoute && (
@@ -146,7 +145,7 @@ export default function EditCollectionSharingModal({
{collection.isPublic && (
<div>
<p className="mb-2">{t("sharable_link")}</p>
- <div className="w-full hide-scrollbar overflow-x-auto whitespace-nowrap rounded-md p-2 bg-base-200 border-neutral-content border-solid border flex items-center gap-2 justify-between">
+ <div className="w-full hide-scrollbar overflow-x-auto whitespace-nowrap rounded-md p-2 bg-base-200 border-neutral-content border flex items-center gap-2 justify-between">
{publicCollectionURL}
<CopyButton text={publicCollectionURL} />
</div>
@@ -154,7 +153,7 @@ export default function EditCollectionSharingModal({
)}
{permissions === true && !isPublicRoute && (
- <div className="divider my-3"></div>
+ <div className="divider my-3" />
)}
{permissions === true && !isPublicRoute && (
@@ -163,7 +162,7 @@ export default function EditCollectionSharingModal({
<div className="flex items-center gap-2">
<TextInput
- value={memberIdentifier || ""}
+ value={memberIdentifier}
className="bg-base-200"
placeholder={t("add_member_placeholder")}
onChange={(e) => setMemberIdentifier(e.target.value)}
@@ -171,7 +170,7 @@ export default function EditCollectionSharingModal({
e.key === "Enter" &&
addMemberToCollection(
user,
- memberIdentifier.replace(/^@/, "") || "",
+ memberIdentifier.replace(/^@/, ""),
collection,
setMemberState,
t
@@ -179,20 +178,22 @@ export default function EditCollectionSharingModal({
}
/>
- <div
+ <Button
+ variant="accent"
+ size="icon"
+ className="h-10 w-10"
onClick={() =>
addMemberToCollection(
user,
- memberIdentifier.replace(/^@/, "") || "",
+ memberIdentifier.replace(/^@/, ""),
collection,
setMemberState,
t
)
}
- className="btn btn-accent dark:border-violet-400 text-white btn-square btn-sm h-10 w-10"
>
- <i className="bi-person-add text-xl"></i>
- </div>
+ <i className="bi-person-add text-xl" />
+ </Button>
</div>
</>
)}
@@ -231,11 +232,11 @@ export default function EditCollectionSharingModal({
</div>
</div>
- <div className="divider my-0 last:hidden h-[3px]"></div>
+ <div className="divider my-0 last:hidden h-[1px]"></div>
{collection.members
.sort((a, b) => (a.userId as number) - (b.userId as number))
- .map((e, i) => {
+ .map((e) => {
const roleKey: "viewer" | "contributor" | "admin" =
!e.canCreate && !e.canUpdate && !e.canDelete
? "viewer"
@@ -259,109 +260,98 @@ export default function EditCollectionSharingModal({
};
return (
- <React.Fragment key={i}>
- <div className="relative p-3 bg-base-200 rounded-xl flex gap-2 justify-between border-none">
- <div
- className={"flex items-center justify-between w-full"}
- >
- <div className={"flex items-center"}>
- <div className={"shrink-0"}>
- <ProfilePhoto
- src={e.user.image ? e.user.image : undefined}
- name={e.user.name}
- />
- </div>
- <div className={"grow ml-2"}>
- <p className="text-sm font-semibold">
- {e.user.name}
- </p>
- <p className="text-xs text-neutral">
- @{e.user.username}
- </p>
- </div>
- </div>
-
- <div className={"flex items-center gap-2"}>
- {permissions === true && !isPublicRoute ? (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <div className="btn btn-sm btn-primary font-normal">
- {t(roleKey)}
- <i className="bi-chevron-down"></i>
- </div>
- </DropdownMenuTrigger>
-
- <DropdownMenuContent sideOffset={4} align="end">
- <DropdownMenuRadioGroup
- value={roleKey}
- onValueChange={handleRoleChange}
- >
- <DropdownMenuRadioItem value="viewer">
- <div>
- <p className="font-bold whitespace-nowrap">
- {t("viewer")}
- </p>
- <p className="whitespace-nowrap">
- {t("viewer_desc")}
- </p>
- </div>
- </DropdownMenuRadioItem>
-
- <DropdownMenuRadioItem value="contributor">
- <div>
- <p className="font-bold whitespace-nowrap">
- {t("contributor")}
- </p>
- <p className="whitespace-nowrap">
- {t("contributor_desc")}
- </p>
- </div>
- </DropdownMenuRadioItem>
-
- <DropdownMenuRadioItem value="admin">
- <div>
- <p className="font-bold whitespace-nowrap">
- {t("admin")}
- </p>
- <p className="whitespace-nowrap">
- {t("admin_desc")}
- </p>
- </div>
- </DropdownMenuRadioItem>
- </DropdownMenuRadioGroup>
- </DropdownMenuContent>
- </DropdownMenu>
- ) : (
- <p className="text-sm text-neutral">
- {t(roleKey)}
- </p>
- )}
-
- {permissions === true && !isPublicRoute && (
- <i
- className={
- "bi-x text-xl btn btn-sm btn-square btn-ghost text-neutral hover:text-red-500 dark:hover:text-red-500 duration-100 cursor-pointer"
- }
- title={t("remove_member")}
- onClick={() => {
- const updatedMembers =
- collection.members.filter((member) => {
- return (
- member.user.username !== e.user.username
- );
- });
- setCollection({
- ...collection,
- members: updatedMembers,
- });
- }}
- />
- )}
- </div>
+ <div
+ key={e.userId}
+ className="relative p-3 bg-base-200 rounded-xl flex gap-2 justify-between border-none"
+ >
+ <div className="flex items-center">
+ <ProfilePhoto
+ src={e.user.image ? e.user.image : undefined}
+ name={e.user.name}
+ />
+ <div className="ml-2">
+ <p className="text-sm font-semibold">{e.user.name}</p>
+ <p className="text-xs text-neutral">
+ @{e.user.username}
+ </p>
</div>
</div>
- <div className="divider my-0 last:hidden h-[3px]"></div>
- </React.Fragment>
+
+ <div className="flex items-center gap-2">
+ {permissions === true && !isPublicRoute ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" className="h-8">
+ {t(roleKey)} <i className="bi-chevron-down" />
+ </Button>
+ </DropdownMenuTrigger>
+
+ <DropdownMenuContent sideOffset={4} align="end">
+ <DropdownMenuRadioGroup
+ value={roleKey}
+ onValueChange={handleRoleChange}
+ >
+ <DropdownMenuRadioItem value="viewer">
+ <div>
+ <p className="font-bold whitespace-nowrap">
+ {t("viewer")}
+ </p>
+ <p className="whitespace-nowrap">
+ {t("viewer_desc")}
+ </p>
+ </div>
+ </DropdownMenuRadioItem>
+
+ <DropdownMenuRadioItem value="contributor">
+ <div>
+ <p className="font-bold whitespace-nowrap">
+ {t("contributor")}
+ </p>
+ <p className="whitespace-nowrap">
+ {t("contributor_desc")}
+ </p>
+ </div>
+ </DropdownMenuRadioItem>
+
+ <DropdownMenuRadioItem value="admin">
+ <div>
+ <p className="font-bold whitespace-nowrap">
+ {t("admin")}
+ </p>
+ <p className="whitespace-nowrap">
+ {t("admin_desc")}
+ </p>
+ </div>
+ </DropdownMenuRadioItem>
+ </DropdownMenuRadioGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : (
+ <p className="text-sm text-neutral">{t(roleKey)}</p>
+ )}
+
+ {permissions === true && !isPublicRoute && (
+ <Button
+ variant="ghost"
+ size="icon"
+ className="text-neutral hover:text-red-500"
+ onClick={() => {
+ setCollection({
+ ...collection,
+ members: collection.members.filter(
+ (member) => member.userId !== e.userId
+ ),
+ });
+ }}
+ >
+ <i
+ className="bi-x text-xl"
+ title={t("remove_member")}
+ />
+ </Button>
+ )}
+ </div>
+ </div>
);
})}
</div>
@@ -369,12 +359,13 @@ export default function EditCollectionSharingModal({
)}
{permissions === true && !isPublicRoute && (
- <button
- className="btn btn-accent dark:border-violet-400 text-white w-fit ml-auto mt-3"
+ <Button
+ variant="accent"
+ className="w-fit ml-auto mt-3"
onClick={submit}
>
{t("save_changes")}
- </button>
+ </Button>
)}
</div>
</Modal>
diff --git a/apps/web/components/ModalContent/EmailChangeVerificationModal.tsx b/apps/web/components/ModalContent/EmailChangeVerificationModal.tsx
index 5bc82a85..c712cacf 100644
--- a/apps/web/components/ModalContent/EmailChangeVerificationModal.tsx
+++ b/apps/web/components/ModalContent/EmailChangeVerificationModal.tsx
@@ -2,6 +2,7 @@ import React, { useState } from "react";
import TextInput from "@/components/TextInput";
import Modal from "../Modal";
import { useTranslation } from "next-i18next";
+import { Button } from "../ui/button";
type Props = {
onClose: Function;
@@ -61,12 +62,9 @@ export default function EmailChangeVerificationModal({
</div>
<div className="flex justify-end items-center">
- <button
- className="btn btn-accent dark:border-violet-400 text-white"
- onClick={() => onSubmit(password)}
- >
+ <Button variant="accent" onClick={() => onSubmit(password)}>
{t("confirm")}
- </button>
+ </Button>
</div>
</div>
</Modal>
diff --git a/apps/web/components/ModalContent/InviteModal.tsx b/apps/web/components/ModalContent/InviteModal.tsx
index 13617bb7..ec5d262f 100644
--- a/apps/web/components/ModalContent/InviteModal.tsx
+++ b/apps/web/components/ModalContent/InviteModal.tsx
@@ -6,6 +6,7 @@ import { useTranslation, Trans } from "next-i18next";
import { useAddUser } from "@linkwarden/router/users";
import Link from "next/link";
import { signIn } from "next-auth/react";
+import { Button } from "../ui/button";
type Props = {
onClose: Function;
@@ -118,12 +119,9 @@ export default function InviteModal({ onClose }: Props) {
</div>
<div className="flex justify-between items-center mt-5">
- <button
- className="btn btn-accent dark:border-violet-400 text-white ml-auto"
- type="submit"
- >
+ <Button variant="accent" className="ml-auto" type="submit">
{t("send_invitation")}
- </button>
+ </Button>
</div>
</form>
</Modal>
diff --git a/apps/web/components/ModalContent/LinkModal.tsx b/apps/web/components/ModalContent/LinkModal.tsx
index 31fa4093..037a32f2 100644
--- a/apps/web/components/ModalContent/LinkModal.tsx
+++ b/apps/web/components/ModalContent/LinkModal.tsx
@@ -16,6 +16,7 @@ import {
DropdownMenuItem,
DropdownMenuSeparator,
} from "@/components/ui/dropdown-menu";
+import { Button } from "../ui/button";
type Props = {
onClose: Function;
@@ -70,10 +71,12 @@ export default function LinkModal({
className="sm:h-screen items-center relative"
>
<div className="absolute top-3 left-0 right-0 flex justify-between px-3">
- <div
- className="bi-x text-xl btn btn-sm btn-circle text-base-content opacity-50 hover:opacity-100 z-10"
+ <Button
+ variant="simple"
+ size="icon"
+ className="bi-x text-xl rounded-full text-base-content opacity-50 hover:opacity-100 z-10"
onClick={() => onClose()}
- ></div>
+ ></Button>
{(permissions === true || permissions?.canUpdate) && !isPublicRoute && (
<Tab
@@ -97,12 +100,14 @@ export default function LinkModal({
{!isPublicRoute && (
<DropdownMenu modal={true}>
<DropdownMenuTrigger asChild>
- <button
- className="btn btn-sm btn-circle text-base-content opacity-50 hover:opacity-100 z-10"
+ <Button
+ variant="simple"
+ size="icon"
+ className="rounded-full text-base-content opacity-50 hover:opacity-100 z-10"
title={t("more")}
>
<i title="More" className="bi-three-dots text-xl" />
- </button>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -148,11 +153,18 @@ export default function LinkModal({
</DropdownMenu>
)}
{link.url && (
- <Link
- href={link.url}
- target="_blank"
- className="bi-box-arrow-up-right btn-circle text-base-content opacity-50 hover:opacity-100 btn btn-sm select-none z-10"
- ></Link>
+ <Button
+ asChild
+ variant="simple"
+ size="icon"
+ className="rounded-full"
+ >
+ <Link
+ href={link.url}
+ target="_blank"
+ className="bi-box-arrow-up-right text-base-content opacity-50 hover:opacity-100 select-none z-10"
+ ></Link>
+ </Button>
)}
</div>
</div>
diff --git a/apps/web/components/ModalContent/NewCollectionModal.tsx b/apps/web/components/ModalContent/NewCollectionModal.tsx
index 9d7e640b..c5802a1f 100644
--- a/apps/web/components/ModalContent/NewCollectionModal.tsx
+++ b/apps/web/components/ModalContent/NewCollectionModal.tsx
@@ -9,6 +9,7 @@ import toast from "react-hot-toast";
import IconPicker from "../IconPicker";
import { IconWeight } from "@phosphor-icons/react";
import oklchVariableToHex from "@/lib/client/oklchVariableToHex";
+import { Button } from "../ui/button";
type Props = {
onClose: Function;
@@ -124,12 +125,9 @@ export default function NewCollectionModal({ onClose, parent }: Props) {
</div>
</div>
- <button
- className="btn btn-accent dark:border-violet-400 text-white w-fit ml-auto"
- onClick={submit}
- >
+ <Button variant="accent" className="ml-auto" onClick={submit}>
{t("create_collection_button")}
- </button>
+ </Button>
</div>
</Modal>
);
diff --git a/apps/web/components/ModalContent/NewLinkModal.tsx b/apps/web/components/ModalContent/NewLinkModal.tsx
index 232ebfc6..48c11ccf 100644
--- a/apps/web/components/ModalContent/NewLinkModal.tsx
+++ b/apps/web/components/ModalContent/NewLinkModal.tsx
@@ -10,6 +10,7 @@ import { useCollections } from "@linkwarden/router/collections";
import { useAddLink } from "@linkwarden/router/links";
import toast from "react-hot-toast";
import { PostLinkSchemaType } from "@linkwarden/lib/schemaValidation";
+import { Button } from "@/components/ui/button";
type Props = {
onClose: Function;
@@ -30,9 +31,7 @@ export default function NewLinkModal({ onClose }: Props) {
} as PostLinkSchemaType;
const [link, setLink] = useState<PostLinkSchemaType>(initial);
-
const addLink = useAddLink();
-
const [submitLoader, setSubmitLoader] = useState(false);
const [optionsExpanded, setOptionsExpanded] = useState(false);
const router = useRouter();
@@ -77,14 +76,11 @@ export default function NewLinkModal({ onClose }: Props) {
const submit = async () => {
if (!submitLoader) {
setSubmitLoader(true);
-
const load = toast.loading(t("creating_link"));
-
await addLink.mutateAsync(link, {
onSettled: (data, error) => {
setSubmitLoader(false);
toast.dismiss(load);
-
if (error) {
toast.error(t(error.message));
} else {
@@ -99,7 +95,7 @@ export default function NewLinkModal({ onClose }: Props) {
return (
<Modal toggleModal={onClose}>
<p className="text-xl font-thin">{t("create_new_link")}</p>
- <div className="divider mb-3 mt-1"></div>
+ <div className="divider mb-3 mt-1" />
<div className="grid grid-flow-row-dense sm:grid-cols-5 gap-3">
<div className="sm:col-span-3 col-span-5">
<p className="mb-2">{t("link")}</p>
@@ -123,60 +119,52 @@ export default function NewLinkModal({ onClose }: Props) {
)}
</div>
</div>
- <div className={"mt-2"}>
- {optionsExpanded && (
- <div className="mt-5">
- <div className="grid sm:grid-cols-2 gap-3">
- <div>
- <p className="mb-2">{t("name")}</p>
- <TextInput
- value={link.name}
- onChange={(e) => setLink({ ...link, name: e.target.value })}
- placeholder={t("link_name_placeholder")}
- className="bg-base-200"
- />
- </div>
- <div>
- <p className="mb-2">{t("tags")}</p>
- <TagSelection
- onChange={setTags}
- defaultValue={
- link.tags?.map((e) => ({
- label: e.name,
- value: e.id,
- })) || []
- }
- />
- </div>
- <div className="sm:col-span-2">
- <p className="mb-2">{t("description")}</p>
- <textarea
- value={unescapeString(link.description || "") || ""}
- onChange={(e) =>
- setLink({ ...link, description: e.target.value })
- }
- placeholder={t("link_description_placeholder")}
- className="resize-none w-full h-32 rounded-md p-2 border-neutral-content bg-base-200 focus:border-primary border-solid border outline-none duration-100"
- />
- </div>
- </div>
+ {optionsExpanded && (
+ <div className="mt-5 grid sm:grid-cols-2 gap-3">
+ <div>
+ <p className="mb-2">{t("name")}</p>
+ <TextInput
+ value={link.name}
+ onChange={(e) => setLink({ ...link, name: e.target.value })}
+ placeholder={t("link_name_placeholder")}
+ className="bg-base-200"
+ />
</div>
- )}
- </div>
+ <div>
+ <p className="mb-2">{t("tags")}</p>
+ <TagSelection
+ onChange={setTags}
+ defaultValue={
+ link.tags?.map((e) => ({ label: e.name, value: e.id })) || []
+ }
+ />
+ </div>
+ <div className="sm:col-span-2">
+ <p className="mb-2">{t("description")}</p>
+ <textarea
+ value={unescapeString(link.description || "") || ""}
+ onChange={(e) =>
+ setLink({ ...link, description: e.target.value })
+ }
+ placeholder={t("link_description_placeholder")}
+ className="resize-none w-full h-32 rounded-md p-2 border-neutral-content bg-base-200 focus:border-primary border-solid border outline-none duration-100"
+ />
+ </div>
+ </div>
+ )}
<div className="flex justify-between items-center mt-5">
- <div
+ <Button
+ variant="ghost"
+ size="sm"
+ className="flex items-center px-2 w-fit text-sm"
onClick={() => setOptionsExpanded(!optionsExpanded)}
- className={`rounded-md cursor-pointer btn btn-sm btn-ghost duration-100 flex items-center px-2 w-fit text-sm`}
>
<p>{optionsExpanded ? t("hide_options") : t("more_options")}</p>
- <i className={`bi-chevron-${optionsExpanded ? "up" : "down"}`}></i>
- </div>
- <button
- className="btn btn-accent dark:border-violet-400 text-white"
- onClick={submit}
- >
+ <i className={`bi-chevron-${optionsExpanded ? "up" : "down"}`} />
+ </Button>
+ <Button variant="accent" onClick={submit}>
{t("create_link")}
- </button>
+ </Button>
</div>
</Modal>
);
diff --git a/apps/web/components/ModalContent/NewRssSubscriptionModal.tsx b/apps/web/components/ModalContent/NewRssSubscriptionModal.tsx
index 8e700819..05992c11 100644
--- a/apps/web/components/ModalContent/NewRssSubscriptionModal.tsx
+++ b/apps/web/components/ModalContent/NewRssSubscriptionModal.tsx
@@ -5,6 +5,7 @@ import { useAddRssSubscription } from "@linkwarden/router/rss";
import toast from "react-hot-toast";
import TextInput from "../TextInput";
import CollectionSelection from "../InputSelect/CollectionSelection";
+import { Button } from "../ui/button";
type Props = {
onClose: Function;
@@ -94,12 +95,9 @@ export default function NewRssSubscriptionModal({ onClose }: Props) {
/>
</div>
<div className="flex justify-end items-center mt-5">
- <button
- className="btn btn-accent dark:border-violet-400 text-white"
- onClick={submit}
- >
+ <Button variant="accent" onClick={submit}>
{t("create_rss_subscription")}
- </button>
+ </Button>
</div>
</>
</Modal>
diff --git a/apps/web/components/ModalContent/NewTokenModal.tsx b/apps/web/components/ModalContent/NewTokenModal.tsx
index ff785bb9..bf1c072a 100644
--- a/apps/web/components/ModalContent/NewTokenModal.tsx
+++ b/apps/web/components/ModalContent/NewTokenModal.tsx
@@ -155,12 +155,9 @@ export default function NewTokenModal({ onClose }: Props) {
</div>
<div className="flex justify-end items-center mt-5">
- <button
- className="btn btn-accent dark:border-violet-400 text-white"
- onClick={submit}
- >
+ <Button variant="accent" onClick={submit}>
{t("create_token")}
- </button>
+ </Button>
</div>
</>
)}
diff --git a/apps/web/components/ModalContent/NewUserModal.tsx b/apps/web/components/ModalContent/NewUserModal.tsx
index dcdfef04..8e3d27c4 100644
--- a/apps/web/components/ModalContent/NewUserModal.tsx
+++ b/apps/web/components/ModalContent/NewUserModal.tsx
@@ -4,6 +4,7 @@ import TextInput from "../TextInput";
import { FormEvent, useState } from "react";
import { useTranslation, Trans } from "next-i18next";
import { useAddUser } from "@linkwarden/router/users";
+import { Button } from "../ui/button";
type Props = {
onClose: Function;
@@ -132,12 +133,9 @@ export default function NewUserModal({ onClose }: Props) {
</div>
<div className="flex justify-between items-center mt-5">
- <button
- className="btn btn-accent dark:border-violet-400 text-white ml-auto"
- type="submit"
- >
+ <Button variant="accent" className="ml-auto" type="submit">
{t("create_user")}
- </button>
+ </Button>
</div>
</form>
</Modal>
diff --git a/apps/web/components/ModalContent/UploadFileModal.tsx b/apps/web/components/ModalContent/UploadFileModal.tsx
index a221020c..7f66fa76 100644
--- a/apps/web/components/ModalContent/UploadFileModal.tsx
+++ b/apps/web/components/ModalContent/UploadFileModal.tsx
@@ -11,6 +11,7 @@ import { useCollections } from "@linkwarden/router/collections";
import { useUploadFile } from "@linkwarden/router/links";
import { PostLinkSchemaType } from "@linkwarden/lib/schemaValidation";
import { useConfig } from "@linkwarden/router/config";
+import { Button } from "@/components/ui/button";
type Props = {
onClose: Function;
@@ -25,10 +26,7 @@ export default function UploadFileModal({ onClose }: Props) {
description: "",
type: "url",
tags: [],
- collection: {
- id: undefined,
- name: "",
- },
+ collection: { id: undefined, name: "" },
} as PostLinkSchemaType;
const [link, setLink] = useState<PostLinkSchemaType>(initial);
@@ -42,18 +40,11 @@ export default function UploadFileModal({ onClose }: Props) {
const setCollection = (e: any) => {
if (e?.__isNew__) e.value = undefined;
-
- setLink({
- ...link,
- collection: { id: e?.value, name: e?.label },
- });
+ setLink({ ...link, collection: { id: e?.value, name: e?.label } });
};
const setTags = (e: any) => {
- const tagNames = e.map((e: any) => {
- return { name: e.label };
- });
-
+ const tagNames = e.map((e: any) => ({ name: e.label }));
setLink({ ...link, tags: tagNames });
};
@@ -63,12 +54,11 @@ export default function UploadFileModal({ onClose }: Props) {
const currentCollection = collections.find(
(e) => e.id == Number(router.query.id)
);
-
if (
currentCollection &&
currentCollection.ownerId &&
router.asPath.startsWith("/collections/")
- )
+ ) {
setLink({
...initial,
collection: {
@@ -76,26 +66,22 @@ export default function UploadFileModal({ onClose }: Props) {
name: currentCollection.name,
},
});
- } else
- setLink({
- ...initial,
- collection: { name: "Unorganized" },
- });
+ }
+ } else {
+ setLink({ ...initial, collection: { name: "Unorganized" } });
+ }
}, [router, collections]);
const submit = async () => {
if (!submitLoader && file) {
setSubmitLoader(true);
-
const load = toast.loading(t("creating"));
-
await uploadFile.mutateAsync(
{ link, file },
{
onSettled: (data, error) => {
setSubmitLoader(false);
toast.dismiss(load);
-
if (error) {
toast.error(error.message);
} else {
@@ -113,22 +99,21 @@ export default function UploadFileModal({ onClose }: Props) {
<div className="flex gap-2 items-start">
<p className="text-xl font-thin">{t("upload_file")}</p>
</div>
- <div className="divider mb-3 mt-1"></div>
+ <div className="divider mb-3 mt-1" />
+
<div className="grid grid-flow-row-dense sm:grid-cols-5 gap-3">
<div className="sm:col-span-3 col-span-5">
<p className="mb-2">{t("file")}</p>
- <label className="btn h-10 btn-sm w-full border border-neutral-content hover:border-neutral-content flex justify-between">
+ <label className="h-10 cursor-pointer w-full border border-neutral-content bg-base-200 hover:bg-base-300 duration-150 rounded-md px-2 flex justify-between items-center">
<input
type="file"
accept=".pdf,.png,.jpg,.jpeg"
- className="cursor-pointer custom-file-input"
+ className="cursor-pointer custom-file-input w-full"
onChange={(e) => e.target.files && setFile(e.target.files[0])}
/>
</label>
<p className="text-xs font-semibold mt-2">
- {t("file_types", {
- size: config?.MAX_FILE_BUFFER || 10,
- })}
+ {t("file_types", { size: config?.MAX_FILE_BUFFER || 10 })}
</p>
</div>
<div className="sm:col-span-2 col-span-5">
@@ -144,6 +129,7 @@ export default function UploadFileModal({ onClose }: Props) {
)}
</div>
</div>
+
{optionsExpanded && (
<div className="mt-5">
<div className="grid sm:grid-cols-2 gap-3">
@@ -174,27 +160,26 @@ export default function UploadFileModal({ onClose }: Props) {
setLink({ ...link, description: e.target.value })
}
placeholder={t("description_placeholder")}
- className="resize-none w-full h-32 rounded-md p-2 border-neutral-content bg-base-200 focus:border-primary border-solid border outline-none duration-100"
+ className="resize-none w-full h-32 rounded-md p-2 border-neutral-content bg-base-200 focus:border-primary border outline-none duration-100"
/>
</div>
</div>
</div>
)}
+
<div className="flex justify-between items-center mt-5">
- <div
+ <Button
+ variant="ghost"
+ size="sm"
+ className="flex items-center px-2 w-fit text-sm"
onClick={() => setOptionsExpanded(!optionsExpanded)}
- className={`rounded-md cursor-pointer btn btn-sm btn-ghost duration-100 flex items-center px-2 w-fit text-sm`}
- >
- <p>
- {optionsExpanded ? t("hide") : t("more")} {t("options")}
- </p>
- </div>
- <button
- className="btn btn-accent dark:border-violet-400 text-white"
- onClick={submit}
>
+ <p>{optionsExpanded ? t("hide_options") : t("more_options")}</p>
+ <i className={`bi-chevron-${optionsExpanded ? "up" : "down"}`} />
+ </Button>
+ <Button variant="accent" onClick={submit}>
{t("upload_file")}
- </button>
+ </Button>
</div>
</Modal>
);
diff --git a/apps/web/components/Navbar.tsx b/apps/web/components/Navbar.tsx
index 0d030378..fbb9745f 100644
--- a/apps/web/components/Navbar.tsx
+++ b/apps/web/components/Navbar.tsx
@@ -17,6 +17,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
} from "@/components/ui/dropdown-menu";
+import { Button } from "@/components/ui/button";
export default function Navbar() {
const { t } = useTranslation();
@@ -45,47 +46,52 @@ export default function Navbar() {
return (
<div className="flex justify-between gap-2 items-center pl-3 pr-4 py-2 border-solid border-b-neutral-content border-b">
- <div
+ <Button
+ variant="ghost"
+ size="icon"
+ className="text-neutral lg:hidden sm:inline-flex"
onClick={() => {
setSidebar(true);
document.body.style.overflow = "hidden";
}}
- className="text-neutral btn btn-square btn-sm btn-ghost lg:hidden sm:inline-flex"
>
- <i className="bi-list text-xl leading-none"></i>
- </div>
+ <i className="bi-list text-xl leading-none" />
+ </Button>
+
<SearchBar />
+
<div className="flex items-center gap-2">
<ToggleDarkMode className="hidden sm:inline-grid" />
<DropdownMenu>
<DropdownMenuTrigger asChild>
<div className="tooltip tooltip-bottom" data-tip={t("create_new")}>
- <div
- role="button"
- className="flex min-w-[3.4rem] items-center btn btn-accent dark:border-violet-400 text-white btn-sm max-h-[2rem] px-2 relative"
+ <Button
+ variant="accent"
+ size="sm"
+ className="min-w-[3.3rem] h-[2rem]"
>
<span>
- <i className="bi-plus text-4xl absolute -top-[0.3rem] left-0 pointer-events-none"></i>
+ <i className="bi-plus text-4xl absolute -top-[0.15rem] left-0 pointer-events-none" />
</span>
<span>
- <i className="bi-caret-down-fill text-xs absolute top-2 right-[0.3rem] pointer-events-none"></i>
+ <i className="bi-caret-down-fill text-xs absolute top-[0.7rem] right-[0.4rem] pointer-events-none" />
</span>
- </div>
+ </Button>
</div>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem onSelect={() => setNewLinkModal(true)}>
- <i className="bi-link-45deg"></i>
+ <i className="bi-link-45deg" />
{t("new_link")}
</DropdownMenuItem>
<DropdownMenuItem onSelect={() => setUploadFileModal(true)}>
- <i className="bi-file-earmark-arrow-up"></i>
+ <i className="bi-file-earmark-arrow-up" />
{t("upload_file")}
</DropdownMenuItem>
<DropdownMenuItem onSelect={() => setNewCollectionModal(true)}>
- <i className="bi-folder"></i>
+ <i className="bi-folder" />
{t("new_collection")}
</DropdownMenuItem>
</DropdownMenuContent>
diff --git a/apps/web/components/NoLinksFound.tsx b/apps/web/components/NoLinksFound.tsx
index c9ab9d29..5d440430 100644
--- a/apps/web/components/NoLinksFound.tsx
+++ b/apps/web/components/NoLinksFound.tsx
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import NewLinkModal from "./ModalContent/NewLinkModal";
import { useTranslation } from "next-i18next";
+import { Button } from "./ui/button";
type Props = {
text?: string;
@@ -27,17 +28,17 @@ export default function NoLinksFound({ text }: Props) {
</p>
<p className="text-center text-sm sm:text-base">{t("start_journey")}</p>
<div className="text-center w-full mt-4">
- <div
+ <Button
onClick={() => {
setNewLinkModal(true);
}}
- className="inline-flex gap-1 relative w-[11rem] items-center btn btn-accent dark:border-violet-400 text-white group"
+ variant="accent"
>
<i className="bi-plus-lg text-3xl left-2 group-hover:ml-[4rem] absolute duration-100"></i>
<span className="group-hover:opacity-0 text-right w-full duration-100">
{t("create_new_link")}
</span>
- </div>
+ </Button>
</div>
{newLinkModal && <NewLinkModal onClose={() => setNewLinkModal(false)} />}
</div>
diff --git a/apps/web/components/PreserverdFormatRow.tsx b/apps/web/components/PreserverdFormatRow.tsx
index d758d8ac..fc296d9d 100644
--- a/apps/web/components/PreserverdFormatRow.tsx
+++ b/apps/web/components/PreserverdFormatRow.tsx
@@ -4,6 +4,7 @@ import {
} from "@linkwarden/types";
import Link from "next/link";
import { useRouter } from "next/router";
+import { Button } from "@/components/ui/button";
type Props = {
name: string;
@@ -22,14 +23,13 @@ export default function PreservedFormatRow({
}: Props) {
const router = useRouter();
- let isPublic = router.pathname.startsWith("/public") ? true : undefined;
+ const isPublic = router.pathname.startsWith("/public") ? true : undefined;
const handleDownload = () => {
const path = `/api/v1/archives/${link?.id}?format=${format}`;
fetch(path)
.then((response) => {
if (response.ok) {
- // Create a temporary link and click it to trigger the download
const anchorElement = document.createElement("a");
anchorElement.href = path;
anchorElement.download =
@@ -57,23 +57,21 @@ export default function PreservedFormatRow({
<div className="flex gap-1">
{downloadable || false ? (
- <div
- onClick={() => handleDownload()}
- className="btn btn-sm btn-square btn-ghost"
- >
+ <Button variant="ghost" size="icon" onClick={handleDownload}>
<i className="bi-cloud-arrow-down text-xl text-neutral" />
- </div>
+ </Button>
) : undefined}
- <Link
- href={`${
- isPublic ? "/public" : ""
- }/preserved/${link?.id}?format=${format}`}
- target="_blank"
- className="btn btn-sm btn-square btn-ghost"
- >
- <i className="bi-box-arrow-up-right text-lg text-neutral" />
- </Link>
+ <Button asChild variant="ghost" size="icon">
+ <Link
+ href={`${
+ isPublic ? "/public" : ""
+ }/preserved/${link?.id}?format=${format}`}
+ target="_blank"
+ >
+ <i className="bi-box-arrow-up-right text-lg text-neutral" />
+ </Link>
+ </Button>
</div>
</div>
);
diff --git a/apps/web/components/ProfileDropdown.tsx b/apps/web/components/ProfileDropdown.tsx
index fce6e67f..2973d0f7 100644
--- a/apps/web/components/ProfileDropdown.tsx
+++ b/apps/web/components/ProfileDropdown.tsx
@@ -11,6 +11,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
} from "@/components/ui/dropdown-menu";
+import { Button } from "./ui/button";
export default function ProfileDropdown() {
const { t } = useTranslation();
@@ -29,12 +30,12 @@ export default function ProfileDropdown() {
return (
<DropdownMenu>
<DropdownMenuTrigger>
- <div className="btn btn-circle btn-ghost">
+ <Button variant="ghost" className="rounded-full p-1">
<ProfilePhoto
src={user.image ? user.image : undefined}
priority={true}
/>
- </div>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem asChild>
diff --git a/apps/web/components/SortDropdown.tsx b/apps/web/components/SortDropdown.tsx
index 93cd5b9c..8b8cb02b 100644
--- a/apps/web/components/SortDropdown.tsx
+++ b/apps/web/components/SortDropdown.tsx
@@ -11,6 +11,7 @@ import {
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
} from "@/components/ui/dropdown-menu";
+import { Button } from "./ui/button";
type Props = {
sortBy: Sort;
@@ -34,9 +35,9 @@ export default function SortDropdown({ sortBy, setSort, t }: Props) {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <button className="btn btn-sm btn-square btn-ghost border-none">
+ <Button variant="ghost" size="icon">
<i className="bi-chevron-expand text-neutral text-xl"></i>
- </button>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent sideOffset={4} align="end">
diff --git a/apps/web/components/SubmitButton.tsx b/apps/web/components/SubmitButton.tsx
deleted file mode 100644
index e86fa784..00000000
--- a/apps/web/components/SubmitButton.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-type Props = {
- onClick?: Function;
- label: string;
- loading: boolean;
- className?: string;
- type?: "button" | "submit" | "reset" | undefined;
-};
-
-export default function SubmitButton({
- onClick,
- label,
- loading,
- className,
- type,
-}: Props) {
- return (
- <button
- type={type ? type : undefined}
- className={`btn btn-accent dark:border-violet-400 text-white tracking-wider w-fit flex items-center gap-2 ${
- className || ""
- }`}
- onClick={() => {
- if (!loading && onClick) onClick();
- }}
- >
- <p>{label}</p>
- </button>
- );
-}
diff --git a/apps/web/components/ToggleDarkMode.tsx b/apps/web/components/ToggleDarkMode.tsx
index 6a9a5dda..c2c0b131 100644
--- a/apps/web/components/ToggleDarkMode.tsx
+++ b/apps/web/components/ToggleDarkMode.tsx
@@ -2,6 +2,7 @@ import useLocalSettingsStore from "@/store/localSettings";
import { useEffect, useState, ChangeEvent } from "react";
import { useTranslation } from "next-i18next";
import clsx from "clsx";
+import { Button } from "./ui/button";
type Props = {
className?: string;
@@ -33,18 +34,25 @@ export default function ToggleDarkMode({ className, align }: Props) {
theme: settings.theme === "light" ? "Dark" : "Light",
})}
>
- <label
- className={`swap swap-rotate btn-square text-neutral btn btn-ghost btn-sm ${className}`}
+ <Button
+ asChild
+ variant="ghost"
+ size="icon"
+ className={`inline-grid swap swap-rotate text-neutral ${
+ className || ""
+ }`}
>
- <input
- type="checkbox"
- onChange={handleToggle}
- className="theme-controller"
- checked={theme === "dark"}
- />
- <i className="bi-sun-fill text-xl swap-on"></i>
- <i className="bi-moon-fill text-xl swap-off"></i>
- </label>
+ <label>
+ <input
+ type="checkbox"
+ onChange={handleToggle}
+ className="theme-controller"
+ checked={theme === "dark"}
+ />
+ <i className="bi-sun-fill text-xl swap-on"></i>
+ <i className="bi-moon-fill text-xl swap-off"></i>
+ </label>
+ </Button>
</div>
);
}
diff --git a/apps/web/components/UserListing.tsx b/apps/web/components/UserListing.tsx
index 1d8ee7d5..04a294ee 100644
--- a/apps/web/components/UserListing.tsx
+++ b/apps/web/components/UserListing.tsx
@@ -2,6 +2,7 @@ import DeleteUserModal from "@/components/ModalContent/DeleteUserModal";
import { useConfig } from "@linkwarden/router/config";
import { User as U } from "@linkwarden/prisma/client";
import { TFunction } from "i18next";
+import { Button } from "./ui/button";
interface User extends U {
subscriptions: {
@@ -65,14 +66,16 @@ const UserListing: React.FC<UserListingProps> = ({
)}
<td>{new Date(user.createdAt).toLocaleString()}</td>
<td className="relative">
- <button
- className="btn btn-sm btn-ghost duration-100 hidden group-hover:block absolute z-20 right-[0.35rem] top-[0.35rem]"
+ <Button
+ variant="ghost"
+ size="icon"
+ className="hidden group-hover:block hover:text-error absolute z-20 right-[0.35rem] top-[0.35rem]"
onClick={() =>
setDeleteUserModal({ isOpen: true, userId: user.id })
}
>
<i className="bi bi-trash"></i>
- </button>
+ </Button>
</td>
</tr>
))}
diff --git a/apps/web/components/ViewDropdown.tsx b/apps/web/components/ViewDropdown.tsx
index 4f4f8481..bb780d75 100644
--- a/apps/web/components/ViewDropdown.tsx
+++ b/apps/web/components/ViewDropdown.tsx
@@ -9,6 +9,7 @@ import {
import useLocalSettingsStore from "@/store/localSettings";
import { ViewMode } from "@linkwarden/types";
import { useTranslation } from "next-i18next";
+import { Button } from "@/components/ui/button";
type Props = {
viewMode: ViewMode;
@@ -38,7 +39,6 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
updateSettings({ columns: Number(e.target.value) });
};
- // helper to filter which show-settings to display
const visibleShows = (
Object.keys(settings.show) as (keyof typeof settings.show)[]
).filter((key) => {
@@ -52,19 +52,18 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <div className="btn btn-sm btn-square btn-ghost border-none">
+ <Button variant="ghost" size="icon">
{viewMode === ViewMode.Card ? (
- <i className="bi-grid w-4 h-4 text-neutral"></i>
+ <i className="bi-grid text-neutral"></i>
) : viewMode === ViewMode.Masonry ? (
- <i className="bi-columns-gap w-4 h-4 text-neutral"></i>
+ <i className="bi-columns-gap text-neutral"></i>
) : (
- <i className="bi-view-stacked w-4 h-4 text-neutral"></i>
+ <i className="bi-view-stacked text-neutral"></i>
)}
- </div>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent sideOffset={4} align="end">
- {/* View Mode Buttons */}
<div className="px-1">
<p className="text-sm text-neutral">{t("view")}</p>
<div className="flex gap-1 border-border">
@@ -81,17 +80,20 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
);
return (
- <button
+ <Button
key={mode}
+ variant="ghost"
+ size="sm"
onClick={() => onChangeViewMode(mode)}
- className={`flex-1 btn btn-sm btn-ghost ${
- viewMode === mode
+ className={
+ `flex-1 ` +
+ (viewMode === mode
? "bg-primary/20 hover:bg-primary/20"
- : "hover:bg-neutral/20"
- }`}
+ : "hover:bg-neutral/20")
+ }
>
<Icon />
- </button>
+ </Button>
);
})}
</div>
@@ -99,7 +101,6 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
<DropdownMenuSeparator />
- {/* Show Toggles */}
<p className="text-sm text-neutral px-1">{t("show")}</p>
{visibleShows.map((key) => (
<DropdownMenuCheckboxItem
@@ -114,7 +115,6 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
</DropdownMenuCheckboxItem>
))}
- {/* Columns Slider */}
{settings.viewMode !== ViewMode.List && (
<>
<DropdownMenuSeparator />
diff --git a/apps/web/components/ui/Button.tsx b/apps/web/components/ui/Button.tsx
index 30b7f84a..c9df9995 100644
--- a/apps/web/components/ui/Button.tsx
+++ b/apps/web/components/ui/Button.tsx
@@ -1,17 +1,18 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
-
import { cn } from "@/lib/utils";
const buttonVariants = cva(
- "inline-flex items-center focus:outline-none outline-none justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
+ "inline-flex items-center focus:outline-none outline-none justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background duration-150 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 select-none",
{
variants: {
variant: {
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
+ default:
+ "bg-neutral-content text-neutral-content-foreground hover:bg-neutral-content/90",
+ primary: "bg-primary text-primary-foreground hover:bg-primary/90",
accent:
- "bg-accent text-white hover:bg-accent/80 border border-violet-400",
+ "bg-accent text-white hover:bg-accent/90 border border-violet-400",
destructive: "bg-destructive text-white hover:bg-destructive/90",
outline:
"border border-base-content bg-background hover:bg-base-content hover:text-base-100",
@@ -19,15 +20,16 @@ const buttonVariants = cva(
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
metal:
"bg-neutral-content text-base-content hover:bg-neutral-content/80 border border-neutral/30",
- ghost: "hover:bg-accent hover:text-accent-foreground",
+ ghost: "hover:bg-base-content/20",
+ simple: "bg-base-200 hover:bg-base-300",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
- sm: "h-9 rounded-md px-3",
- lg: "h-11 rounded-md px-8",
+ sm: "py-1 px-2 text-xs",
+ lg: "h-11 px-8",
full: "px-4 py-2 w-full",
- icon: "h-10 w-10",
+ icon: "h-8 w-8",
},
},
defaultVariants: {
diff --git a/apps/web/layouts/SettingsLayout.tsx b/apps/web/layouts/SettingsLayout.tsx
index 4572113a..b2e7bd34 100644
--- a/apps/web/layouts/SettingsLayout.tsx
+++ b/apps/web/layouts/SettingsLayout.tsx
@@ -4,6 +4,7 @@ import { useRouter } from "next/router";
import ClickAwayHandler from "@/components/ClickAwayHandler";
import Link from "next/link";
import useWindowDimensions from "@/hooks/useWindowDimensions";
+import { Button } from "@/components/ui/button";
interface Props {
children: ReactNode;
@@ -37,19 +38,25 @@ export default function SettingsLayout({ children }: Props) {
<div className="w-full min-h-screen p-5 lg:ml-64">
<div className="gap-2 inline-flex mr-3">
- <div
+ <Button
+ variant="ghost"
+ size="icon"
+ className="text-neutral lg:hidden"
onClick={toggleSidebar}
- className="text-neutral btn btn-square btn-sm btn-ghost lg:hidden"
>
- <i className="bi-list text-xl leading-none"></i>
- </div>
+ <i className="bi-list text-xl leading-none" />
+ </Button>
- <Link
- href="/dashboard"
- className="text-neutral btn btn-square btn-sm btn-ghost"
+ <Button
+ asChild
+ variant="ghost"
+ size="icon"
+ className="text-neutral"
>
- <i className="bi-chevron-left text-xl"></i>
- </Link>
+ <Link href="/dashboard">
+ <i className="bi-chevron-left text-xl" />
+ </Link>
+ </Button>
</div>
{children}
diff --git a/apps/web/lib/api/controllers/collections/collectionId/deleteCollectionById.ts b/apps/web/lib/api/controllers/collections/collectionId/deleteCollectionById.ts
index 7b55b109..20221225 100644
--- a/apps/web/lib/api/controllers/collections/collectionId/deleteCollectionById.ts
+++ b/apps/web/lib/api/controllers/collections/collectionId/deleteCollectionById.ts
@@ -59,8 +59,8 @@ export default async function deleteCollection(
},
});
- removeFolder({ filePath: `archives/${collectionId}` });
- removeFolder({ filePath: `archives/preview/${collectionId}` });
+ await removeFolder({ filePath: `archives/${collectionId}` });
+ await removeFolder({ filePath: `archives/preview/${collectionId}` });
await removeFromOrders(userId, collectionId);
@@ -138,8 +138,8 @@ async function deleteSubCollections(collectionId: number) {
where: { id: subCollection.id },
});
- removeFolder({ filePath: `archives/${subCollection.id}` });
- removeFolder({ filePath: `archives/preview/${subCollection.id}` });
+ await removeFolder({ filePath: `archives/${subCollection.id}` });
+ await removeFolder({ filePath: `archives/preview/${subCollection.id}` });
}
}
diff --git a/apps/web/pages/admin.tsx b/apps/web/pages/admin.tsx
index aea3ad40..c82a9e9c 100644
--- a/apps/web/pages/admin.tsx
+++ b/apps/web/pages/admin.tsx
@@ -7,6 +7,7 @@ import getServerSideProps from "@/lib/client/getServerSideProps";
import UserListing from "@/components/UserListing";
import { useUsers } from "@linkwarden/router/users";
import Divider from "@/components/ui/Divider";
+import { Button } from "@/components/ui/button";
interface User extends U {
subscriptions: {
@@ -51,12 +52,11 @@ export default function Admin() {
<div className="max-w-6xl mx-auto p-5">
<div className="flex sm:flex-row flex-col justify-between gap-2">
<div className="gap-2 inline-flex items-center">
- <Link
- href="/dashboard"
- className="text-neutral btn btn-square btn-sm btn-ghost"
- >
- <i className="bi-chevron-left text-xl"></i>
- </Link>
+ <Button variant="ghost" size="icon">
+ <Link href="/dashboard" className="text-neutral">
+ <i className="bi-chevron-left text-xl"></i>
+ </Link>
+ </Button>
<p className="capitalize text-3xl font-thin inline">
{t("user_administration")}
</p>
@@ -81,12 +81,14 @@ export default function Admin() {
/>
</div>
- <div
+ <Button
onClick={() => setNewUserModal(true)}
- className="flex items-center btn btn-accent dark:border-violet-400 text-white btn-sm px-2 aspect-square relative"
+ variant="accent"
+ size="icon"
+ className="flex items-center px-2 aspect-square relative"
>
<i className="bi-plus text-3xl absolute"></i>
- </div>
+ </Button>
</div>
</div>
diff --git a/apps/web/pages/collections/[id].tsx b/apps/web/pages/collections/[id].tsx
index df3df3b7..a47b2795 100644
--- a/apps/web/pages/collections/[id].tsx
+++ b/apps/web/pages/collections/[id].tsx
@@ -34,6 +34,7 @@ import {
DropdownMenuItem,
DropdownMenuSeparator,
} from "@/components/ui/dropdown-menu";
+import { Button } from "@/components/ui/button";
export default function Index() {
const { t } = useTranslation();
@@ -133,9 +134,9 @@ export default function Index() {
<i
className="bi-folder-fill text-3xl"
style={{ color: activeCollection.color }}
- ></i>
+ />
)}
-
+
<p className="sm:text-3xl text-2xl w-full py-1 break-words hyphens-auto font-thin">
{activeCollection?.name}
</p>
@@ -143,13 +144,18 @@ export default function Index() {
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <button
- className="btn btn-ghost btn-sm btn-square text-neutral mt-2"
+ <Button
+ asChild
+ variant="ghost"
+ size="icon"
+ className="mt-2 text-neutral"
onMouseDown={(e) => e.preventDefault()}
title={t("more")}
>
- <i className="bi-three-dots text-xl"></i>
- </button>
+ <button>
+ <i className="bi-three-dots text-xl" />
+ </button>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -164,25 +170,21 @@ export default function Index() {
}
}}
>
- <i className="bi-box-arrow-up-right"></i>
+ <i className="bi-box-arrow-up-right" />
{t("open_all_links")}
</DropdownMenuItem>
{permissions === true && (
<DropdownMenuItem
- onClick={() => {
- setEditCollectionModal(true);
- }}
+ onClick={() => setEditCollectionModal(true)}
>
- <i className="bi-pencil-square"></i>
+ <i className="bi-pencil-square" />
{t("edit_collection_info")}
</DropdownMenuItem>
)}
<DropdownMenuItem
- onClick={() => {
- setEditCollectionSharingModal(true);
- }}
+ onClick={() => setEditCollectionSharingModal(true)}
>
<i className="bi-globe" />
{permissions === true
@@ -191,11 +193,7 @@ export default function Index() {
</DropdownMenuItem>
{permissions === true && (
- <DropdownMenuItem
- onClick={() => {
- setNewCollectionModal(true);
- }}
- >
+ <DropdownMenuItem onClick={() => setNewCollectionModal(true)}>
<i className="bi-folder-plus" />
{t("create_subcollection")}
</DropdownMenuItem>
@@ -204,9 +202,7 @@ export default function Index() {
<DropdownMenuSeparator />
<DropdownMenuItem
- onClick={() => {
- setDeleteCollectionModal(true);
- }}
+ onClick={() => setDeleteCollectionModal(true)}
className="text-error"
>
{permissions === true ? (
@@ -227,10 +223,10 @@ export default function Index() {
)}
{activeCollection && (
- <div className={`min-w-[15rem]`}>
+ <div className="min-w-[15rem]">
<div className="flex gap-1 justify-center sm:justify-end items-center w-fit">
<div
- className="flex items-center btn px-2 btn-ghost rounded-full w-fit"
+ className="flex items-center px-1 py-1 rounded-full cursor-pointer hover:bg-base-content/20 transition-colors duration-200"
onClick={() => setEditCollectionSharingModal(true)}
>
{collectionOwner.id && (
@@ -240,14 +236,14 @@ export default function Index() {
/>
)}
{activeCollection.members
- .sort((a, b) => a.userId - b.userId)
+ .sort((a, b) => (a.userId as number) - (b.userId as number))
.map((e, i) => {
return (
<ProfilePhoto
key={i}
src={e.user.image ? e.user.image : undefined}
- className="-ml-3"
name={e.user.name}
+ className="-ml-3"
/>
);
})
@@ -261,63 +257,54 @@ export default function Index() {
)}
</div>
- <p className="text-neutral text-sm">
- {activeCollection.members.length > 0 &&
- 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", {
+ <p className="text-neutral text-sm ml-2">
+ {activeCollection.members.length > 0
+ ? activeCollection.members.length === 1
+ ? t("by_author_and_other", {
author: collectionOwner.name,
count: activeCollection.members.length,
})
- : t("by_author", {
+ : t("by_author_and_others", {
author: collectionOwner.name,
- })}
+ count: activeCollection.members.length,
+ })
+ : t("by_author", { author: collectionOwner.name })}
</p>
</div>
</div>
)}
- {activeCollection?.description && (
- <p>{activeCollection?.description}</p>
- )}
+ {activeCollection?.description && <p>{activeCollection.description}</p>}
- <div className="divider my-0"></div>
+ <div className="divider my-0" />
- {collections.some((e) => e.parentId === activeCollection?.id) ? (
+ {collections.some((e) => e.parentId === activeCollection?.id) && (
<>
<PageHeader
- icon={"bi-folder"}
+ icon="bi-folder"
title={t("collections")}
- description={
+ description={t(
collections.filter((e) => e.parentId === activeCollection?.id)
.length === 1
- ? t("showing_count_result", {
- count: collections.filter(
- (e) => e.parentId === activeCollection?.id
- ).length,
- })
- : t("showing_count_results", {
- count: collections.filter(
- (e) => e.parentId === activeCollection?.id
- ).length,
- })
- }
+ ? "showing_count_result"
+ : "showing_count_results",
+ {
+ count: collections.filter(
+ (e) => e.parentId === activeCollection?.id
+ ).length,
+ }
+ )}
className="scale-90 w-fit"
/>
<div className="grid 2xl:grid-cols-4 xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">
{collections
.filter((e) => e.parentId === activeCollection?.id)
- .map((e, i) => {
- return <CollectionCard key={i} collection={e} />;
- })}
+ .map((e) => (
+ <CollectionCard key={e.id} collection={e} />
+ ))}
</div>
</>
- ) : undefined}
+ )}
<LinkListOptions
t={t}
diff --git a/apps/web/pages/collections/index.tsx b/apps/web/pages/collections/index.tsx
index 4741ce18..f565ed0c 100644
--- a/apps/web/pages/collections/index.tsx
+++ b/apps/web/pages/collections/index.tsx
@@ -16,6 +16,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
} from "@/components/ui/dropdown-menu";
+import { Button } from "@/components/ui/button";
export default function Collections() {
const { t } = useTranslation();
@@ -44,9 +45,9 @@ export default function Collections() {
<div className="relative">
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <div className="btn btn-ghost btn-sm btn-square text-neutral">
+ <Button className="text-neutral" variant="ghost" size="icon">
<i className={"bi-three-dots text-neutral text-xl"}></i>
- </div>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent side="bottom" align="start">
<DropdownMenuItem
@@ -74,13 +75,13 @@ export default function Collections() {
})}
<div
- className="card card-compact shadow-md hover:shadow-none duration-200 border border-neutral-content p-5 bg-base-200 self-stretch min-h-[12rem] rounded-xl cursor-pointer flex flex-col gap-4 justify-center items-center group btn"
+ className="card card-compact shadow-md hover:shadow-none duration-200 border border-neutral-content p-5 bg-base-200 self-stretch min-h-[12rem] rounded-xl cursor-pointer flex flex-col gap-4 justify-center items-center group"
onClick={() => setNewCollectionModal(true)}
>
<p className="group-hover:opacity-0 duration-100">
{t("new_collection")}
</p>
- <i className="bi-plus-lg text-5xl group-hover:text-7xl group-hover:-mt-6 text-primary drop-shadow duration-100"></i>
+ <i className="bi-plus-lg text-5xl group-hover:text-7xl group-hover:-mt-10 text-primary drop-shadow duration-100"></i>
</div>
</div>
diff --git a/apps/web/pages/confirmation.tsx b/apps/web/pages/confirmation.tsx
index 128cf1b0..08c4e614 100644
--- a/apps/web/pages/confirmation.tsx
+++ b/apps/web/pages/confirmation.tsx
@@ -5,6 +5,7 @@ import { useState } from "react";
import toast from "react-hot-toast";
import { useTranslation } from "next-i18next";
import getServerSideProps from "@/lib/client/getServerSideProps";
+import { Button } from "@/components/ui/button";
export default function EmailConfirmaion() {
const router = useRouter();
@@ -52,9 +53,9 @@ export default function EmailConfirmaion() {
<p>{t("verification_email_sent_desc")}</p>
<div className="mx-auto w-fit mt-3">
- <div className="btn btn-ghost btn-sm" onClick={resend}>
+ <Button onClick={resend} variant="ghost" size="sm">
{t("resend_email")}
- </div>
+ </Button>
</div>
</div>
</CenteredForm>
diff --git a/apps/web/pages/dashboard.tsx b/apps/web/pages/dashboard.tsx
index 3d0707ea..5232f3c4 100644
--- a/apps/web/pages/dashboard.tsx
+++ b/apps/web/pages/dashboard.tsx
@@ -18,6 +18,7 @@ import useLocalSettingsStore from "@/store/localSettings";
import { useUpdateUser, useUser } from "@linkwarden/router/user";
import SurveyModal from "@/components/ModalContent/SurveyModal";
import ImportDropdown from "@/components/ImportDropdown";
+import { Button } from "@/components/ui/button";
export default function Dashboard() {
const { t } = useTranslation();
@@ -215,17 +216,15 @@ export default function Dashboard() {
</p>
<div className="text-center w-full mt-4 flex flex-wrap gap-4 justify-center">
- <div
+ <Button
onClick={() => {
setNewLinkModal(true);
}}
- className="inline-flex items-center gap-2 text-sm btn btn-accent dark:border-violet-400 text-white"
+ variant="accent"
>
<i className="bi-plus-lg text-xl"></i>
- <span className="group-hover:opacity-0 text-right">
- {t("add_link")}
- </span>
- </div>
+ {t("add_link")}
+ </Button>
<ImportDropdown />
</div>
diff --git a/apps/web/pages/login.tsx b/apps/web/pages/login.tsx
index 2ce15398..e2704cac 100644
--- a/apps/web/pages/login.tsx
+++ b/apps/web/pages/login.tsx
@@ -126,8 +126,9 @@ export default function Login({
cloud.linkwarden.app
</a>
</div>
- <div
- className="btn btn-sm btn-primary w-full"
+ <Button
+ variant="primary"
+ size="full"
onClick={async () => {
const load = toast.loading(t("authenticating"));
@@ -147,7 +148,7 @@ export default function Login({
}}
>
{t("demo_button")}
- </div>
+ </Button>
</div>
</div>
)}
diff --git a/apps/web/pages/public/collections/[id]/index.tsx b/apps/web/pages/public/collections/[id]/index.tsx
index 648ddd97..bf609b1e 100644
--- a/apps/web/pages/public/collections/[id]/index.tsx
+++ b/apps/web/pages/public/collections/[id]/index.tsx
@@ -23,6 +23,7 @@ import LinkListOptions from "@/components/LinkListOptions";
import { usePublicLinks } from "@linkwarden/router/publicLinks";
import Links from "@/components/LinkViews/Links";
import { usePublicTags } from "@linkwarden/router/publicTags";
+import { Button } from "@/components/ui/button";
export default function PublicCollections() {
const { t } = useTranslation();
@@ -113,15 +114,13 @@ export default function PublicCollections() {
<div className="lg:w-3/4 max-w-[1500px] w-full mx-auto p-5 bg">
<div className="flex justify-between gap-2">
<div className="w-full">
- <p className="text-4xl font-thin mb-2 mt-10">
- {collection.name}
- </p>
+ <p className="text-4xl font-thin mb-2 mt-10">{collection.name}</p>
<div className="mt-3">
<div className={`min-w-[15rem]`}>
<div className="flex gap-1 justify-center sm:justify-end items-center w-fit">
<div
- className="flex items-center btn px-2 btn-ghost rounded-full"
+ className="flex items-center z-10 px-1 py-1 rounded-full cursor-pointer hover:bg-base-content/20 transition-colors duration-200"
onClick={() => setEditCollectionSharingModal(true)}
>
{collectionOwner.id && (
@@ -139,8 +138,8 @@ export default function PublicCollections() {
<ProfilePhoto
key={i}
src={e.user.image ? e.user.image : undefined}
- className="-ml-3"
name={e.user.name}
+ className="-ml-3"
/>
);
})
@@ -199,13 +198,15 @@ export default function PublicCollections() {
<ToggleDarkMode align="left" />
<div className="tooltip tooltip-left" data-tip={t("rss_feed")}>
- <Link
- href={`/public/collections/${collection.id}/rss`}
- target="_blank"
- className="text-neutral btn btn-ghost btn-sm size-8"
- >
- <i className="bi bi-rss text-xl"></i>
- </Link>
+ <Button asChild variant="ghost" size="icon">
+ <Link
+ href={`/public/collections/${collection.id}/rss`}
+ target="_blank"
+ className="text-neutral"
+ >
+ <i className="bi bi-rss text-xl"></i>
+ </Link>
+ </Button>
</div>
</div>
</div>
diff --git a/apps/web/pages/settings/access-tokens.tsx b/apps/web/pages/settings/access-tokens.tsx
index d0bde79b..049a7621 100644
--- a/apps/web/pages/settings/access-tokens.tsx
+++ b/apps/web/pages/settings/access-tokens.tsx
@@ -6,6 +6,7 @@ import { AccessToken } from "@linkwarden/prisma/client";
import { useTranslation } from "next-i18next";
import getServerSideProps from "@/lib/client/getServerSideProps";
import { useTokens } from "@linkwarden/router/tokens";
+import { Button } from "@/components/ui/button";
export default function AccessTokens() {
const [newTokenModal, setNewTokenModal] = useState(false);
@@ -31,14 +32,15 @@ export default function AccessTokens() {
<div className="flex flex-col gap-3">
<p>{t("access_tokens_description")}</p>
- <button
- className={`btn ml-auto btn-accent dark:border-violet-400 text-white tracking-wider w-fit flex items-center gap-2`}
+ <Button
+ className="ml-auto"
+ variant="accent"
onClick={() => {
setNewTokenModal(true);
}}
>
{t("new_token")}
- </button>
+ </Button>
{tokens.length > 0 && (
<table className="table mt-2 overflow-x-auto">
@@ -84,12 +86,14 @@ export default function AccessTokens() {
})}
</td>
<td>
- <button
- className="btn btn-sm btn-ghost btn-square hover:bg-red-500"
+ <Button
+ variant="ghost"
+ size="icon"
+ className="hover:text-error"
onClick={() => openRevokeModal(token as AccessToken)}
>
<i className="bi-x text-lg"></i>
- </button>
+ </Button>
</td>
</tr>
</React.Fragment>
diff --git a/apps/web/pages/settings/account.tsx b/apps/web/pages/settings/account.tsx
index 590e7aa2..369d23a7 100644
--- a/apps/web/pages/settings/account.tsx
+++ b/apps/web/pages/settings/account.tsx
@@ -5,7 +5,6 @@ import SettingsLayout from "@/layouts/SettingsLayout";
import TextInput from "@/components/TextInput";
import { resizeImage } from "@/lib/client/resizeImage";
import ProfilePhoto from "@/components/ProfilePhoto";
-import SubmitButton from "@/components/SubmitButton";
import React from "react";
import Link from "next/link";
import Checkbox from "@/components/Checkbox";
@@ -287,7 +286,8 @@ export default function Account() {
)}
</div>
- <SubmitButton
+ <Button
+ variant="accent"
onClick={() => {
if (account.email !== user.email) {
setEmailChangeVerificationModal(true);
@@ -295,10 +295,11 @@ export default function Account() {
submit();
}
}}
- loading={submitLoader}
- label={t("save_changes")}
+ disabled={submitLoader}
className="mt-2 w-full sm:w-fit"
- />
+ >
+ {t("save_changes")}
+ </Button>
<div>
<div className="flex items-center gap-2 w-full rounded-md h-8">
diff --git a/apps/web/pages/settings/billing.tsx b/apps/web/pages/settings/billing.tsx
index d4923b32..8f8b90df 100644
--- a/apps/web/pages/settings/billing.tsx
+++ b/apps/web/pages/settings/billing.tsx
@@ -18,6 +18,7 @@ import {
DropdownMenuItem,
DropdownMenuSeparator,
} from "@/components/ui/dropdown-menu";
+import { Button } from "@/components/ui/button";
interface User extends U {
subscriptions: {
@@ -127,13 +128,14 @@ export default function Billing() {
</div>
<div className="flex gap-3">
- <div
+ <Button
+ variant="accent"
onClick={() => setInviteModal(true)}
- className="flex items-center btn btn-accent dark:border-violet-400 text-white btn-sm px-2 h-[2.15rem] relative"
+ className="flex items-center px-2 h-[2.15rem] relative"
>
<p>{t("invite_user")}</p>
<i className="bi-plus text-xl"></i>
- </div>
+ </Button>
</div>
</div>
@@ -200,15 +202,16 @@ export default function Billing() {
<td className="relative">
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <button
+ <Button
+ variant="ghost"
+ size="icon"
onMouseDown={(e) => e.preventDefault()}
- className="btn btn-ghost btn-sm btn-square duration-100"
title={t("more")}
>
<i
className={"bi bi-three-dots text-lg text-neutral"}
></i>
- </button>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent
diff --git a/apps/web/pages/settings/delete.tsx b/apps/web/pages/settings/delete.tsx
index 77d4cb60..a6a680b0 100644
--- a/apps/web/pages/settings/delete.tsx
+++ b/apps/web/pages/settings/delete.tsx
@@ -58,12 +58,16 @@ export default function Delete() {
return (
<CenteredForm>
<div className="p-4 mx-auto relative flex flex-col gap-3 justify-between max-w-[30rem] min-w-80 bg-base-200 rounded-xl shadow-md border border-neutral-content">
- <Link
- href="/settings/account"
- className="absolute top-4 left-4 btn btn-ghost btn-square btn-sm"
+ <Button
+ asChild
+ variant="ghost"
+ size="icon"
+ className="absolute top-4 left-4"
>
- <i className="bi-chevron-left text-neutral text-xl"></i>
- </Link>
+ <Link href="/settings/account">
+ <i className="bi-chevron-left text-neutral text-xl"></i>
+ </Link>
+ </Button>
<div className="flex items-center gap-2 w-full rounded-md h-8">
<p className="text-red-500 dark:text-red-500 truncate w-full text-3xl text-center">
{t("delete_account")}
diff --git a/apps/web/pages/settings/password.tsx b/apps/web/pages/settings/password.tsx
index c79f34e1..0cf68fa3 100644
--- a/apps/web/pages/settings/password.tsx
+++ b/apps/web/pages/settings/password.tsx
@@ -1,11 +1,11 @@
import SettingsLayout from "@/layouts/SettingsLayout";
import { useState } from "react";
-import SubmitButton from "@/components/SubmitButton";
import { toast } from "react-hot-toast";
import TextInput from "@/components/TextInput";
import { useTranslation } from "next-i18next";
import getServerSideProps from "@/lib/client/getServerSideProps";
import { useUpdateUser, useUser } from "@linkwarden/router/user";
+import { Button } from "@/components/ui/button";
export default function Password() {
const { t } = useTranslation();
@@ -80,12 +80,14 @@ export default function Password() {
type="password"
/>
- <SubmitButton
+ <Button
onClick={submit}
- loading={submitLoader}
- label={t("save_changes")}
+ disabled={submitLoader}
+ variant="accent"
className="mt-3 w-full sm:w-fit"
- />
+ >
+ {t("save_changes")}
+ </Button>
</div>
</SettingsLayout>
);
diff --git a/apps/web/pages/settings/preference.tsx b/apps/web/pages/settings/preference.tsx
index 0a86552b..8e3b1ef3 100644
--- a/apps/web/pages/settings/preference.tsx
+++ b/apps/web/pages/settings/preference.tsx
@@ -1,6 +1,5 @@
import SettingsLayout from "@/layouts/SettingsLayout";
import { useState, useEffect } from "react";
-import SubmitButton from "@/components/SubmitButton";
import { toast } from "react-hot-toast";
import Checkbox from "@/components/Checkbox";
import useLocalSettingsStore from "@/store/localSettings";
@@ -13,7 +12,7 @@ import { useTags, useUpdateArchivalTags } from "@linkwarden/router/tags";
import TagSelection from "@/components/InputSelect/TagSelection";
import { useArchivalTags } from "@/hooks/useArchivalTags";
import { isArchivalTag } from "@linkwarden/lib";
-import clsx from "clsx";
+import { Button } from "@/components/ui/button";
export default function Preference() {
const { t } = useTranslation();
@@ -455,12 +454,14 @@ export default function Preference() {
<span className="block sm:text-lg truncate max-w-sm">
{tag.label}
</span>
- <button
- className="py-1 px-2 btn btn-sm btn-ghost btn-square hover:bg-red-500"
+ <Button
+ variant="ghost"
+ size="icon"
onClick={() => removeTag(tag)}
+ className="hover:bg-red-500"
>
<i className="bi-x text-lg leading-none"></i>
- </button>
+ </Button>
</div>
<div className="flex flex-wrap items-center justify-between gap-1 mt-1">
<p className="text-sm">{t("preservation_rules")}</p>
@@ -471,15 +472,18 @@ export default function Preference() {
className="tooltip tooltip-top"
data-tip={label}
>
- <button
+ <Button
+ variant="ghost"
+ size="icon"
onClick={() => toggleOption(tag, type)}
- className={clsx(
- "py-1 px-2 btn btn-sm btn-square",
- tag[type] ? "btn-primary" : "btn-ghost"
- )}
+ className={
+ tag[type]
+ ? "bg-primary hover:bg-primary text-primary-foreground hover:text-primary-foreground"
+ : ""
+ }
>
<i className={`${icon} text-lg leading-none`}></i>
- </button>
+ </Button>
</div>
))}
</div>
@@ -608,12 +612,14 @@ export default function Preference() {
</div>
</div>
- <SubmitButton
+ <Button
onClick={submit}
- loading={submitLoader}
- label={t("save_changes")}
+ disabled={submitLoader}
className="mt-2 w-full sm:w-fit"
- />
+ variant="accent"
+ >
+ {t("save_changes")}
+ </Button>
</div>
</SettingsLayout>
);
diff --git a/apps/web/pages/settings/rss-subscriptions.tsx b/apps/web/pages/settings/rss-subscriptions.tsx
index f77575a1..902eeb98 100644
--- a/apps/web/pages/settings/rss-subscriptions.tsx
+++ b/apps/web/pages/settings/rss-subscriptions.tsx
@@ -7,6 +7,7 @@ import { useState } from "react";
import { RssSubscription } from "@linkwarden/prisma/client";
import NewRssSubscriptionModal from "@/components/ModalContent/NewRssSubscriptionModal";
import { useConfig } from "@linkwarden/router/config";
+import { Button } from "@/components/ui/button";
export default function RssSubscriptions() {
const { t } = useTranslation();
@@ -38,14 +39,15 @@ export default function RssSubscriptions() {
})}
</p>
- <button
- className={`btn ml-auto btn-accent dark:border-violet-400 text-white tracking-wider w-fit flex items-center gap-2`}
+ <Button
+ variant="accent"
+ className="ml-auto"
onClick={() => {
setNewSubscriptionModal(true);
}}
>
{t("new_rss_subscription")}
- </button>
+ </Button>
{rssSubscriptions.length > 0 && (
<table className="table mt-2 overflow-x-auto">
<thead>
@@ -63,12 +65,14 @@ export default function RssSubscriptions() {
<td>{rssSubscription.url}</td>
<td>{rssSubscription.collection.name}</td>
<td>
- <button
- className="btn btn-sm btn-ghost btn-square hover:bg-red-500"
+ <Button
+ variant="ghost"
+ size="icon"
+ className="hover:text-error"
onClick={() => openDeleteModal(rssSubscription)}
>
<i className="bi-x text-lg"></i>
- </button>
+ </Button>
</td>
</tr>
))}
diff --git a/apps/web/pages/settings/worker.tsx b/apps/web/pages/settings/worker.tsx
index 32e87c57..005dfaff 100644
--- a/apps/web/pages/settings/worker.tsx
+++ b/apps/web/pages/settings/worker.tsx
@@ -6,6 +6,7 @@ import ConfirmationModal from "@/components/ConfirmationModal";
import { LinkArchiveActionSchemaType } from "@linkwarden/lib/schemaValidation";
import toast from "react-hot-toast";
import { useArchiveAction } from "@linkwarden/router/links";
+import { Button } from "@/components/ui/button";
export default function Worker() {
const { t } = useTranslation();
@@ -58,36 +59,39 @@ export default function Worker() {
<div className="w-full flex flex-col gap-6 justify-between">
<div className="flex flex-col sm:flex-row sm:items-center gap-3">
<span>{t("regenerate_broken_preservations")}</span>
- <button
+ <Button
onClick={() => submit("allBroken")}
- className={`btn btn-sm ml-auto btn-accent dark:border-violet-400 text-white tracking-wider w-fit flex items-center gap-2`}
+ className="ml-auto"
+ variant="primary"
>
{t("confirm")}
- </button>
+ </Button>
</div>
<div className="flex flex-col sm:flex-row sm:items-center gap-3">
<span>{t("delete_all_preservations_and_regenerate")}</span>
- <button
- className={`btn btn-sm ml-auto btn-error text-white tracking-wider w-fit flex items-center gap-2`}
+ <Button
+ className="ml-auto"
+ variant="destructive"
onClick={() => {
setAction("allAndRePreserve");
setShowModal(true);
}}
>
{t("confirm")}
- </button>
+ </Button>
</div>
<div className="flex flex-col sm:flex-row sm:items-center gap-3">
<span>{t("delete_all_preservations")}</span>
- <button
- className={`btn btn-sm ml-auto btn-error text-white tracking-wider w-fit flex items-center gap-2`}
+ <Button
+ className="ml-auto"
+ variant="destructive"
onClick={() => {
setAction("allAndIgnore");
setShowModal(true);
}}
>
{t("confirm")}
- </button>
+ </Button>
</div>
</div>
{showModal && action && (
diff --git a/apps/web/pages/tags/[id].tsx b/apps/web/pages/tags/[id].tsx
index 77c6eb7f..ed4d866f 100644
--- a/apps/web/pages/tags/[id].tsx
+++ b/apps/web/pages/tags/[id].tsx
@@ -11,6 +11,7 @@ import LinkListOptions from "@/components/LinkListOptions";
import { useRemoveTag, useTags, useUpdateTag } from "@linkwarden/router/tags";
import Links from "@/components/LinkViews/Links";
import toast from "react-hot-toast";
+import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuTrigger,
@@ -150,7 +151,7 @@ export default function Index() {
>
<div className="flex gap-3 items-center">
<div className="flex gap-2 items-center font-thin">
- <i className={"bi-hash text-primary text-3xl"} />
+ <i className="bi-hash text-primary text-3xl" />
{renameTag ? (
<form onSubmit={submit} className="flex items-center gap-2">
@@ -161,20 +162,12 @@ export default function Index() {
value={newTagName}
onChange={(e) => setNewTagName(e.target.value)}
/>
- <div
- onClick={() => submit()}
- id="expand-dropdown"
- className="btn btn-ghost btn-square btn-sm"
- >
- <i className={"bi-check2 text-neutral text-xl"}></i>
- </div>
- <div
- onClick={() => cancelUpdateTag()}
- id="expand-dropdown"
- className="btn btn-ghost btn-square btn-sm"
- >
- <i className={"bi-x text-neutral text-xl"}></i>
- </div>
+ <Button variant="ghost" size="icon" onClick={submit}>
+ <i className="bi-check2 text-neutral text-xl" />
+ </Button>
+ <Button variant="ghost" size="icon" onClick={cancelUpdateTag}>
+ <i className="bi-x text-neutral text-xl" />
+ </Button>
</form>
) : (
<>
@@ -182,12 +175,16 @@ export default function Index() {
<div className="relative">
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <button
- className="btn btn-ghost btn-sm btn-square text-neutral"
+ <Button
+ asChild
+ variant="ghost"
+ size="icon"
title={t("more")}
>
- <i className="bi-three-dots text-xl"></i>
- </button>
+ <button>
+ <i className="bi-three-dots text-xl text-neutral" />
+ </button>
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent
@@ -199,24 +196,18 @@ export default function Index() {
}
className="bg-base-200 border border-neutral-content rounded-box p-1"
>
- <DropdownMenuItem
- onClick={() => {
- setRenameTag(true);
- }}
- >
- <i className="bi-pencil-square"></i>
+ <DropdownMenuItem onClick={() => setRenameTag(true)}>
+ <i className="bi-pencil-square" />
{t("rename_tag")}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
- onClick={() => {
- remove();
- }}
+ onClick={remove}
className="text-error"
>
- <i className="bi-trash "></i>
+ <i className="bi-trash" />
{t("delete_tag")}
</DropdownMenuItem>
</DropdownMenuContent>
@@ -237,18 +228,10 @@ export default function Index() {
/>
</div>
{bulkDeleteLinksModal && (
- <BulkDeleteLinksModal
- onClose={() => {
- setBulkDeleteLinksModal(false);
- }}
- />
+ <BulkDeleteLinksModal onClose={() => setBulkDeleteLinksModal(false)} />
)}
{bulkEditLinksModal && (
- <BulkEditLinksModal
- onClose={() => {
- setBulkEditLinksModal(false);
- }}
- />
+ <BulkEditLinksModal onClose={() => setBulkEditLinksModal(false)} />
)}
</MainLayout>
);