motayeb/woocommerce/myaccount/dashboard.php
Kazem Alghasi c06ab0b8a2 feat(theme): implement full UI redesign and WooCommerce integration
Implement a complete overhaul of the theme templates to match the
Kolli UI design, including enhanced WooCommerce support, dark mode
functionality, and improved responsive layouts.

- Redesign core templates: front-page, archive, single, and product pages
- Implement dynamic WooCommerce templates for shop, single product, and checkout
- Add comprehensive asset structure including fonts, images, and custom CSS/JS
- Integrate Tailwind CSS via CDN with custom configuration for brand colors
- Add dark mode support with local storage persistence
- Refactor functions.php for better theme setup and script enqueuing
- Implement custom product meta fields for ingredients and health benefits
- Add responsive design improvements and custom animations
2026-08-18 02:28:57 +03:30

112 lines
5.7 KiB
PHP

<?php
/**
* پیشخوان حساب کاربری - مطابق با UI Kolli.html
*
* @package Motayeb
*/
defined( 'ABSPATH' ) || exit;
get_header();
?>
<section class="py-8 md:py-16 bg-cream-100 dark:bg-dark-bg">
<div class="max-w-6xl mx-auto px-4 md:px-6">
<div class="bg-white dark:bg-dark-card rounded-2xl border border-cream-200/50 dark:border-dark-border/50 overflow-hidden">
<!-- Header -->
<div class="bg-forest-500 dark:bg-forest-800 p-6 md:p-8">
<div class="flex flex-wrap items-center justify-between gap-4">
<div>
<h1 class="text-2xl md:text-3xl font-extrabold text-white">حساب کاربری</h1>
<p class="text-white/70 text-sm"><?php echo esc_html( wp_get_current_user()->display_name ); ?></p>
</div>
<a href="<?php echo esc_url( wc_logout_url() ); ?>" class="px-5 py-2 bg-white/10 hover:bg-white/20 text-white rounded-xl text-sm font-medium transition flex items-center gap-2">
<iconify-icon icon="lucide:log-out" width="16"></iconify-icon>
<span>خروج</span>
</a>
</div>
</div>
<!-- Content -->
<div class="p-6 md:p-8">
<div class="flex flex-col lg:flex-row gap-8">
<!-- Navigation -->
<nav class="lg:w-1/4 flex-shrink-0">
<ul class="space-y-1">
<?php
$current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'dashboard';
$tabs = array(
'dashboard' => array(
'label' => __( 'پیشخوان', 'motayeb' ),
'icon' => 'lucide:layout-dashboard',
),
'orders' => array(
'label' => __( 'سفارشات', 'motayeb' ),
'icon' => 'lucide:package',
),
'downloads' => array(
'label' => __( 'دانلودها', 'motayeb' ),
'icon' => 'lucide:download',
),
'edit-address' => array(
'label' => __( 'آدرس‌ها', 'motayeb' ),
'icon' => 'lucide:map-pin',
),
'edit-account' => array(
'label' => __( 'اطلاعات حساب', 'motayeb' ),
'icon' => 'lucide:user-cog',
),
);
foreach ( $tabs as $tab_key => $tab ) :
$is_active = ( $current_tab === $tab_key );
$url = add_query_arg( 'tab', $tab_key, wc_get_account_endpoint_url( $tab_key ) );
?>
<li>
<a href="<?php echo esc_url( $url ); ?>" class="flex items-center gap-3 px-4 py-3 rounded-xl <?php echo $is_active ? 'bg-forest-50 dark:bg-forest-900/30 text-forest-500 dark:text-forest-300' : 'text-cream-500 dark:text-dark-muted hover:bg-cream-50 dark:hover:bg-dark-bg'; ?> transition">
<iconify-icon icon="<?php echo esc_attr( $tab['icon'] ); ?>" width="18"></iconify-icon>
<span class="font-medium text-sm"><?php echo esc_html( $tab['label'] ); ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>
</nav>
<!-- Content Area -->
<div class="lg:w-3/4">
<?php
// نمایش محتوای هر تب
$tab_content = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'dashboard';
switch ( $tab_content ) {
case 'dashboard':
wc_get_template( 'myaccount/dashboard.php', array(
'current_user' => get_user_by( 'id', get_current_user_id() ),
) );
break;
case 'orders':
wc_get_template( 'myaccount/orders.php', array(
'order_count' => wc_get_customer_order_count( get_current_user_id() ),
) );
break;
case 'downloads':
wc_get_template( 'myaccount/downloads.php' );
break;
case 'edit-address':
wc_get_template( 'myaccount/form-edit-address.php' );
break;
case 'edit-account':
wc_get_template( 'myaccount/form-edit-account.php' );
break;
default:
wc_get_template( 'myaccount/dashboard.php' );
break;
}
?>
</div>
</div>
</div>
</div>
</div>
</section>
<?php
get_footer();