Skip to content

Commit 6d6e556

Browse files
arthur791004heydemoura
authored andcommitted
Dashboard v1: Unify the list view of the SitesDataViews with v2 (#107877)
* Dashboard v1: Make actions consistent with v2 * Dashboard v1: Make name and URL field consistent with v2 * Dashboard v1: Disable layout switcher on sites dataviews * Update tests
1 parent 35d1273 commit 6d6e556

File tree

9 files changed

+252
-560
lines changed

9 files changed

+252
-560
lines changed

client/sites-dashboard/components/sites-p2-badge.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

client/sites-dashboard/utils.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {
33
PLAN_ECOMMERCE_TRIAL_MONTHLY,
44
PLAN_HOSTING_TRIAL_MONTHLY,
55
} from '@automattic/calypso-products';
6+
import { translate } from 'i18n-calypso';
7+
import { isMigrationInProgress } from 'calypso/data/site-migration';
68
import type { SiteExcerptData, SiteExcerptNetworkData } from '@automattic/sites';
79

810
export const TRACK_SOURCE_NAME = 'sites-dashboard';
@@ -23,6 +25,21 @@ export const getManagePluginsUrl = ( slug: string ) => {
2325
return `/plugins/manage/${ slug }`;
2426
};
2527

28+
export const getSiteDisplayUrl = ( site: SiteExcerptData ) => {
29+
if ( site.options?.is_redirect ) {
30+
return site.slug;
31+
}
32+
return site.URL.replace( 'https://', '' ).replace( 'http://', '' );
33+
};
34+
35+
export const getSiteDisplayName = ( site: SiteExcerptData ) => {
36+
if ( isMigrationInProgress( site ) ) {
37+
return translate( 'Incoming Migration' );
38+
}
39+
40+
return site.name || getSiteDisplayUrl( site );
41+
};
42+
2643
export const displaySiteUrl = ( siteUrl: string ) => {
2744
return siteUrl.replace( 'https://', '' ).replace( 'http://', '' );
2845
};

client/sites/components/sites-dashboard.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,15 @@ const SitesDashboard = ( {
210210
showTitle: true,
211211
mediaField: 'icon',
212212
showMedia: true,
213+
descriptionField: 'URL',
213214
}
214215
: {
215216
type: 'table',
216217
titleField: 'site-title',
217218
showTitle: true,
218219
mediaField: 'icon',
219220
showMedia: true,
221+
descriptionField: 'URL',
220222
layout: {
221223
styles: {
222224
site: {

0 commit comments

Comments
 (0)