1
1
import Layout from "@components/Layout" ;
2
2
import Page from "@components/Page" ;
3
3
import { useTheme } from "@hooks/useTheme" ;
4
- import { Box , Button , Divider , Typography } from "@mui/material" ;
4
+ import { Box , Button , Divider , IconButton , Typography } from "@mui/material" ;
5
+ import ContentCopyIcon from "@mui/icons-material/ContentCopy" ;
6
+ import { useState } from "react" ;
7
+ import DoneIcon from "@mui/icons-material/Done" ;
5
8
6
9
const lnreaderPluginsRepo =
7
10
"https://raw.githubusercontent.com/LNReader/lnreader-plugins/plugins/v3.0.0/.dist/plugins.min.json" ;
8
11
9
12
export default function Plugins ( ) {
10
13
const theme = useTheme ( ) ;
11
14
15
+ const [ copied , setCopied ] = useState ( false ) ;
16
+
17
+ const onCopy = ( ) => {
18
+ navigator . clipboard . writeText ( lnreaderPluginsRepo ) . then ( ( ) => {
19
+ setCopied ( true ) ;
20
+ setTimeout ( ( ) => setCopied ( false ) , 2000 ) ;
21
+ } ) ;
22
+ } ;
23
+
12
24
return (
13
25
< Layout >
14
26
< Page
15
27
title = "Plugins"
16
28
content = {
17
- < Box >
29
+ < Box sx = { { position : "relative" } } >
18
30
< Typography sx = { { mt : 2 } } >
19
31
By default, < b > LNReader</ b > comes without any plugins. You can
20
32
choose to read local content or include an external repository.
@@ -23,14 +35,15 @@ export default function Plugins() {
23
35
< b > LNReader</ b > maintains only one official repository; any other
24
36
repositories are unofficial and have no affiliation with us.
25
37
</ Typography >
26
- < Box sx = { { my : 2 , textAlign : "center" } } >
38
+ < Box sx = { { my : 2 , textAlign : "center" , position : "relative" } } >
27
39
< Button
28
40
variant = "contained"
29
41
sx = { {
30
42
borderRadius : 12 ,
31
43
background : theme . primaryContainer ,
32
44
color : theme . onPrimaryContainer ,
33
45
textTransform : "none" ,
46
+ mr : 1 ,
34
47
} }
35
48
href = {
36
49
"lnreader://repo/add?url=" +
@@ -39,6 +52,11 @@ export default function Plugins() {
39
52
>
40
53
Add repository
41
54
</ Button >
55
+
56
+ < IconButton disabled = { copied } onClick = { onCopy } color = "primary" >
57
+ { copied ? < DoneIcon /> : < ContentCopyIcon /> }
58
+ </ IconButton >
59
+
42
60
< Typography sx = { { mt : 2 } } >
43
61
Requires < b > LNReader 2.0.0</ b > or newer.
44
62
</ Typography >
0 commit comments