AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
fix(web): clarify share management layout and notebook icon
tianma-ifa7f05b439c60
diff --git a/apps/web/src/components/settings/NotebookShareManagement.tsx b/apps/web/src/components/settings/NotebookShareManagement.tsxindex 971241b5..673c90f1 100644--- a/apps/web/src/components/settings/NotebookShareManagement.tsx+++ b/apps/web/src/components/settings/NotebookShareManagement.tsx@@ -1,5 +1,5 @@import { useQuery } from "@tanstack/react-query";-import { ExternalLink, Globe, LoaderCircle, Settings2 } from "lucide-react";+import { Notebook, LoaderCircle, Plus } from "lucide-react";import { useMemo, useState } from "react";import { useTranslation } from "react-i18next";import { getNotebookDescendantIds, type NotebookShare } from "@edgeever/shared";@@ -11,6 +11,7 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";+import { ShareManagementActions } from "./ShareManagementActions";import { Button } from "@/components/ui/button";import { api, getConfiguredDesktopApiBaseUrl } from "@/lib/api";import {@@ -47,14 +48,14 @@ export const NotebookShareManagement = ({refetchOnMount: "always",});return (- <section className="border-t border-slate-100">- <h3 className="flex items-center gap-2 px-4 pt-4 text-sm font-medium">- <Globe className="h-4 w-4" />- {t("sharing.notebookManagementTitle")}- </h3>- <div className="px-4 pt-3">+ <section aria-labelledby="notebook-shares-heading" className="border-t border-slate-100">+ <div className="flex min-h-14 flex-wrap items-center justify-between gap-2 px-4 py-3">+ <h3 id="notebook-shares-heading" className="flex items-center gap-2 text-xs font-medium text-slate-700">+ <Notebook className="h-4 w-4 text-slate-500" />+ {t("sharing.notebookManagementTitle")}+ </h3>{selecting ? (- <>+ <div className="flex w-full items-center gap-2 sm:w-64"><SelectonValueChange={(id) => {const notebook = options.find((item) => item.id === id);@@ -87,26 +88,27 @@ export const NotebookShareManagement = ({{t("sharing.retry")}</Button>) : null}- </>+ </div>) : (<Buttonsize="sm"variant="outline"onClick={() => setSelecting(true)}>+ <Plus className="h-3.5 w-3.5" />{t("sharing.notebookTitle")}</Button>)}</div>{query.isPending ? (- <div className="p-4">+ <div className="px-4 pb-4"><LoaderCircleclassName="h-4 w-4 animate-spin"aria-label={t("sharing.managementLoading")}/></div>) : query.isError ? (- <div className="space-y-2 p-4">+ <div className="space-y-2 px-4 pb-4"><p role="alert" className="text-xs text-rose-600">{t("sharing.managementLoadFailed")}</p>@@ -119,7 +121,7 @@ export const NotebookShareManagement = ({</Button></div>) : !query.data.shares.length ? (- <p className="p-4 text-xs text-slate-500">+ <p className="px-4 pb-4 text-xs text-slate-500">{t("sharing.notebookManagementEmpty")}</p>) : (@@ -127,35 +129,15 @@ export const NotebookShareManagement = ({{query.data.shares.map((share) => (<divkey={share.notebookId}- className="flex flex-wrap items-center justify-between gap-3 p-4"+ className="flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">- <span className="min-w-0 break-words text-sm">+ <span className="min-w-0 flex-1 break-words text-xs font-medium text-slate-900">{share.notebookName}</span>- <div className="flex gap-2">- <Button- size="sm"- variant="outline"- onClick={() =>- window.open(- getPublicNotebookShareUrl(share.token),- "_blank",- "noopener,noreferrer",- )- }- >- <ExternalLink className="h-3.5 w-3.5" />- {t("sharing.open")}- </Button>- <Button- size="sm"- variant="soft"- onClick={() => setManaged(share)}- >- <Settings2 className="h-3.5 w-3.5" />- {t("sharing.manage")}- </Button>- </div>+ <ShareManagementActions+ onOpen={() => window.open(getPublicNotebookShareUrl(share.token), "_blank", "noopener,noreferrer")}+ onManage={() => setManaged(share)}+ /></div>))}</div>diff --git a/apps/web/src/components/settings/ShareManagementActions.tsx b/apps/web/src/components/settings/ShareManagementActions.tsxnew file mode 100644index 00000000..282b4983--- /dev/null+++ b/apps/web/src/components/settings/ShareManagementActions.tsx@@ -0,0 +1,43 @@+import { Copy, ExternalLink, Settings2 } from "lucide-react";+import { useTranslation } from "react-i18next";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";++type Props = {+ onCopy?: () => void;+ copyLabel?: string;+ onOpen: () => void;+ onManage: () => void;+};++export const ShareManagementActions = ({ onCopy, copyLabel, onOpen, onManage }: Props) => {+ const { t } = useTranslation();+ const copyText = copyLabel ?? t("sharing.copy");++ return (+ <div className="flex shrink-0 items-center gap-1 self-end sm:self-auto">+ {onCopy ? (+ <Tooltip>+ <TooltipTrigger asChild>+ <Button size="icon" variant="ghost" aria-label={copyText} onClick={onCopy}>+ <Copy className="h-3.5 w-3.5" />+ </Button>+ </TooltipTrigger>+ <TooltipContent>{copyText}</TooltipContent>+ </Tooltip>+ ) : null}+ <Tooltip>+ <TooltipTrigger asChild>+ <Button size="icon" variant="ghost" aria-label={t("sharing.open")} onClick={onOpen}>+ <ExternalLink className="h-3.5 w-3.5" />+ </Button>+ </TooltipTrigger>+ <TooltipContent>{t("sharing.open")}</TooltipContent>+ </Tooltip>+ <Button size="sm" variant="outline" className="ml-1" onClick={onManage}>+ <Settings2 className="h-3.5 w-3.5" />{t("sharing.manage")}+ </Button>+ <span className="sr-only" role="status">{copyLabel}</span>+ </div>+ );+};diff --git a/apps/web/src/components/settings/ShareManagementCard.tsx b/apps/web/src/components/settings/ShareManagementCard.tsxindex 19a5fa20..9b5b8da2 100644--- a/apps/web/src/components/settings/ShareManagementCard.tsx+++ b/apps/web/src/components/settings/ShareManagementCard.tsx@@ -1,8 +1,9 @@import { useInfiniteQuery } from "@tanstack/react-query";-import { Copy, ExternalLink, Link2, LoaderCircle, LockKeyhole, Settings2 } from "lucide-react";+import { FileText, Link2, LoaderCircle, LockKeyhole } from "lucide-react";import { useState } from "react";import { useTranslation } from "react-i18next";import type { ManagedMemoShare } from "@edgeever/shared";+import { ShareManagementActions } from "./ShareManagementActions";import { NotebookShareManagement } from "./NotebookShareManagement";import { Button } from "@/components/ui/button";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";@@ -53,65 +54,65 @@ export const ShareManagementCard = ({ userId, onOpenMemo }: Props) => {</CardDescription></CardHeader><CardContent className="p-0">- {sharesQuery.isPending || (sharesQuery.isFetching && !sharesQuery.isFetchingNextPage) ? (- <div className="flex min-h-32 items-center justify-center text-slate-500" role="status">- <LoaderCircle className="h-5 w-5 animate-spin" />- <span className="sr-only">{t("sharing.managementLoading")}</span>+ <section aria-labelledby="memo-shares-heading" className="border-t border-slate-100">+ <div className="flex min-h-14 items-center gap-2 px-4 py-3">+ <FileText className="h-4 w-4 text-slate-500" />+ <h3 id="memo-shares-heading" className="text-xs font-medium text-slate-700">{t("sharing.memoManagementTitle")}</h3></div>- ) : sharesQuery.isError ? (- <div className="space-y-3 border-t border-slate-100 p-4">- <p className="text-xs leading-5 text-rose-600" role="alert">{t("sharing.managementLoadFailed")}</p>- <Button size="sm" variant="outline" onClick={() => void sharesQuery.refetch()}>{t("sharing.retry")}</Button>- </div>- ) : shares.length === 0 ? (- <p className="border-t border-slate-100 p-4 text-xs leading-5 text-slate-500">{t("sharing.managementEmpty")}</p>- ) : (- <div className="divide-y divide-slate-100 border-t border-slate-100">- {shares.map((share) => (- <div key={share.memoId} className="flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between">- <div className="min-w-0">- <button- type="button"- className="block max-w-full truncate text-left text-xs font-medium text-slate-900 hover:text-emerald-700 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500"- onClick={() => onOpenMemo(share.memoId, share.notebookId)}- >- {share.memoTitle?.trim() || t("common.untitledMemo")}- </button>- <p className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-slate-500">- <span>{share.notebookName || t("sharing.unknownNotebook")}</span>- <span aria-hidden="true">·</span>- <span>{t("sharing.sharedOn", { date: formatDate(share.createdAt) })}</span>- {share.passwordProtected ? (- <span className="inline-flex items-center gap-1 text-slate-600">- <LockKeyhole className="h-3 w-3" />{t("sharing.passwordProtected")}- </span>- ) : null}- </p>+ {sharesQuery.isPending || (sharesQuery.isFetching && !sharesQuery.isFetchingNextPage) ? (+ <div className="flex min-h-32 items-center justify-center text-slate-500" role="status">+ <LoaderCircle className="h-5 w-5 animate-spin" />+ <span className="sr-only">{t("sharing.managementLoading")}</span>+ </div>+ ) : sharesQuery.isError ? (+ <div className="space-y-3 px-4 pb-4">+ <p className="text-xs leading-5 text-rose-600" role="alert">{t("sharing.managementLoadFailed")}</p>+ <Button size="sm" variant="outline" onClick={() => void sharesQuery.refetch()}>{t("sharing.retry")}</Button>+ </div>+ ) : shares.length === 0 ? (+ <p className="px-4 pb-4 text-xs leading-5 text-slate-500">{t("sharing.managementEmpty")}</p>+ ) : (+ <div className="divide-y divide-slate-100">+ {shares.map((share) => (+ <div key={share.memoId} className="flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">+ <div className="min-w-0 flex-1">+ <button+ type="button"+ className="block max-w-full truncate text-left text-xs font-medium text-slate-900 hover:text-emerald-700 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500"+ onClick={() => onOpenMemo(share.memoId, share.notebookId)}+ >+ {share.memoTitle?.trim() || t("common.untitledMemo")}+ </button>+ <p className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-slate-500">+ <span>{share.notebookName || t("sharing.unknownNotebook")}</span>+ <span aria-hidden="true">·</span>+ <span>{t("sharing.sharedOn", { date: formatDate(share.createdAt) })}</span>+ {share.passwordProtected ? (+ <span className="inline-flex items-center gap-1 text-slate-600">+ <LockKeyhole className="h-3 w-3" />{t("sharing.passwordProtected")}+ </span>+ ) : null}+ </p>+ </div>+ <ShareManagementActions+ onCopy={() => void copyLink(share)}+ copyLabel={copyResult?.memoId === share.memoId ? t(copyResult.success ? "sharing.copied" : "sharing.copyFailed") : undefined}+ onOpen={() => window.open(getPublicShareUrl(share.token), "_blank", "noopener,noreferrer")}+ onManage={() => setManagedMemoId(share.memoId)}+ /></div>- <div className="flex shrink-0 flex-wrap gap-2">- <Button size="sm" variant="outline" onClick={() => void copyLink(share)}>- <Copy className="h-3.5 w-3.5" />- {copyResult?.memoId === share.memoId ? t(copyResult.success ? "sharing.copied" : "sharing.copyFailed") : t("sharing.copy")}- </Button>- <Button size="sm" variant="outline" onClick={() => window.open(getPublicShareUrl(share.token), "_blank", "noopener,noreferrer")}>- <ExternalLink className="h-3.5 w-3.5" />{t("sharing.open")}- </Button>- <Button size="sm" variant="soft" onClick={() => setManagedMemoId(share.memoId)}>- <Settings2 className="h-3.5 w-3.5" />{t("sharing.manage")}+ ))}+ {sharesQuery.hasNextPage ? (+ <div className="flex justify-center p-4">+ <Button size="sm" variant="outline" disabled={sharesQuery.isFetchingNextPage} onClick={() => void sharesQuery.fetchNextPage()}>+ {sharesQuery.isFetchingNextPage ? <LoaderCircle className="h-3.5 w-3.5 animate-spin" /> : null}+ {t("sharing.loadMore")}</Button></div>- </div>- ))}- {sharesQuery.hasNextPage ? (- <div className="flex justify-center p-4">- <Button size="sm" variant="outline" disabled={sharesQuery.isFetchingNextPage} onClick={() => void sharesQuery.fetchNextPage()}>- {sharesQuery.isFetchingNextPage ? <LoaderCircle className="h-3.5 w-3.5 animate-spin" /> : null}- {t("sharing.loadMore")}- </Button>- </div>- ) : null}- </div>- )}+ ) : null}+ </div>+ )}+ </section><NotebookShareManagement userId={userId} /></CardContent>{managedMemoId ? (diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 5e8c42fe..22776f81 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -2578,6 +2578,7 @@ export const enUS = {notebookNoteUnavailableHint: "This note may have moved outside the public directory, been deleted, or the link is invalid.",notebookWelcome: "Choose a note from the contents to start reading.",notebookEmpty: "This notebook has no notes to read yet.",+ memoManagementTitle: "Note shares",notebookManagementTitle: "Notebook shares",notebookManagementEmpty: "No notebooks are currently shared.",diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.tsindex bd3c758d..77bd2bf2 100644--- a/packages/shared/src/i18n/ja.ts+++ b/packages/shared/src/i18n/ja.ts@@ -2567,6 +2567,7 @@ export const ja = {notebookNoteUnavailableHint: "ノートが公開範囲外に移動・削除されたか、リンクが無効です。",notebookWelcome: "目次からノートを選んでください。",notebookEmpty: "閲覧できるノートがまだありません。",+ memoManagementTitle: "ノートの共有",notebookManagementTitle: "ノートブックの共有",notebookManagementEmpty: "共有中のノートブックはありません。",diff --git a/packages/shared/src/i18n/pl.ts b/packages/shared/src/i18n/pl.tsindex 1ab62490..d08ad466 100644--- a/packages/shared/src/i18n/pl.ts+++ b/packages/shared/src/i18n/pl.ts@@ -2567,6 +2567,7 @@ export const pl = {notebookNoteUnavailableHint: "Notatka mogła zostać przeniesiona poza katalog publiczny, usunięta lub link jest nieprawidłowy.",notebookWelcome: "Wybierz notatkę ze spisu treści, aby rozpocząć czytanie.",notebookEmpty: "Ten notatnik nie ma jeszcze notatek do czytania.",+ memoManagementTitle: "Udostępnione notatki",notebookManagementTitle: "Udostępnione notatniki",notebookManagementEmpty: "Żadne notatniki nie są obecnie udostępniane.",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex 11af92ad..eb7f9e35 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -2576,6 +2576,7 @@ export const zhCN = {notebookNoteUnavailableHint: "这篇笔记可能已移出公开目录、删除,或链接无效。",notebookWelcome: "从目录选择一篇笔记开始阅读。",notebookEmpty: "这个笔记本中还没有可阅读的笔记。",+ memoManagementTitle: "笔记分享",notebookManagementTitle: "笔记本分享",notebookManagementEmpty: "当前没有正在分享的笔记本。",