1
+ import { useQuery } from '@tanstack/react-query' ;
1
2
import {
2
3
__experimentalVStack as VStack ,
3
4
__experimentalHStack as HStack ,
@@ -8,23 +9,24 @@ import {
8
9
} from '@wordpress/components' ;
9
10
import { dateI18n } from '@wordpress/date' ;
10
11
import { __ , sprintf } from '@wordpress/i18n' ;
12
+ import { sitePHPVersionQuery } from '../../app/queries' ;
11
13
import { getSiteStatusLabel } from '../../utils/site-status' ;
12
14
import SitePreview from '../site-preview' ;
13
15
import type { Site , Plan } from '../../data/types' ;
14
16
17
+ function TextBlur ( { text } : { text : string } ) {
18
+ return < span className = "text-blur" data-text = { text } /> ;
19
+ }
20
+
21
+ function PHPVersion ( { siteSlug } : { siteSlug : string } ) {
22
+ return useQuery ( sitePHPVersionQuery ( siteSlug ) ) . data ?? < TextBlur text = "X.Y" /> ;
23
+ }
24
+
15
25
/**
16
26
* SiteCard component to display site information in a card format
17
27
*/
18
- export default function SiteCard ( {
19
- site,
20
- phpVersion,
21
- currentPlan,
22
- } : {
23
- site : Site ;
24
- phpVersion ?: string ;
25
- currentPlan : Plan ;
26
- } ) {
27
- const { options, URL : url , is_private } = site ;
28
+ export default function SiteCard ( { site, currentPlan } : { site : Site ; currentPlan : Plan } ) {
29
+ const { options, URL : url , is_private, is_wpcom_atomic } = site ;
28
30
// If the site is a private A8C site, X-Frame-Options is set to same
29
31
// origin.
30
32
const iframeDisabled = site . is_a8c && is_private ;
@@ -65,12 +67,18 @@ export default function SiteCard( {
65
67
< HStack justify = "space-between" >
66
68
< Field title = { __ ( 'Status' ) } > { getSiteStatusLabel ( site ) } </ Field >
67
69
</ HStack >
68
- < HStack justify = "space-between" >
69
- { options ?. software_version && (
70
- < Field title = { __ ( 'WordPress' ) } > { options . software_version } </ Field >
71
- ) }
72
- { phpVersion && < Field title = { __ ( 'PHP' ) } > { phpVersion } </ Field > }
73
- </ HStack >
70
+ { ( options ?. software_version || is_wpcom_atomic ) && (
71
+ < HStack justify = "space-between" >
72
+ { options ?. software_version && (
73
+ < Field title = { __ ( 'WordPress' ) } > { options . software_version } </ Field >
74
+ ) }
75
+ { is_wpcom_atomic && (
76
+ < Field title = { __ ( 'PHP' ) } >
77
+ < PHPVersion siteSlug = { site . slug } />
78
+ </ Field >
79
+ ) }
80
+ </ HStack >
81
+ ) }
74
82
< PlanDetails site = { site } currentPlan = { currentPlan } />
75
83
</ VStack >
76
84
</ VStack >
@@ -80,7 +88,7 @@ export default function SiteCard( {
80
88
81
89
function Field ( { children, title } : { children : React . ReactNode ; title : React . ReactNode } ) {
82
90
return (
83
- < VStack className = "site-overview-field" >
91
+ < VStack className = "site-overview-field" style = { { flex : 1 } } >
84
92
< FieldTitle > { title } </ FieldTitle >
85
93
< div className = "site-overview-field-children" > { children } </ div >
86
94
</ VStack >
0 commit comments