mirror of https://github.com/usememos/memos.git
feat(web): add delete all unused attachments button
This commit is contained in:
parent
d69435c97c
commit
ea40bac090
|
|
@ -5,3 +5,4 @@ dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
src/types/proto/store
|
src/types/proto/store
|
||||||
|
.vscode
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { includes } from "lodash-es";
|
import { includes } from "lodash-es";
|
||||||
import { PaperclipIcon, SearchIcon } from "lucide-react";
|
import { PaperclipIcon, SearchIcon, Trash } from "lucide-react";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { toast } from "react-hot-toast";
|
import { toast } from "react-hot-toast";
|
||||||
|
|
@ -155,13 +155,26 @@ const Attachments = observer(() => {
|
||||||
{unusedAttachments.length > 0 && (
|
{unusedAttachments.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<Separator />
|
<Separator />
|
||||||
<div className="w-full flex flex-row justify-start items-start">
|
<div className="w-full">
|
||||||
<div className="w-16 sm:w-24 sm:pl-4 flex flex-col justify-start items-start"></div>
|
<div className="w-full flex flex-col sm:flex-row sm:justify-between sm:items-center gap-2">
|
||||||
<div className="w-full max-w-[calc(100%-4rem)] sm:max-w-[calc(100%-6rem)] flex flex-row justify-start items-start gap-4 flex-wrap">
|
<div className="flex flex-row items-center gap-2">
|
||||||
<div className="w-full flex flex-row justify-start items-center gap-2">
|
|
||||||
<span className="text-muted-foreground">{t("resource.unused-resources")}</span>
|
<span className="text-muted-foreground">{t("resource.unused-resources")}</span>
|
||||||
<span className="text-muted-foreground opacity-80">({unusedAttachments.length})</span>
|
<span className="text-muted-foreground opacity-80">({unusedAttachments.length})</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
variant="destructive"
|
||||||
|
onClick={() => {
|
||||||
|
alert("TODO: implement dialog confirmation");
|
||||||
|
}}
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
<Trash />
|
||||||
|
{t("resource.delete-all-unused")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="mt-6 flex flex-row flex-wrap gap-4">
|
||||||
{unusedAttachments.map((attachment) => {
|
{unusedAttachments.map((attachment) => {
|
||||||
return (
|
return (
|
||||||
<div key={attachment.name} className="w-24 sm:w-32 h-auto flex flex-col justify-start items-start">
|
<div key={attachment.name} className="w-24 sm:w-32 h-auto flex flex-col justify-start items-start">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue