Skip to content

fix: resolve all issues#120

Merged
theaminulai merged 36 commits intodevelopmentfrom
aminul/dev
Jan 16, 2026
Merged

fix: resolve all issues#120
theaminulai merged 36 commits intodevelopmentfrom
aminul/dev

Conversation

@theaminulai
Copy link
Owner

No description provided.

theaminulai and others added 25 commits December 2, 2025 12:54
Updated API-DOCUMENTATION.md and ARCHITECTURE.md to provide concise quick references, improved endpoint and data structure explanations, and streamlined architecture overview. Also clarified authentication, error handling, and feature extension steps. Minor workflow message tweak in copilot-pr-review.yml for improved PR description context.
The workflow now triggers on both 'opened' and 'synchronize' pull request events. Added 'issues: write' permission to support future enhancements.
Enhanced the script to better detect empty/template PR bodies by refining comment and issue reference removal. Added extraction of issue references (Closes/Fixes/Resolves) from PR body and included them in the generated PR description. Cleaned up Copilot assignment step messaging.
The user engagement section in the README was updated to remove the 💬 emoji for a cleaner presentation.
Standardized code formatting across JS and SCSS files, including consistent spacing and improved readability. Updated ESLint rules for React and accessibility, and added a Stylelint configuration for SCSS linting. Minor import and formatting cleanups in React components and hooks.
Added new ESLint rules including @wordpress/dependency-group, @wordpress/i18n-text-domain with allowedTextDomain 'pageflash', react/jsx-boolean-value, and unicorn/no-abusive-eslint-disable to enforce stricter code standards and improve maintainability.
The ESLint rule 'react-hooks/exhaustive-deps' is no longer disabled, allowing it to be enforced in the codebase.
Deleted GEMINI.md, which contained comprehensive coding standards and best practices for AI-assisted development of the PageFlash WordPress plugin.
…size intelligent page preloading and enhance user experience.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 15, 2026 16:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements a comprehensive refactoring of the PageFlash plugin, addressing multiple architectural and organizational improvements. The changes include namespace reorganization, dynamic menu generation from landmark data, state management enhancements, and UI component refactoring.

Changes:

  • Namespace change from PageFlash to TheAminul\PageFlash across all PHP files
  • SCSS restructuring with new common root styles and class name updates
  • Dynamic landmark-based menu system with custom merge functionality
  • New React hooks (useDebounce, useLandmarkMenus) and utility functions
  • Enhanced state management with UPDATE_LANDMARK action
  • Landmark sync manager for merging defaults with stored options
  • Refactored landmark components with input field support

Reviewed changes

Copilot reviewed 46 out of 47 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
plugin.php, composer.json, autoload.php Updated namespace to TheAminul\PageFlash
src/scss/admin/common/_root.scss Extracted common styles (reset, fonts, toast, component styling)
src/scss/admin/_general.scss Renamed class from pageflash-general to pageflash-body
src/scss/admin.scss Refactored to import root styles, removed duplicated CSS
src/admin/utils/mergeMenus.js New utility to merge landmark and custom menus with sorting
src/admin/utils/formatSelectOptions.js New utility to format options for SelectControl
src/admin/hooks/useDebounce.js New debounce hook for input field performance
src/admin/hooks/useLandmarkMenus.js Extracts dynamic menus from landmark data
src/admin/reducers/rootReducer.js Added UPDATE_LANDMARK action handler
src/admin/reducers/initialState.js Changed landmarks from array to object
src/admin/hooks/usePutLandmarkSlug.js Added local state update with dispatch
src/admin/constants/menuIcons.jsx Extracted menu icons to separate file
src/admin/components/landmark/LandmarkMenu.jsx Generic component replacing specific landmark components
src/admin/components/landmark/LandmarkInput.jsx New component handling various input types with debouncing
src/admin/common/Select.jsx, FormField.jsx New reusable form components
src/admin/common/Switch.jsx Added children support for nested inputs
src/admin/components/header/* Updated to receive dynamic menus as props
src/admin/AdminDashboard.jsx Dynamic route generation based on merged menus
includes/Landmark/LandmarkSyncManager.php New class for syncing landmark defaults with stored options
includes/Landmark/LandmarkList.php Added menu metadata (menuOrder, menuLabel) to landmarks
includes/Landmark/LandmarkAPI.php Returns only data array instead of full structure
dev-docs/FUNCTION_NAMING_GUIDE.md New comprehensive function naming guidelines document

@@ -0,0 +1,28 @@
import { useEffect, useState } from 'react';
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import should use '@wordpress/element' instead of 'react' to maintain consistency with the WordPress ecosystem and the coding guidelines. This inconsistency can be seen in other files like LandmarkInput.jsx which correctly imports from '@wordpress/element'.

Copilot uses AI. Check for mistakes.

const WithHeaderLayout = () => {
const WithHeaderLayout = ({ menus }) => {
console.log('menus in WithHeaderLayout:', menus);
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console.log statement should be removed from production code. Debug logging statements should not be committed to the codebase.

Copilot uses AI. Check for mistakes.

function AdminDashboard() {
const { menus: landmarkMenus, loading } = useLandmarkMenus();
console.log('Landmark menus:', landmarkMenus);
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console.log statement should be removed from production code. Debug logging statements should not be committed to the codebase.

Suggested change
console.log('Landmark menus:', landmarkMenus);

Copilot uses AI. Check for mistakes.
try {
const response = await apiFetch( {
path: `/pageflash/v1/landmark/${ slug }`,
console.log('Sending update request:', { slug, updateData });
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console.log statements (lines 28 and 36) should be removed from production code. Debug logging statements should not be committed to the codebase.

Copilot uses AI. Check for mistakes.
Comment on lines 28 to 35
useEffect(() => {
if (
(field.type === 'text' || field.type === 'textarea' || field.type === 'input') &&
debouncedValue !== (field.value ?? field.default ?? '')
) {
handleInputChange(slug, inputKey, debouncedValue);
}
}, [debouncedValue]);
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dependencies in useEffect hook. The dependency array should include 'slug', 'inputKey', 'field.type', 'field.value', 'field.default', and 'handleInputChange'. Consider wrapping handleInputChange in useCallback to avoid adding it as a dependency, or move it inside the useEffect.

Copilot uses AI. Check for mistakes.
icon={icon}
onClick={() => {
onButtonClick(slug);
navigate(index === 0 ? '/' : `/${slug}`);
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigation logic using index comparison is fragile. If menu order changes, the first menu might not be the one at index 0. Consider explicitly checking for the default/home menu slug instead of relying on index position.

Copilot uses AI. Check for mistakes.
return (
<Route
key={menu.slug}
path={index === 0 ? '/' : `/${menu.slug}`}
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Route path logic using index comparison is fragile and duplicates the same logic found in MenuList.jsx. Consider extracting this into a utility function or explicitly checking for a 'home' or 'default' menu slug.

Copilot uses AI. Check for mistakes.
* @returns {JSX.Element} Rendered landmark menu
*/
const LandmarkMenu = ({ menuSlug }) => {
const { landmarks, loading, error } = useGetLandmarks();
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable loading.

Suggested change
const { landmarks, loading, error } = useGetLandmarks();
const { landmarks } = useGetLandmarks();

Copilot uses AI. Check for mistakes.
* @returns {JSX.Element} Rendered landmark menu
*/
const LandmarkMenu = ({ menuSlug }) => {
const { landmarks, loading, error } = useGetLandmarks();
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable error.

Suggested change
const { landmarks, loading, error } = useGetLandmarks();
const { landmarks } = useGetLandmarks();

Copilot uses AI. Check for mistakes.
*/
const LandmarkMenu = ({ menuSlug }) => {
const { landmarks, loading, error } = useGetLandmarks();
const { updateLandmark, loading: updating } = usePutLandmarkSlug();
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable updating.

Suggested change
const { updateLandmark, loading: updating } = usePutLandmarkSlug();
const { updateLandmark } = usePutLandmarkSlug();

Copilot uses AI. Check for mistakes.
Standardized code style across admin components, hooks, and utilities by normalizing spacing, destructuring, and function signatures. Added internal dependency comments to index files for clarity. Improved menu merging, landmark input handling, and select option formatting. Removed unnecessary console logs and enhanced documentation for better maintainability.
Added consistent docblock comments to indicate WordPress, external, and internal dependencies at the top of all relevant source files. This improves code readability and maintainability by clarifying the origin of each import.
Standardized code formatting, improved JSDoc comments, and enhanced code consistency across admin components, hooks, and utilities. Updated function signatures, parameter formatting, and export statements for better readability and maintainability. No functional changes were made.
Reorganized import statements in LandmarkInput.jsx for clarity by grouping external dependencies together. Updated _root.scss to improve class structure and nesting for .pageflash-switch and .pageflash-select, enhancing maintainability and consistency.
Improves JSDoc consistency and clarity across multiple components and utility files. Updates parameter and return annotations, simplifies some function signatures, and standardizes code formatting for better readability and maintainability.
Moved .pageflash-select styles above .pageflash-switch for better organization and removed duplicate .pageflash-select block at the end of the file.
Replaced async/await with promise-based handling in landmark input, menu, and hooks. This change improves error handling and consistency by using .then() and .catch() for API calls and toast notifications.
Added type validation and explicit boolean return value to pageflash_sync_properties. Now uses serialize for deep comparison before updating options, ensuring updates only occur when necessary. Minor code style improvements and docblock updates for clarity.
Replaced static strings with translation functions in PHP config arrays and React admin components to support internationalization. Updated menu labels, button texts, and loading indicators to use WordPress i18n. Also made minor code style improvements and clarified comments in LandmarkSyncManager.
Reformatted the LandmarkSyncManager class to use consistent tab-based indentation, improving code readability and maintaining coding standards. No functional changes were made.
@theaminulai theaminulai merged commit 3d9dc3e into development Jan 16, 2026
1 of 4 checks passed
github-actions bot added a commit that referenced this pull request Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant