Skip to content

Commit 06c934e

Browse files
authored
Update tooltips in the new Previews tab (redo) (#1027)
* Update tooltips in site previews. * Add back link tooltips and standardize with Sync tab.. * Linting.
1 parent 29251f0 commit 06c934e

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎src/components/sync-connected-sites.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,14 @@ const SyncConnectedSitesSection = ( {
220220
<Badge className="bg-a8c-green-5 text-a8c-green-80">{ __( 'Production' ) }</Badge>
221221
) }
222222
</div>
223-
224-
<Tooltip text={ connectedSite.url } className="overflow-hidden">
223+
<Tooltip
224+
text={ sprintf(
225+
/* translators: %s: The URL of the connected site */
226+
__( 'Open %s' ),
227+
connectedSite.url
228+
) }
229+
className="overflow-hidden"
230+
>
225231
<Button
226232
variant="link"
227233
className="!text-a8c-gray-70 hover:!text-a8c-blueberry max-w-[100%]"

‎src/hooks/use-expiration-date.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ export function useExpirationDate( snapshotDate: number ) {
6565
isExpired,
6666
countDown: isExpired ? __( 'Expired' ) : countDown,
6767
expireDateString: formatStringDate( endDate.getTime(), locale, 'long' ),
68-
dateString: formatStringDate( snapshotDate, locale ),
68+
dateString: formatStringDate( snapshotDate, locale, 'long' ),
6969
};
7070
}

‎src/modules/preview-site/components/preview-site-row.tsx‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function PreviewSiteRow( {
3333
}: PreviewSiteRowProps ) {
3434
const { __ } = useI18n();
3535
const { url, date, isDeleting } = snapshot;
36-
const { countDown, expireDateString, isExpired } = useExpirationDate( date );
36+
const { countDown, dateString, expireDateString, isExpired } = useExpirationDate( date );
3737
const { fetchSnapshotUsage, removeSnapshot } = useSnapshots();
3838
const { isDemoSiteUpdating, hasDemoSiteError } = useUpdateDemoSite();
3939
const isPreviewSiteUpdating = isDemoSiteUpdating( snapshot.atomicSiteId );
@@ -117,7 +117,15 @@ export function PreviewSiteRow( {
117117
{ snapshot.name || sprintf( __( '%s Preview' ), selectedSite.name ) }
118118
</div>
119119
</div>
120-
<Tooltip text={ urlWithHTTPS } disabled={ isExpired } className="overflow-hidden">
120+
<Tooltip
121+
text={ sprintf(
122+
/* translators: %s: The preview site URL */
123+
__( 'Open %s' ),
124+
urlWithHTTPS
125+
) }
126+
disabled={ isExpired }
127+
className="overflow-hidden"
128+
>
121129
<Button
122130
variant="link"
123131
disabled={ isExpired }
@@ -142,7 +150,9 @@ export function PreviewSiteRow( {
142150
{ __( 'Updating' ) }
143151
</div>
144152
) : (
145-
getLastUpdateTimeText()
153+
<Tooltip text={ dateString } disabled={ ! date }>
154+
{ getLastUpdateTimeText() }
155+
</Tooltip>
146156
) }
147157
</div>
148158
<div className="flex items-center">

0 commit comments

Comments
 (0)