| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin Template — React app mount point. |
| 4 |
* |
| 5 |
* Fullscreen shell CSS runs from AdminServiceProvider::printYatraReactAdminCriticalCss() on admin_print_styles |
| 6 |
* (priority 0) so it is output in the document head before the wp-admin menu markup — avoids FOUC. |
| 7 |
*/ |
| 8 |
|
| 9 |
if (!defined('ABSPATH')) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
// Check if React app is built |
| 14 |
$app_js = YATRA_PLUGIN_PATH . 'assets/admin/dist/js/app.js'; |
| 15 |
$app_css = YATRA_PLUGIN_PATH . 'assets/admin/dist/css/app.css'; |
| 16 |
$has_build = file_exists($app_js); |
| 17 |
?> |
| 18 |
<div id="yatra-app-root"> |
| 19 |
<?php if ($has_build) : ?> |
| 20 |
<div class="yatra-admin-boot-splash" role="status" aria-live="polite" aria-busy="true"> |
| 21 |
<div class="yatra-admin-boot-spinner" aria-hidden="true"></div> |
| 22 |
<p class="yatra-admin-boot-text"><?php esc_html_e('Loading Yatra…', 'yatra'); ?></p> |
| 23 |
</div> |
| 24 |
<?php else : ?> |
| 25 |
<div class="yatra-build-message"> |
| 26 |
<h1><?php esc_html_e('🚀 Yatra Admin UI Setup Required', 'yatra'); ?></h1> |
| 27 |
<p style="font-size: 16px; margin-bottom: 30px; color: #666;"> |
| 28 |
<?php esc_html_e('The modern React admin interface needs to be built before it can be used.', 'yatra'); ?> |
| 29 |
</p> |
| 30 |
<div style="background: #f9f9f9; border: 1px solid #ddd; border-radius: 4px; padding: 20px; text-align: left; margin: 20px 0;"> |
| 31 |
<h3 style="margin-top: 0;"><?php esc_html_e('To build the Admin UI:', 'yatra'); ?></h3> |
| 32 |
<ol style="line-height: 2;"> |
| 33 |
<li><?php esc_html_e('Open your terminal/command prompt', 'yatra'); ?></li> |
| 34 |
<li><?php esc_html_e('Navigate to the plugin directory:', 'yatra'); ?> |
| 35 |
<code><?php echo esc_html(YATRA_PLUGIN_PATH); ?></code> |
| 36 |
</li> |
| 37 |
<li><?php esc_html_e('Install dependencies:', 'yatra'); ?> |
| 38 |
<code>npm install</code> |
| 39 |
</li> |
| 40 |
<li><?php esc_html_e('Build the application:', 'yatra'); ?> |
| 41 |
<code>npm run build</code> |
| 42 |
</li> |
| 43 |
<li><?php esc_html_e('Refresh this page', 'yatra'); ?></li> |
| 44 |
</ol> |
| 45 |
</div> |
| 46 |
<p style="color: #999; font-size: 14px;"> |
| 47 |
<?php esc_html_e('For development with hot reload, use', 'yatra'); ?> <code>npm run dev</code> <?php esc_html_e('instead of', 'yatra'); ?> <code>npm run build</code> |
| 48 |
</p> |
| 49 |
</div> |
| 50 |
<?php endif; ?> |
| 51 |
</div> |
| 52 |
|
| 53 |
|