@@ -13,13 +13,15 @@ import {
1313 SelectInput ,
1414 TimeInput ,
1515 useTranslate ,
16+ Title ,
1617} from "react-admin" ;
1718import { useWatch } from "react-hook-form" ;
1819import { useParams , useNavigate } from "react-router-dom" ;
1920
2021import RecurringDeleteButton from "./RecurringDeleteButton" ;
2122import { useAppContext } from "../../../../../Context" ;
2223import { RecurringCommand } from "../../../../../synapse/dataProvider" ;
24+ import { useDocTitle } from "../../../../hooks/useDocTitle" ;
2325import { EtkeAttribution } from "../../../EtkeAttribution" ;
2426import { useServerCommands } from "../../../hooks/useServerCommands" ;
2527import { useRecurringCommands } from "../../hooks/useRecurringCommands" ;
@@ -59,6 +61,7 @@ const RecurringCommandEdit = () => {
5961 const pageTitle = isCreating
6062 ? translate ( "etkecc.actions.recurring_title_create" )
6163 : translate ( "etkecc.actions.recurring_title_edit" ) ;
64+ useDocTitle ( pageTitle ) ;
6265
6366 const commandChoices = transformCommandsToChoices ( serverCommands ) ;
6467 const dayOfWeekChoices = [
@@ -144,74 +147,79 @@ const RecurringCommandEdit = () => {
144147 }
145148
146149 return (
147- < Box sx = { { mt : 2 } } >
148- < Button
149- label = { translate ( "etkecc.actions.buttons.back" ) }
150- onClick = { ( ) => navigate ( "/server_actions" ) }
151- startIcon = { < ArrowBackIcon /> }
152- sx = { { mb : 2 } }
153- />
154-
155- < Card >
156- < CardHeader title = { pageTitle } />
157- < CardContent >
158- { command && (
159- < EtkeAttribution >
160- < Alert severity = "info" >
161- < Typography variant = "body1" sx = { { px : 2 } } >
162- { translate ( "etkecc.actions.command_details_intro" ) } { " " }
163- < Link href = { `https://etke.cc/help/extras/scheduler/#${ command . command } ` } target = "_blank" >
164- { `etke.cc/help/extras/scheduler/#${ command . command } ` }
165- </ Link >
166- .
167- </ Typography >
168- </ Alert >
169- </ EtkeAttribution >
170- ) }
171- < Form
172- defaultValues = { command || undefined }
173- onSubmit = { handleSubmit }
174- record = { command || undefined }
175- warnWhenUnsavedChanges
176- >
177- < Box display = "flex" flexDirection = "column" gap = { 2 } >
178- { ! isCreating && (
179- < TextInput readOnly source = "id" label = { translate ( "etkecc.actions.form.id" ) } fullWidth required />
180- ) }
181- < SelectInput
182- source = "command"
183- choices = { commandChoices }
184- label = { translate ( "etkecc.actions.form.command" ) }
185- fullWidth
186- required
187- />
188- < ArgumentsField serverCommands = { serverCommands } />
189- < SelectInput
190- source = "day_of_week"
191- choices = { dayOfWeekChoices }
192- label = { translate ( "etkecc.actions.form.day_of_week" ) }
193- fullWidth
194- required
195- />
196- < TimeInput
197- source = "execution_time"
198- label = { translate ( "etkecc.actions.table.time_utc" ) }
199- fullWidth
200- required
201- />
202- < Box mt = { 2 } display = "flex" justifyContent = "space-between" >
203- < SaveButton
204- label = {
205- isCreating ? translate ( "etkecc.actions.buttons.create" ) : translate ( "etkecc.actions.buttons.update" )
206- }
150+ < >
151+ < Title title = { pageTitle } />
152+ < Box sx = { { mt : 2 } } >
153+ < Button
154+ label = { translate ( "etkecc.actions.buttons.back" ) }
155+ onClick = { ( ) => navigate ( "/server_actions" ) }
156+ startIcon = { < ArrowBackIcon /> }
157+ sx = { { mb : 2 } }
158+ />
159+
160+ < Card >
161+ < CardHeader title = { pageTitle } />
162+ < CardContent >
163+ { command && (
164+ < EtkeAttribution >
165+ < Alert severity = "info" >
166+ < Typography variant = "body1" sx = { { px : 2 } } >
167+ { translate ( "etkecc.actions.command_details_intro" ) } { " " }
168+ < Link href = { `https://etke.cc/help/extras/scheduler/#${ command . command } ` } target = "_blank" >
169+ { `etke.cc/help/extras/scheduler/#${ command . command } ` }
170+ </ Link >
171+ .
172+ </ Typography >
173+ </ Alert >
174+ </ EtkeAttribution >
175+ ) }
176+ < Form
177+ defaultValues = { command || undefined }
178+ onSubmit = { handleSubmit }
179+ record = { command || undefined }
180+ warnWhenUnsavedChanges
181+ >
182+ < Box display = "flex" flexDirection = "column" gap = { 2 } >
183+ { ! isCreating && (
184+ < TextInput readOnly source = "id" label = { translate ( "etkecc.actions.form.id" ) } fullWidth required />
185+ ) }
186+ < SelectInput
187+ source = "command"
188+ choices = { commandChoices }
189+ label = { translate ( "etkecc.actions.form.command" ) }
190+ fullWidth
191+ required
207192 />
208- { ! isCreating && < RecurringDeleteButton /> }
193+ < ArgumentsField serverCommands = { serverCommands } />
194+ < SelectInput
195+ source = "day_of_week"
196+ choices = { dayOfWeekChoices }
197+ label = { translate ( "etkecc.actions.form.day_of_week" ) }
198+ fullWidth
199+ required
200+ />
201+ < TimeInput
202+ source = "execution_time"
203+ label = { translate ( "etkecc.actions.table.time_utc" ) }
204+ fullWidth
205+ required
206+ />
207+ < Box mt = { 2 } display = "flex" justifyContent = "space-between" >
208+ < SaveButton
209+ label = {
210+ isCreating
211+ ? translate ( "etkecc.actions.buttons.create" )
212+ : translate ( "etkecc.actions.buttons.update" )
213+ }
214+ />
215+ { ! isCreating && < RecurringDeleteButton /> }
216+ </ Box >
209217 </ Box >
210- </ Box >
211- </ Form >
212- </ CardContent >
213- </ Card >
214- </ Box >
218+ </ Form >
219+ </ CardContent >
220+ </ Card >
221+ </ Box >
222+ </ >
215223 ) ;
216224} ;
217225
0 commit comments