Commit Graph

10 Commits

Author SHA1 Message Date
MehrdadAdabi
43e2957c22 fix bugs 2025-11-26 19:12:57 +03:30
MehrdadAdabi
70959e878f refactor: Simplify validation logic and adjust campaign steps service parameters 2025-11-26 18:45:57 +03:30
MehrdadAdabi
bbb6bfb7f7 feat: Introduce new dynamic field properties and refine form handling
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.
2025-11-26 18:15:48 +03:30
MehrdadAdabi
6634ecfda7 feat(dropdown): Add async option fetching and improve search
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.
2025-11-25 16:59:12 +03:30
MehrdadAdabi
d725c1b7d7 feat: Implement searchable dropdown component and refactor campaign page
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.
2025-11-25 13:42:19 +03:30
MehrdadAdabi
024b268000 refactor: remove unused code and clean up query usage in dashboard and profile pages 2025-11-24 17:00:25 +03:30
MehrdadAdabi
f9ced9349b feat: enhance dashboard layout with user profile header and mobile navbar
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
2025-11-24 16:58:35 +03:30
MehrdadAdabi
ce4c33d46d feat: Implement dashboard profile card and campaigns management
- 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.
2025-11-23 18:10:30 +03:30
MehrdadAdabi
d9d97da7da Add react-toastify for notifications and enhance OTP handling in LoginPage 2025-11-22 19:22:04 +03:30
MehrdadAdabi
38263c7a74 init 2025-11-22 16:42:06 +03:30