# FINEART Plugin v3.2 - Menu Reorganization & Edit Gallery

## Overview
This update reorganizes the artist dashboard menu structure and adds a new "Edit your gallery" page where artists can manage their public gallery profile information.

## Menu Structure Changes

### New Menu Organization

**Your Account** (renamed from "Artist Profile")
- Legal informations
- Account informations (renamed from "Profile informations")
- Artist Signature
- Payment method (links to /dashboard/vendor-billing/)
- Payment History (links to /dashboard/transaction-details/)

**Your Gallery** (NEW)
- Edit your gallery (NEW PAGE)
- Share your gallery (moved from standalone menu)

**Your Artworks** (renamed from "Artwork Manager")
- My artworks
- Submit New Artworks
- File Reviewal

**Orders** (unchanged position)

**Removed Menus:**
- "Payments" menu and all its submenus (moved to Your Account)
- "Share your Gallery" as standalone (moved to Your Gallery submenu)

**Bottom Menu Items** (unchanged):
- Send a suggestion
- FINEART News
- Log Out

## New Feature: Edit Your Gallery Page

### Location
`/dashboard/edit-gallery/`

### Fields

1. **Your gallery name**
   - Type: Text input
   - Meta: `shop_main_title`
   - Description: The public name of your gallery
   - Required: Yes

2. **Short Bio**
   - Type: Textarea
   - Meta: `afterproducttext`
   - Max words: 30
   - Description: A short paragraph appearing below your gallery's banner
   - Word counter: Shows current/max words, turns red when exceeded

3. **Artist Image**
   - Type: Image upload with cropping
   - Meta: `artist_image` (URL) and `artist_image_id` (attachment ID)
   - Ratio: 1:1 (square)
   - Description: Your artist profile photo
   - Features:
     - JavaScript-based image cropper (Cropper.js)
     - Live preview
     - Enforces 1:1 aspect ratio
     - Output size: 800x800px
     - Accepts: JPG, PNG

4. **Long Bio**
   - Type: Textarea
   - Meta: `description`
   - Max words: 120
   - Description: A paragraph about yourself, appearing in the Artist's Story section
   - Word counter: Shows current/max words, turns red when exceeded
   - Note: Respects paragraphs but no HTML allowed

5. **Social Links**
   - Instagram (meta: `instagram`)
   - Website (meta: `user_url`)
   - LinkedIn (meta: `linkedin`)
   - Facebook (meta: `facebook`)
   - All fields are URL inputs with icons

### Technical Implementation

#### Files Created
1. `includes/vendor-dashboard/class-fineart-edit-gallery.php` - Backend logic
2. `templates/vendor-dashboard/edit-gallery.php` - Frontend template
3. `js/edit-gallery.js` - JavaScript for cropping and word counting
4. `css/edit-gallery.css` - Styling

#### Files Modified
1. `includes/vendor-dashboard/class-fineart-dashboard-nav.php`
   - Updated menu structure for both validated and pending artists
   - Added edit-gallery endpoint
   - Reorganized menu items and labels

2. `includes/class-fineart-loader.php`
   - Added Edit Gallery class initialization

3. `fineart.php`
   - Updated version to 3.2

#### Features
- **AJAX form submission** - No page reload on save
- **Real-time word counting** - Updates as you type
- **Visual feedback** - Word counter turns red when limit exceeded
- **Image cropping** - Modal-based cropper with 1:1 aspect ratio enforcement
- **Validation** - Word count validation before save
- **Success/error messages** - User-friendly feedback
- **Responsive design** - Works on mobile and desktop

#### Dependencies
- Cropper.js 1.6.1 (loaded from CDN)
- jQuery (WordPress core)
- WordPress media handling functions

### User Meta Fields Used
All fields are stored as WordPress user meta:
- `shop_main_title` - Gallery name
- `afterproducttext` - Short bio
- `artist_image` - Artist image URL
- `artist_image_id` - Artist image attachment ID
- `description` - Long bio
- `instagram` - Instagram URL
- `user_url` - Website URL
- `linkedin` - LinkedIn URL
- `facebook` - Facebook URL

### AJAX Endpoints
- Action: `fineart_save_gallery_info`
- Nonce: `fineart_edit_gallery_nonce`
- Response: JSON success/error with message

### Access Control
- Only available to users with `dc_vendor` or `dc_pending_vendor` roles
- Nonce verification on all AJAX requests
- File type validation for images
- Word count validation for text fields

## Installation

1. Replace the existing plugin with this updated version
2. No database migrations needed - uses existing user meta structure
3. Clear any WordPress/site caches if menu doesn't update immediately

## Browser Compatibility
- Modern browsers with Canvas API support
- IE11+ (with polyfills if needed)
- Mobile browsers supported

## Notes
- Menu structure applies to both validated artists and pending artists
- Pending artists have simplified "Your Account" menu (no payment options)
- The endpoint URLs use MultivendorX dashboard routing
- Image cropping is required before saving (enforces 1:1 ratio)
- Word limits are enforced both client-side and server-side
