1
1
import Layout from "@components/Layout" ;
2
- import { Typography } from "@mui/material" ;
2
+ import Page from "@components/Page" ;
3
+ import { useTheme } from "@hooks/useTheme" ;
4
+ import { Typography , Box , Button , Divider , List , ListItem , ListItemIcon , ListItemText } from "@mui/material" ;
5
+ import { Code as CodeIcon , Android as AndroidIcon , Brush as BrushIcon } from '@mui/icons-material' ;
6
+
7
+ const Section = ( { title, children } : { title : string ; children : React . ReactNode } ) => (
8
+ < Box sx = { { mb : 4 } } >
9
+ < Typography variant = "h6" gutterBottom sx = { { fontWeight : '600' , mt : 3 , mb : 2 } } >
10
+ { title }
11
+ </ Typography >
12
+ { children }
13
+ </ Box >
14
+ ) ;
15
+
16
+ const CodeBlock = ( { children } : { children : React . ReactNode } ) => {
17
+ const theme = useTheme ( ) ;
18
+ return (
19
+ < Box
20
+ sx = { {
21
+ bgcolor : theme . surfaceVariant ,
22
+ color : theme . onSurfaceVariant ,
23
+ p : 2 ,
24
+ borderRadius : 1 ,
25
+ fontFamily : 'monospace' ,
26
+ fontSize : '0.875rem' ,
27
+ overflowX : 'auto' ,
28
+ mb : 2 ,
29
+ } }
30
+ >
31
+ { children }
32
+ </ Box >
33
+ ) ;
34
+ } ;
3
35
4
36
export default function Contribute ( ) {
37
+ const theme = useTheme ( ) ;
38
+
39
+ const content = (
40
+ < Box >
41
+ < Typography sx = { { mt : 2 } } >
42
+ Contributions to < b > LNReader</ b > are welcome and greatly appreciated! Follow the guide below to get started.
43
+ </ Typography >
44
+
45
+ < Section title = "Setting up your environment" >
46
+ < Typography sx = { { mb : 2 } } >
47
+ After forking to your own GitHub org or account, follow these steps to get started:
48
+ </ Typography >
49
+ < List >
50
+ < ListItem >
51
+ < ListItemIcon > < CodeIcon /> </ ListItemIcon >
52
+ < ListItemText
53
+ primary = "Node.js version <= 16.13.1"
54
+ secondary = "For version management, we recommend using nvm"
55
+ secondaryTypographyProps = { { color : theme . onSurface } }
56
+ />
57
+ </ ListItem >
58
+ < ListItem >
59
+ < ListItemIcon > < CodeIcon /> </ ListItemIcon >
60
+ < ListItemText
61
+ primary = "Java SDK version <= 11"
62
+ secondary = "For version management, you can optionally use jenv"
63
+ secondaryTypographyProps = { { color : theme . onSurface } }
64
+ />
65
+ </ ListItem >
66
+ < ListItem >
67
+ < ListItemIcon > < AndroidIcon /> </ ListItemIcon >
68
+ < ListItemText
69
+ primary = "Android SDK"
70
+ secondary = { < > Download from < a href = "https://developer.android.com/studio" target = "_blank" rel = "noopener noreferrer" > Android Studio</ a > </ > }
71
+ secondaryTypographyProps = { { color : theme . onSurface } }
72
+ />
73
+ </ ListItem >
74
+ </ List >
75
+ </ Section >
76
+
77
+ < Section title = "Quick Start Steps" >
78
+ < List >
79
+ < ListItem >
80
+ < ListItemText
81
+ primary = "Clone your fork to your local machine:"
82
+ secondary = {
83
+ < CodeBlock >
84
+ git clone https://github.com/<your-username>/lnreader.git
85
+ </ CodeBlock >
86
+ }
87
+ />
88
+ </ ListItem >
89
+ < ListItem >
90
+ < ListItemText
91
+ primary = "Step into the local repository:"
92
+ secondary = {
93
+ < CodeBlock >
94
+ cd lnreader
95
+ </ CodeBlock >
96
+ }
97
+ />
98
+ </ ListItem >
99
+ < ListItem >
100
+ < ListItemText
101
+ primary = "Install dependencies:"
102
+ secondary = {
103
+ < CodeBlock >
104
+ npm install
105
+ </ CodeBlock >
106
+ }
107
+ />
108
+ </ ListItem >
109
+ < ListItem >
110
+ < ListItemText
111
+ primary = "Build the APK:"
112
+ secondary = {
113
+ < CodeBlock >
114
+ npm run buildRelease
115
+ </ CodeBlock >
116
+ }
117
+ />
118
+ </ ListItem >
119
+ </ List >
120
+ </ Section >
121
+
122
+ < Section title = "Developing on Android" >
123
+ < Typography sx = { { mb : 2 } } >
124
+ You will need an Android device or emulator connected to your computer as well as an IDE of your choice (e.g., VSCode).
125
+ </ Typography >
126
+ < List >
127
+ < ListItem >
128
+ < ListItemIcon > < AndroidIcon /> </ ListItemIcon >
129
+ < ListItemText
130
+ primary = "ADB (Android Debug Bridge)"
131
+ secondary = { < > < a href = "https://developer.android.com/studio/command-line/adb" target = "_blank" rel = "noopener noreferrer" > Android Developer site</ a > </ > }
132
+ secondaryTypographyProps = { { color : theme . onSurface } }
133
+ />
134
+ </ ListItem >
135
+ < ListItem >
136
+ < ListItemIcon > < CodeIcon /> </ ListItemIcon >
137
+ < ListItemText primary = "IDE of your choice" />
138
+ </ ListItem >
139
+ </ List >
140
+ < Typography sx = { { mt : 2 , mb : 1 } } >
141
+ Development Steps:
142
+ </ Typography >
143
+ < Typography sx = { { mt : 2 , mb : 1 } } >
144
+ Check if Android device/emulator is connected:
145
+ </ Typography >
146
+ < CodeBlock >
147
+ adb devices
148
+ </ CodeBlock >
149
+ < Typography sx = { { mt : 2 , mb : 1 } } >
150
+ Run Metro for development:
151
+ </ Typography >
152
+ < CodeBlock >
153
+ npm start
154
+ </ CodeBlock >
155
+ < Typography sx = { { mt : 2 , mb : 1 } } >
156
+ View on your Android device (run in a new terminal):
157
+ </ Typography >
158
+ < CodeBlock >
159
+ npm run android
160
+ </ CodeBlock >
161
+ < Typography sx = { { mt : 2 , mb : 1 } } >
162
+ To view changes to the app with new code, save your code and press "r" on the Metro terminal to reload it. The app on the Android device/emulator will reload shortly.
163
+ </ Typography >
164
+ </ Section >
165
+
166
+ < Section title = "Style & Linting" >
167
+ < Typography sx = { { mb : 2 } } >
168
+ This codebase's linting rules are enforced using < a href = "http://eslint.org/" target = "_blank" rel = "noopener noreferrer" > ESLint</ a > .
169
+ </ Typography >
170
+ < Typography sx = { { mb : 2 } } >
171
+ It is recommended that you install an ESLint plugin for your editor of choice when working on this codebase. However, you can always check if the source code is compliant by running:
172
+ </ Typography >
173
+ < CodeBlock >
174
+ npm run lint
175
+ </ CodeBlock >
176
+ </ Section >
177
+
178
+ < Box sx = { { my : 4 , textAlign : "center" } } >
179
+ < Button
180
+ variant = "contained"
181
+ startIcon = { < BrushIcon /> }
182
+ sx = { {
183
+ borderRadius : 12 ,
184
+ background : theme . primaryContainer ,
185
+ color : theme . onPrimaryContainer ,
186
+ textTransform : "none" ,
187
+ } }
188
+ href = "https://github.com/LNReader/lnreader/fork"
189
+ target = "_blank"
190
+ rel = "noopener noreferrer"
191
+ >
192
+ Start Contributing
193
+ </ Button >
194
+ </ Box >
195
+ < Divider />
196
+ </ Box >
197
+ ) ;
198
+
5
199
return (
6
200
< Layout >
7
- < Typography > Contribute</ Typography >
201
+ < Page
202
+ title = "Contribute"
203
+ content = { content }
204
+ />
8
205
</ Layout >
9
206
) ;
10
- }
207
+ }
0 commit comments