Enhance full-page editor layout and integrate form editor actions
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Failing after 6m4s
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Failing after 6m4s
- Updated CSS styles for the full-page editor, introducing a sticky header and mobile dock for improved navigation. - Refactored App component to include FormEditorActionsProvider and FormEditorBottomSlot for better form handling. - Simplified TrainingUnitFormShell by removing the FormActionBar, streamlining the form structure and enhancing usability.
This commit is contained in:
1 parent
734d943d73
commit
6a9351874f
6 files changed
+253
-137
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import React, { createContext, useContext, useEffect, useMemo, useState } from 'react'
|
||||
import FormActionBar from '../components/FormActionBar'
|
||||
|
||||
const FormEditorActionsContext = createContext(null)
|
||||
|
||||
export function FormEditorActionsProvider({ children }) {
|
||||
const [config, setConfig] = useState(null)
|
||||
const value = useMemo(() => ({ config, setConfig }), [config])
|
||||
|
||||
return <FormEditorActionsContext.Provider value={value}>{children}</FormEditorActionsContext.Provider>
|
||||
}
|
||||
|
||||
/** Mobile: FormActionBar statt Bottom-Nav; Desktop: Fallback (Nav ist ohnehin ausgeblendet). */
|
||||
export function FormEditorBottomSlot({ children }) {
|
||||
const ctx = useContext(FormEditorActionsContext)
|
||||
const config = ctx?.config
|
||||
|
||||
if (config) {
|
||||
return (
|
||||
<div className="form-editor-mobile-dock" data-testid="form-editor-mobile-dock">
|
||||
<FormActionBar {...config} placement="bottom" variant="page" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return children
|
||||
}
|
||||
|
||||
/** @param {Record<string, unknown> | null} config FormActionBar-Props */
|
||||
export function useFormEditorActions(config) {
|
||||
const setConfig = useContext(FormEditorActionsContext)?.setConfig
|
||||
|
||||
useEffect(() => {
|
||||
if (!setConfig) return undefined
|
||||
setConfig(config ?? null)
|
||||
return () => setConfig(null)
|
||||
}, [setConfig, config])
|
||||
}
|
||||
Reference in new issue
Block a user