Skip to content

Commit

Permalink
update document
Browse files Browse the repository at this point in the history
  • Loading branch information
Stan370 committed Oct 28, 2024
1 parent e5320e1 commit 6697d56
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
37 changes: 37 additions & 0 deletions app/components/DocumentPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import { Button } from "@/components/ui/button"
import { Textarea } from './ui/textarea';


type Props = {
content: string;
};
const DocumentPreview: React.FC<Props> = ({ content }) => {
const handleCopyContent = () => {
navigator.clipboard.writeText(content);
};

const handleDownload = () => {
const blob = new Blob([content], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'generated_document.txt';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
};

return (
<div>
<Textarea className="min-h-64" readOnly value={content} />
<div className='flex justify-between mt-4'>
<Button onClick={handleCopyContent}>Copy to Clipboard</Button>
<Button onClick={handleDownload}>Download Document</Button>
</div>
</div>
);
};

export default DocumentPreview;
4 changes: 0 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ export default function Home() {
property="og:title"
content="TonyChat - Your Personal and Business Chatbot"
/>
<meta
property="og:description"
content="TonyChat is an open-source, multifunctional Chatbot suitable for both personal and business purposes. It allows for customized chatbot deployment, easy model fine-tuning, and ensures safety and privacy."
/>
<meta property="og:type" content="website" />
<meta property="og:image" content="/T_icon.png" />
<meta property="og:url" content="https://www.tonychat.com" />
Expand Down

0 comments on commit 6697d56

Please sign in to comment.