Skip to content

Commit 86e5920

Browse files
committed
add os checking
1 parent b3f1a6f commit 86e5920

File tree

2 files changed

+65
-25
lines changed

2 files changed

+65
-25
lines changed

src/components/Layout/index.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import AppBar from "@components/AppBar";
22
import SideBar from "@components/SideBar";
33
import { useTheme } from "@hooks/useTheme";
4-
import { Box } from "@mui/material";
4+
import { Box, SxProps } from "@mui/material";
55
import { ReactNode, useEffect } from "react";
66
import { useLocation } from "react-router-dom";
77
import routes from "../../../routes.json";
88

9-
export default function Layout({ children }: { children: ReactNode }) {
9+
export default function Layout({
10+
children,
11+
sx,
12+
}: {
13+
sx?: SxProps;
14+
children: ReactNode;
15+
}) {
1016
const location = useLocation();
1117
const theme = useTheme();
1218
useEffect(() => {
@@ -28,6 +34,7 @@ export default function Layout({ children }: { children: ReactNode }) {
2834
width: "100%",
2935
pt: { xs: 12, sm: 14 },
3036
display: "flex",
37+
...sx,
3138
}}
3239
>
3340
{location.pathname === "/" ? null : <SideBar />}

src/routes/plugins/index.tsx

+56-23
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,76 @@
11
import Layout from "@components/Layout";
22
import { useTheme } from "@hooks/useTheme";
3-
import { Box, Button, Typography } from "@mui/material";
3+
import { Box, Button, Card, Divider, Typography } from "@mui/material";
44

55
const lnreaderPluginsRepo =
66
"https://raw.githubusercontent.com/LNReader/lnreader-plugins/plugins/v3.0.0/.dist/plugins.min.json";
77

88
export default function Plugins() {
99
const theme = useTheme();
10+
const isAndroid = /android/i.test(navigator.userAgent);
11+
1012
return (
1113
<Layout>
12-
<Box sx={{ textAlign: "left", px: { xs: 2, sm: 8 } }}>
14+
<Box
15+
sx={{
16+
textAlign: "left",
17+
px: { xs: 2, sm: 4, md: 16 },
18+
maxWidth: 800,
19+
height: "100vh",
20+
}}
21+
>
1322
<Typography variant="h4" sx={{ fontWeight: "600" }}>
1423
Plugins
1524
</Typography>
16-
<Box sx={{ my: 2, textAlign: "center" }}>
17-
<Button
18-
variant="contained"
25+
<Typography sx={{ mt: 2 }}>
26+
By default, <b>LNReader</b> comes without any plugins. You can choose
27+
to read local content or include an external repository.
28+
</Typography>
29+
<Typography sx={{ mt: 2 }}>
30+
<b>LNReader</b> maintains only one official repository; any other
31+
repositories are unofficial and have no affiliation with us.
32+
</Typography>
33+
{isAndroid ? (
34+
<Box sx={{ my: 2, textAlign: "center" }}>
35+
<Button
36+
variant="contained"
37+
sx={{
38+
borderRadius: 12,
39+
background: theme.primaryContainer,
40+
color: theme.onPrimaryContainer,
41+
textTransform: "none",
42+
}}
43+
href={
44+
"lnreader://repo/add?url=" +
45+
encodeURIComponent(lnreaderPluginsRepo)
46+
}
47+
>
48+
Add repository
49+
</Button>
50+
<Typography sx={{ mt: 2 }}>
51+
Requires <b>LNReader 2.0.0</b> or newer.
52+
</Typography>
53+
</Box>
54+
) : (
55+
<Card
1956
sx={{
20-
borderRadius: 12,
21-
background: theme.primary,
22-
color: theme.onPrimary,
23-
textTransform: "none",
57+
bgcolor: theme.tertiaryContainer,
58+
my: 2,
59+
p: 2,
60+
borderRadius: 2,
2461
}}
25-
href={
26-
"lnreader://repo/add?url=" +
27-
encodeURIComponent(lnreaderPluginsRepo)
28-
}
2962
>
30-
Add repository
31-
</Button>
32-
<Box sx={{ display: "flex", justifyContent: "center", mt: 2 }}>
33-
<Typography>Requires </Typography>
34-
<Typography sx={{ fontWeight: "600", mx: 1 }}>
35-
{" "}
36-
LNReader 2.0.0
63+
<Typography sx={{ mb: 2, fontWeight: "600" }}>
64+
Unsupported operating system
3765
</Typography>
38-
<Typography>or newer.</Typography>
39-
</Box>
40-
</Box>
66+
<Typography sx={{ fontSize: 16 }}>
67+
<b>LNReader</b> is an <b>Android app</b> only. Use an{" "}
68+
<b>Android</b> device with <b>LNReader</b> installed to add this
69+
extension repo.
70+
</Typography>
71+
</Card>
72+
)}
73+
<Divider />
4174
</Box>
4275
</Layout>
4376
);

0 commit comments

Comments
 (0)