Merge pull request 'refactor: move user-center My Orders into My Services section' (#360) from worktree-uc-orders-into-services into main
Reviewed-on: CYL/wordpress-theme-aksrt#360
This commit is contained in:
@@ -456,6 +456,15 @@ body.aksrt-user-center .uc-content,
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
/* Order quick shortcuts nested inside the 我的服务 section. */
|
||||
.uc-order-grid--quick {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
margin-top: 14px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid var(--color-line-soft, rgba(0, 0, 0, 0.06));
|
||||
}
|
||||
|
||||
.uc-order-grid__item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -627,6 +636,7 @@ body.aksrt-user-center .uc-content,
|
||||
.uc-service-grid__item--cart .uc-service-grid__icon { color: #dd6941; background: rgba(238, 109, 61, 0.12); }
|
||||
.uc-service-grid__item--level .uc-service-grid__icon { color: #9b6b0a; background: rgba(234, 179, 8, 0.13); }
|
||||
.uc-service-grid__item--auth .uc-service-grid__icon { color: #287bc4; background: rgba(14, 165, 233, 0.12); }
|
||||
.uc-service-grid__item--orders .uc-service-grid__icon { color: #c05621; background: rgba(234, 88, 12, 0.12); }
|
||||
.uc-service-grid__item--notice .uc-service-grid__icon { color: #d04b65; background: rgba(244, 63, 94, 0.11); }
|
||||
.uc-service-grid__item--profile .uc-service-grid__icon { color: #6550c7; background: rgba(124, 92, 220, 0.12); }
|
||||
.uc-service-grid__item--security .uc-service-grid__icon { color: #16816c; background: rgba(16, 185, 129, 0.12); }
|
||||
|
||||
@@ -11,7 +11,6 @@ $context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
||||
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
||||
|
||||
require __DIR__ . '/sidebar-stats.php';
|
||||
require __DIR__ . '/sidebar-orders.php';
|
||||
require __DIR__ . '/sidebar-commerce.php';
|
||||
require __DIR__ . '/sidebar-creator.php';
|
||||
require __DIR__ . '/sidebar-nav.php';
|
||||
|
||||
@@ -11,6 +11,8 @@ $level_url = isset($dashboard_tabs['level'])
|
||||
? aksrt_get_user_center_tab_url('level')
|
||||
: '';
|
||||
$auth_url = isset($dashboard_tabs['auth']) ? aksrt_get_user_center_tab_url('auth') : '';
|
||||
$orders_available = isset($dashboard_tabs['orders']);
|
||||
$orders_url = $orders_available ? (string) ($orders_url ?? '') : '';
|
||||
|
||||
$services = array_values(array_filter([
|
||||
[
|
||||
@@ -26,6 +28,13 @@ $services = array_values(array_filter([
|
||||
'url' => $auth_url,
|
||||
'tab' => 'auth',
|
||||
],
|
||||
[
|
||||
'label' => __('我的订单', 'aksrt'),
|
||||
'icon' => 'receipt',
|
||||
'tone' => 'orders',
|
||||
'url' => $orders_url,
|
||||
'tab' => 'orders',
|
||||
],
|
||||
], static fn(array $item): bool => (string) $item['url'] !== ''));
|
||||
|
||||
$settings = array_values(array_filter([
|
||||
@@ -70,6 +79,9 @@ $render_grid = static function (array $items): void {
|
||||
<div class="uc-sidebar__section">
|
||||
<div class="uc-sidebar__heading"><span><?php esc_html_e('我的服务', 'aksrt'); ?></span></div>
|
||||
<?php $render_grid($services); ?>
|
||||
<?php if ($orders_url !== '') : ?>
|
||||
<?php require __DIR__ . '/sidebar-orders.php'; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
/**
|
||||
* User center sidebar: task-oriented order shortcuts.
|
||||
*
|
||||
* Rendered inside the 我的服务 (My Services) section — see sidebar-nav.php.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
@@ -16,9 +18,6 @@ $order_user_id = (int) ($user_id ?? 0);
|
||||
$order_stats = class_exists('\AKSRT\Payment\Order')
|
||||
? \AKSRT\Payment\Order::get_instance()->get_stats($order_user_id)
|
||||
: [];
|
||||
$order_repo = class_exists('\AKSRT\Payment\OrderRepository')
|
||||
? \AKSRT\Payment\OrderRepository::get_instance()
|
||||
: null;
|
||||
$order_items = [
|
||||
[
|
||||
'label' => __('待支付', 'aksrt'),
|
||||
@@ -34,26 +33,18 @@ $order_items = [
|
||||
],
|
||||
];
|
||||
?>
|
||||
<div class="uc-sidebar__section uc-order-card">
|
||||
<div class="uc-sidebar__heading">
|
||||
<span><?php esc_html_e('我的订单', 'aksrt'); ?></span>
|
||||
<a href="<?php echo esc_url($orders_base_url); ?>">
|
||||
<?php esc_html_e('全部', 'aksrt'); ?><i class="fas fa-angle-right" aria-hidden="true"></i>
|
||||
<div class="uc-order-grid uc-order-grid--quick">
|
||||
<?php foreach ($order_items as $item) :
|
||||
$item_url = add_query_arg('order_tab', $item['tab'], $orders_base_url);
|
||||
?>
|
||||
<a class="uc-order-grid__item" href="<?php echo esc_url($item_url); ?>">
|
||||
<span class="uc-order-grid__icon">
|
||||
<i class="fas fa-<?php echo esc_attr((string) $item['icon']); ?>" aria-hidden="true"></i>
|
||||
<?php if ($item['count'] > 0) : ?>
|
||||
<small><?php echo esc_html($item['count'] > 99 ? '99+' : (string) $item['count']); ?></small>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<span><?php echo esc_html((string) $item['label']); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="uc-order-grid">
|
||||
<?php foreach ($order_items as $item) :
|
||||
$item_url = add_query_arg('order_tab', $item['tab'], $orders_base_url);
|
||||
?>
|
||||
<a class="uc-order-grid__item" href="<?php echo esc_url($item_url); ?>">
|
||||
<span class="uc-order-grid__icon">
|
||||
<i class="fas fa-<?php echo esc_attr((string) $item['icon']); ?>" aria-hidden="true"></i>
|
||||
<?php if ($item['count'] > 0) : ?>
|
||||
<small><?php echo esc_html($item['count'] > 99 ? '99+' : (string) $item['count']); ?></small>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<span><?php echo esc_html((string) $item['label']); ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user