Skip to content

Commit

Permalink
feat: copy button for ai summary
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Dec 17, 2024
1 parent 0dcfde5 commit b3ee572
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions apps/renderer/src/modules/entry-content/index.shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
useEntryReadabilityContent,
} from "~/atoms/readability"
import { enableShowSourceContent } from "~/atoms/source-content"
import { CopyButton } from "~/components/ui/code-highlighter"
import { Toc } from "~/components/ui/markdown/components/Toc"
import { IconOpacityTransition } from "~/components/ux/transition/icon"
import { isWebBuild } from "~/constants"
Expand Down Expand Up @@ -342,10 +343,18 @@ export function AISummary({ entryId }: { entryId: string }) {
}

return (
<div className="my-8 space-y-1 rounded-lg border px-4 py-3">
<div className="flex items-center gap-2 font-medium text-zinc-800 dark:text-neutral-400">
<i className="i-mgc-magic-2-cute-re align-middle" />
<span>{t("entry_content.ai_summary")}</span>
<div className="group my-8 space-y-1 rounded-lg border px-4 py-3">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2 font-medium text-zinc-800 dark:text-neutral-400">
<i className="i-mgc-magic-2-cute-re align-middle" />
<span>{t("entry_content.ai_summary")}</span>
</div>
{summary.data && (
<CopyButton
value={summary.data}
className="sm:opacity-0 sm:duration-200 sm:group-hover:opacity-100"
/>
)}
</div>
<AutoResizeHeight spring className="text-sm leading-relaxed">
{summary.isLoading ? SummaryLoadingSkeleton : summary.data}
Expand Down

0 comments on commit b3ee572

Please sign in to comment.