<?php
/**
 * DataStream admin dashboard view.
 *
 * @package DataStream
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<div class="wrap datastream-wrap">
	<h1><?php esc_html_e( 'DataStream Dashboard', 'datastream-api-sync' ); ?></h1>
	<p class="description">
		<?php esc_html_e( 'Records synced from your external API. Display them anywhere with the shortcode, block, or template tags below.', 'datastream-api-sync' ); ?>
	</p>

	<div id="datastream-dashboard" class="datastream-dashboard" aria-live="polite">
		<div class="datastream-loading">
			<span class="spinner is-active"></span>
			<p><?php esc_html_e( 'Loading records…', 'datastream-api-sync' ); ?></p>
		</div>
	</div>

	<div class="datastream-display-help">
		<h2><?php esc_html_e( 'Display Your Data', 'datastream-api-sync' ); ?></h2>
		<table class="widefat striped">
			<tbody>
				<tr>
					<th scope="row"><?php esc_html_e( 'Shortcode — list of records', 'datastream-api-sync' ); ?></th>
					<td><code>[datastream_list limit="10" template="table" fields="name,email"]</code>
						<p class="description"><?php esc_html_e( 'Templates: list, table, cards, raw. Fields are optional (auto-detected when empty) and accept dot paths like company.name.', 'datastream-api-sync' ); ?></p>
					</td>
				</tr>
				<tr>
					<th scope="row"><?php esc_html_e( 'Shortcode — single field', 'datastream-api-sync' ); ?></th>
					<td><code>[datastream_field id="123" field="title" default="—"]</code></td>
				</tr>
				<tr>
					<th scope="row"><?php esc_html_e( 'Block', 'datastream-api-sync' ); ?></th>
					<td><?php esc_html_e( 'Add the "DataStream List" block in the editor and pick a template in the sidebar.', 'datastream-api-sync' ); ?></td>
				</tr>
				<tr>
					<th scope="row"><?php esc_html_e( 'Template tags (PHP)', 'datastream-api-sync' ); ?></th>
					<td><code>datastream_get_records()</code>, <code>datastream_get_record( $id )</code>, <code>datastream_get_field( $id, 'company.name' )</code></td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
