fix: address CHRNX editorial review findings

This commit is contained in:
chrnx committed 2026-08-11 18:18:05 -05:00
1 parent 247f9a7915
commit 7297523e26
17 files changed
+236 -10

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/journal-link",
"version": "0.1.0",
"title": "Journal Link",
"category": "theme",
"description": "Display a translated portable link to the full Journal.",
"textdomain": "chrnx",
"supports": { "html": false },
"render": "file:./render.php"
}
+8
View File
@@ -0,0 +1,8 @@
<?php
/**
* Journal Link block render.
*
* @package CHRNX
*/
?>
<p <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-journal-link' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>><a href="<?php echo esc_url( chrnx_get_full_journal_url() ); ?>"><?php echo esc_html__( 'Browse the full Journal', 'chrnx' ); ?></a></p>
+4 -1
View File
@@ -101,6 +101,9 @@ $chrnx_title_id = wp_unique_id( 'chrnx-journal-title-' );
</nav>
<?php endif; ?>
<?php else : ?>
<p class="chrnx-journal-stream__empty"><?php echo esc_html__( 'No journal entries match these filters yet.', 'chrnx' ); ?></p>
<p class="chrnx-journal-stream__empty">
<?php echo esc_html__( 'No journal entries match these filters yet.', 'chrnx' ); ?>
<a href="<?php echo esc_url( chrnx_get_full_journal_url() ); ?>"><?php echo esc_html__( 'Browse the full Journal', 'chrnx' ); ?></a>
</p>
<?php endif; ?>
</section>
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/reading-time",
"version": "0.1.0",
"title": "Reading Time",
"category": "theme",
"description": "Display a localized estimate based on the current post content.",
"textdomain": "chrnx",
"usesContext": ["postId", "postType"],
"supports": { "html": false },
"render": "file:./render.php"
}
+23
View File
@@ -0,0 +1,23 @@
<?php
/**
* Reading Time block render.
*
* @package CHRNX
*/
$chrnx_post_id = isset( $block->context['postId'] ) ? absint( $block->context['postId'] ) : get_the_ID();
$chrnx_post = get_post( $chrnx_post_id );
if ( ! $chrnx_post instanceof WP_Post ) {
return;
}
$chrnx_minutes = chrnx_get_reading_time_minutes( $chrnx_post->post_content );
if ( 0 === $chrnx_minutes ) {
return;
}
$chrnx_label = sprintf(
/* translators: %s: estimated reading time in minutes. */
_n( '%s minute read', '%s minutes read', $chrnx_minutes, 'chrnx' ),
number_format_i18n( $chrnx_minutes )
);
?>
<span <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-reading-time' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>><?php echo esc_html( $chrnx_label ); ?></span>
+3 -2
View File
@@ -11,7 +11,8 @@ if ( '' === $chrnx_topic && is_tax( 'chrnx_topic' ) ) {
$chrnx_topic = $chrnx_queried instanceof WP_Term ? $chrnx_queried->slug : '';
}
$chrnx_asset = chrnx_get_topic_art_asset( $chrnx_topic );
if ( '' === $chrnx_asset ) {
$chrnx_size = chrnx_get_topic_art_dimensions( $chrnx_topic );
if ( '' === $chrnx_asset || 2 !== count( $chrnx_size ) ) {
return;
}
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
@@ -24,7 +25,7 @@ $chrnx_label = $chrnx_term instanceof WP_Term ? $chrnx_term->name : ucfirst( $
</div>
<div class="chrnx-topic-hero__art">
<?php if ( is_readable( get_theme_file_path( $chrnx_asset ) ) ) : ?>
<img src="<?php echo esc_url( get_theme_file_uri( $chrnx_asset ) ); ?>" width="1122" height="1402" loading="lazy" decoding="async" alt="" aria-hidden="true">
<img src="<?php echo esc_url( get_theme_file_uri( $chrnx_asset ) ); ?>" width="<?php echo esc_attr( $chrnx_size[0] ); ?>" height="<?php echo esc_attr( $chrnx_size[1] ); ?>" loading="lazy" decoding="async" alt="" aria-hidden="true">
<?php else : ?>
<span class="chrnx-topic-hero__fallback" aria-hidden="true"></span>
<?php endif; ?>
+6
View File
@@ -2,6 +2,12 @@
min-width: min(100%, 16rem);
}
.chrnx-topic-hero__art img {
display: block;
height: auto;
max-width: 100%;
}
.chrnx-topic-hero__fallback {
aspect-ratio: 4 / 5;
background-color: var(--wp--preset--color--panel);