The `onClick` handler on the full-screen dialog overlay has been commented out.
This change prevents the dialog from closing automatically when a user clicks
anywhere outside the main dialog content, but within the overlay area.
This allows for dialogs that require explicit user action to dismiss,
providing more control over dialog persistence for specific use cases.
This commit introduces new capabilities for dynamic forms and refactors related components for improved type safety and data fetching.
- **`src/core/utils/dynamic-field.utils.ts`**:
- Added `Description` and `Required` properties to the `FieldDefinition` interface to allow for more detailed field configurations and validation.
- Narrowed the `Type` property from `number | string` to `number` for stricter type enforcement.
- **`src/core/components/base/form-field.tsx`**:
- Applied non-null assertion operators (`!`) and optional chaining (`?.`) to `field.MinValue`, `field.MaxValue`, `field.Length`, and `field.Type`. This improves type safety and handles cases where these properties might be undefined according to the updated `FieldDefinition`.
- **`src/core/service/api-address.ts`**:
- Added `index2: "workflow/index2"` to `API_ADDRESS` to support a new workflow data endpoint.
- **`src/modules/dashboard/pages/campaigns/detail.tsx`**:
- Updated the campaign detail page to display `campaign.user_id_nickname` instead of `campaign.nickname` for accurate user identification.
- **`src/modules/dashboard/pages/step-form/index.tsx`**:
- Refactored dynamic form data fetching to use `fetchFieldIndex` and `fetchFielSecondeIndex` services.
- Switched from `useParams` to `useSearchParams` for more flexible parameter handling in the step form.
This commit introduces the ability to fetch dropdown options asynchronously, enhancing the component's flexibility for large datasets or dynamic content.
Key changes include:
- **`fetchOptions` prop:** A new prop `fetchOptions` is added to allow external functions to provide options based on the current search query.
- **Internal state for options:** `internalOptions` state is introduced to manage options, which can be populated either from the initial `options` prop or by `fetchOptions`.
- **Loading state:** `isLoading` state is added to indicate when options are being fetched.
- **Improved search handling:** The `handleSearchInputChange` function now triggers `fetchOptions` when available, allowing real-time filtering from an external source.
- **Option type update:** The `Option` type now uses `name` instead of `label` for consistency.
- **Selected option display:** The displayed selected option now uses `value` instead of `label` for consistency.
These changes make the `BaseDropdown` component more robust and adaptable to various data sources, especially for scenarios requiring dynamic or remote option loading.
This commit introduces a new `BaseDropdown` component with search functionality and refactors the campaign listing page to utilize this new component and improve its layout.
The `BaseDropdown` component was significantly refactored from a native `<select>` element to a custom component built with `div` and `input` elements. This allows for:
- **Search functionality**: Users can now type to filter dropdown options.
- **Improved accessibility**: Custom handling of focus and keyboard navigation.
- **Enhanced styling**: More control over the visual appearance.
The campaign listing page (`src/pages/campaigns/index.tsx`) was updated to:
- Replace the previous dropdowns with the new `BaseDropdown` component.
- Adjust the layout of the header, search bar, and filter section for better responsiveness and visual appeal.
- Update the `VITE_API_URL` in `.env` to ensure a newline at the end of the file.
These changes enhance the user experience by providing a more interactive and user-friendly way to select options and navigate the campaign page.
feat: update campaign types to include user_id_nickname and add comments and signature item interfaces
feat: improve campaign detail page with comments functionality and remove comment feature
feat: refactor campaigns page to use new campaign service and update tab labels to Persian
feat: enhance user profile page with image upload functionality and improved form handling
fix: update router paths for campaign detail page
feat: implement user authentication context and protected route handling
feat: add global types for token management
feat: create utility functions for image handling and uploading
- Added ProfileCard component to display user profile information.
- Created DashboardLayout for consistent layout structure.
- Defined Campaign and related types for campaign management.
- Developed CampaignDetailPage for viewing individual campaign details.
- Implemented CampaignsPage for listing and filtering campaigns.
- Enhanced DashboardPage with user profile fetching and navigation.
- Built RegisterPage for user profile registration and updates.
- Added user service for fetching and updating user profiles.
- Established campaigns service for managing campaign data and interactions.
- Updated routing constants and router configuration for new pages.