File tree Expand file tree Collapse file tree 2 files changed +21
-11
lines changed Expand file tree Collapse file tree 2 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ export async function POST(req: Request) {
161
161
} ) ;
162
162
await paper . save ( ) ;
163
163
return NextResponse . json (
164
- { status : "success" , url : finalUrl , thumbnailUrl : thumbnailUrl } ,
164
+ { status : "success" , } ,
165
165
{ status : 201 } ,
166
166
) ;
167
167
} catch ( error ) {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import {
36
36
import { Button } from "./ui/button" ;
37
37
import { usePathname } from "next/navigation" ;
38
38
import { useEffect , useState } from "react" ;
39
+ import toast from "react-hot-toast" ;
39
40
40
41
interface Params {
41
42
params : { id : string } ;
@@ -94,7 +95,7 @@ export default function PdfViewer({ url, name }: PdfViewerProps) {
94
95
) }
95
96
</ ZoomIn >
96
97
</ div >
97
- < div className = "flex gap-3 " >
98
+ < div className = "flex gap-5 " >
98
99
< div className = "hidden gap-x-4 md:flex md:items-center" >
99
100
< getFilePluginInstance . Download >
100
101
{ ( props ) => (
@@ -130,15 +131,24 @@ export default function PdfViewer({ url, name }: PdfViewerProps) {
130
131
< div className = "flex justify-center space-x-4" >
131
132
< QR url = { paperPath } > </ QR >
132
133
</ div >
133
- < Button
134
- type = "submit"
135
- size = "sm"
136
- className = "px-3"
137
- onClick = { ( ) => navigator . clipboard . writeText ( paperPath ) }
138
- >
139
- < span className = "sr-only" > Copy</ span >
140
- < Copy />
141
- </ Button >
134
+ < Button
135
+ type = "submit"
136
+ size = "sm"
137
+ className = "px-3"
138
+ onClick = { async ( ) => {
139
+ await toast . promise (
140
+ navigator . clipboard . writeText ( paperPath ) , // This is a promise
141
+ {
142
+ success : "Link copied successfully" ,
143
+ loading : "Copying link..." ,
144
+ error : "Error copying link" ,
145
+ } ,
146
+ ) ;
147
+ } }
148
+ >
149
+ < span className = "sr-only" > Copy</ span >
150
+ < Copy />
151
+ </ Button >
142
152
</ DialogContent >
143
153
</ Dialog >
144
154
</ div >
You can’t perform that action at this time.
0 commit comments