Skip to content

Commit 2171a8a

Browse files
committed
Refactor code structure for improved readability and maintainability
1 parent c4ca6f6 commit 2171a8a

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

admin/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ function OpenFieldsRouter() {
5656
const tab = params.get('tab') as TabType | null;
5757

5858
// Only handle openfields pages
59-
if (!page?.startsWith('openfields')) {
59+
if (!page?.startsWith('codeideal-open-fields')) {
6060
return null;
6161
}
6262

6363
// If editing a fieldset, show the editor directly
64-
if (page === 'openfields' && action === 'edit' && id) {
64+
if (page === 'codeideal-open-fields' && action === 'edit' && id) {
6565
return <FieldsetEditor fieldsetId={parseInt(id, 10)} />;
6666
}
6767

68-
if (page === 'openfields' && action === 'new') {
68+
if (page === 'codeideal-open-fields' && action === 'new') {
6969
return <FieldsetEditor isNew />;
7070
}
7171

admin/src/pages/FieldsetEditor/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function FieldsetEditor({ fieldsetId, isNew }: FieldsetEditorProps) {
9999
// Handle back navigation with unsaved changes check
100100
const handleBackClick = useCallback(() => {
101101
const adminUrl = window.openfieldsAdmin?.adminUrl || '/wp-admin/';
102-
const backUrl = `${adminUrl}admin.php?page=openfields`;
102+
const backUrl = `${adminUrl}admin.php?page=codeideal-open-fields`;
103103

104104
if (unsavedChanges) {
105105
setPendingNavigation(backUrl);
@@ -132,7 +132,7 @@ export function FieldsetEditor({ fieldsetId, isNew }: FieldsetEditorProps) {
132132
} else if (isNew) {
133133
try {
134134
const newFieldset = await createFieldset({ title: 'New Fieldset' });
135-
window.location.href = `admin.php?page=openfields&action=edit&id=${newFieldset.id}`;
135+
window.location.href = `admin.php?page=codeideal-open-fields&action=edit&id=${newFieldset.id}`;
136136
} catch {
137137
showToast('error', 'Failed to create fieldset');
138138
}

admin/src/pages/FieldsetList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ export default function FieldsetList() {
165165

166166
const navigateToEdit = (id: number) => {
167167
const adminUrl = window.openfieldsAdmin?.adminUrl || '/wp-admin/';
168-
window.location.href = `${adminUrl}admin.php?page=openfields&action=edit&id=${id}`;
168+
window.location.href = `${adminUrl}admin.php?page=codeideal-open-fields&action=edit&id=${id}`;
169169
};
170170

171171
const navigateToNew = () => {
172172
const adminUrl = window.openfieldsAdmin?.adminUrl || '/wp-admin/';
173-
window.location.href = `${adminUrl}admin.php?page=openfields&action=new`;
173+
window.location.href = `${adminUrl}admin.php?page=codeideal-open-fields&action=new`;
174174
};
175175

176176
// Get location summary for a fieldset

plugin/assets/admin/js/admin.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)