feat(checkin): open reference-parity details modal from signed buttons
- Rebuild checkin details modal HTML 1:1 with reference theme: colorful header c-blue, user card (points/level), daily reward card and 7-day continuous mini cards - Signed entry buttons (header dropdown, user-card badge, user center) become clickable checkin-details-link modal triggers instead of disabled buttons - Swap data-signin-btn to details link in place after successful signin (reference .initiate-checkin replacement behavior) - Add aksrt-checkin-details-modal runtime shell (modal-mini 400px) - Remove dead code: legacy lite modal, admin-ajax details handler, /signin/history route, signin calendar; rebuild public bundles - Update contract tests to the new checkin modal contract
This commit is contained in:
1 parent
c289016324
commit
4653128a18
15 files changed
+211
-266
No files matched your search
@@ -7,6 +7,29 @@
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_get_user_checkin_details_link')) :
|
||||
/**
|
||||
* 已签到详情弹窗触发链接(参考主题 zib_get_user_checkin_details_link 1:1):
|
||||
* 打开刷新式 mini 弹窗(高 240,移动端底部弹出,每次都重新拉取)。
|
||||
*
|
||||
* @param string $class 沿用入口按钮的类。
|
||||
* @param string $text 链接内文(含图标)。
|
||||
*/
|
||||
function aksrt_get_user_checkin_details_link(string $class = '', string $text = ''): string {
|
||||
$class = trim($class . ' checkin-details-link');
|
||||
|
||||
return '<a class="' . esc_attr($class) . '" href="javascript:;"'
|
||||
. ' data-aksrt-modal="remote"'
|
||||
. ' data-aksrt-modal-url="' . esc_url(rest_url('aksrt/v1/signin/details')) . '"'
|
||||
. ' data-aksrt-modal-class="aksrt-checkin-details-modal modal-mini"'
|
||||
. ' data-aksrt-modal-height="240"'
|
||||
. ' data-aksrt-modal-mobile-bottom="true"'
|
||||
. ' data-aksrt-modal-cache="false">'
|
||||
. $text
|
||||
. '</a>';
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_header_user_checkin_btn')) :
|
||||
/**
|
||||
* Check-in CTA for header dropdown and compact card placements.
|
||||
@@ -31,27 +54,36 @@ if (!function_exists('aksrt_header_user_checkin_btn')) :
|
||||
|
||||
$signed = \AKSRT\Credits\Signin::get_instance()->is_signed_today($user_id);
|
||||
|
||||
// 已签到:与参考主题一致,入口按钮变为签到详情弹窗触发链接(可点击)。
|
||||
if ($signed) {
|
||||
$icon = '<i class="fa fas fa-calendar-check ml3 mr6" aria-hidden="true"></i>';
|
||||
if ($class !== null) {
|
||||
// 用户卡片签到书签:保留书签类与 is-done 视觉,仅将行为切换为打开详情弹窗。
|
||||
return aksrt_get_user_checkin_details_link(
|
||||
$class . ' is-done',
|
||||
$icon . '<span>' . esc_html__('已签到', 'aksrt') . '</span>'
|
||||
);
|
||||
}
|
||||
return aksrt_get_user_checkin_details_link(
|
||||
'but block c-yellow aksrt-header-checkin is-done',
|
||||
'<i class="fa fas fa-calendar-check" aria-hidden="true"></i> ' . esc_html($compact ? __('已签到', 'aksrt') : __('今日已签到', 'aksrt'))
|
||||
);
|
||||
}
|
||||
|
||||
$classes = $class ?? ('but block c-yellow aksrt-header-checkin' . ($compact ? ' aksrt-header-checkin--compact' : ''));
|
||||
|
||||
// Card badge variant (explicit $class, e.g. the user-card 签到 badge):
|
||||
// reference parity renders an <a> so the badge inherits the card font
|
||||
// instead of the UA button stylesheet (font/UI 1:1 with the reference).
|
||||
if ($class !== null) {
|
||||
return '<a class="' . esc_attr($classes . ($signed ? ' is-done' : '')) . '" href="javascript:;" data-signin-btn'
|
||||
return '<a class="' . esc_attr($classes) . '" href="javascript:;" data-signin-btn'
|
||||
. ' data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '"'
|
||||
. ' data-signin-done-label="' . esc_attr__('已签到', 'aksrt') . '">'
|
||||
. '<i class="fa fas fa-calendar-check ml3 mr6" aria-hidden="true"></i>'
|
||||
. '<span data-signin-label>' . esc_html($signed ? __('已签到', 'aksrt') : __('签到', 'aksrt')) . '</span>'
|
||||
. '<span data-signin-label>' . esc_html__('签到', 'aksrt') . '</span>'
|
||||
. '</a>';
|
||||
}
|
||||
|
||||
if ($signed) {
|
||||
return '<button type="button" class="' . esc_attr($classes . ' is-done') . '" data-signin-btn data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '" data-signin-done-label="' . esc_attr__('已签到', 'aksrt') . '" disabled>'
|
||||
. '<i class="fa fas fa-calendar-check" aria-hidden="true"></i>'
|
||||
. '<span data-signin-label>' . esc_html($compact ? __('已签到', 'aksrt') : __('今日已签到', 'aksrt')) . '</span>'
|
||||
. '</button>';
|
||||
}
|
||||
|
||||
return '<button type="button" class="' . esc_attr($classes) . '" data-signin-btn data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '" data-signin-done-label="' . esc_attr__('已签到', 'aksrt') . '">'
|
||||
. '<i class="fa fas fa-calendar-check" aria-hidden="true"></i>'
|
||||
. '<span data-signin-label>' . esc_html($compact ? __('签到', 'aksrt') : __('签到领取今日奖励', 'aksrt')) . '</span>'
|
||||
|
||||
Reference in new issue
Block a user