Skip to content

Commit 0f34995

Browse files
authored
Dashboard v2: code restructure (#103125)
1 parent 696a03b commit 0f34995

File tree

76 files changed

+91
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+91
-91
lines changed

client/dashboard/agency-overview/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Button } from '@wordpress/components';
22
import { __ } from '@wordpress/i18n';
3-
import PageLayout from '../page-layout';
3+
import PageLayout from '../components/page-layout';
44

55
export default function AgencyOverview() {
66
return (

client/dashboard/404/index.tsx renamed to client/dashboard/app/404/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
3-
import RouterLinkButton from '../router-link-button';
2+
import PageLayout from '../../components/page-layout';
3+
import RouterLinkButton from '../../components/router-link-button';
44

55
function NotFound() {
66
return (

client/dashboard/500/index.tsx renamed to client/dashboard/app/500/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Notice } from '@wordpress/components';
22
import { __ } from '@wordpress/i18n';
3-
import PageLayout from '../page-layout';
4-
import RouterLinkButton from '../router-link-button';
3+
import PageLayout from '../../components/page-layout';
4+
import RouterLinkButton from '../../components/router-link-button';
55

66
function UnknownError( { error }: { error: Error } ) {
77
return (

client/dashboard/auth/index.tsx renamed to client/dashboard/app/auth/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useQuery } from '@tanstack/react-query';
22
import { createContext, useContext } from 'react';
3-
import { fetchUser } from '../data';
4-
import type { User } from '../data/types';
3+
import { fetchUser } from '../../data';
4+
import type { User } from '../../data/types';
55

66
export const AUTH_QUERY_KEY = [ 'auth', 'user' ];
77
export const TWO_STEP_QUERY_KEY = [ 'me', 'two-step' ];

client/dashboard/command-palette/commands.tsx renamed to client/dashboard/app/command-palette/commands.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useRouter } from '@tanstack/react-router';
22
import { __ } from '@wordpress/i18n';
33
import { globe, commentAuthorAvatar, envelope, bell, wordpress, home } from '@wordpress/icons';
4-
import { useAppContext } from '../app/context';
5-
import type { AppConfig } from '../app/context';
4+
import { useAppContext } from '../context';
5+
import type { AppConfig } from '../context';
66

77
export interface Command {
88
name: string;

client/dashboard/header/index.tsx renamed to client/dashboard/app/header/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useViewportMatch } from '@wordpress/compose';
2-
import { useAppContext } from '../app/context';
3-
import HeaderBar from '../header-bar';
2+
import HeaderBar from '../../components/header-bar';
3+
import RouterLinkButton from '../../components/router-link-button';
4+
import { useAppContext } from '../context';
45
import PrimaryMenu from '../primary-menu';
56
import PrimaryMenuMobile from '../primary-menu-mobile';
6-
import RouterLinkButton from '../router-link-button';
77
import SecondaryMenu from '../secondary-menu';
88

99
function Header() {

client/dashboard/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { QueryClientProvider } from '@tanstack/react-query';
22
import { RouterProvider } from '@tanstack/react-router';
33
import { useMemo } from 'react';
4-
import { AuthProvider, useAuth } from '../auth';
4+
import { AuthProvider, useAuth } from './auth';
55
import { AppProvider, type AppConfig } from './context';
66
import { queryClient } from './query-client';
77
import { getRouter } from './router';

client/dashboard/primary-menu-mobile/index.tsx renamed to client/dashboard/app/primary-menu-mobile/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { DropdownMenu } from '@wordpress/components';
22
import { __ } from '@wordpress/i18n';
33
import { menu } from '@wordpress/icons';
4-
import { useAppContext } from '../app/context';
5-
import RouterLinkMenuItem from '../router-link-menu-item';
4+
import RouterLinkMenuItem from '../../components/router-link-menu-item';
5+
import { useAppContext } from '../context';
66

77
function PrimaryMenuMobile() {
88
const { supports } = useAppContext();

client/dashboard/primary-menu/index.tsx renamed to client/dashboard/app/primary-menu/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { __ } from '@wordpress/i18n';
2-
import { useAppContext } from '../app/context';
3-
import Menu from '../menu';
2+
import Menu from '../../components/menu';
3+
import { useAppContext } from '../context';
44

55
function PrimaryMenu() {
66
const { supports } = useAppContext();

client/dashboard/app/query-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister';
22
import { QueryClient } from '@tanstack/react-query';
33
import { persistQueryClient } from '@tanstack/react-query-persist-client';
4-
import { TWO_STEP_QUERY_KEY } from '../auth';
4+
import { TWO_STEP_QUERY_KEY } from './auth';
55

66
export const queryClient = new QueryClient( {
77
defaultOptions: {

client/dashboard/root/index.tsx renamed to client/dashboard/app/root/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { WordPressLogo } from '@automattic/components';
22
import { useIsFetching } from '@tanstack/react-query';
33
import { Outlet, useRouterState } from '@tanstack/react-router';
4-
import { useAppContext } from '../app/context';
4+
import { LoadingLine } from '../../components/loading-line';
55
import CommandPalette from '../command-palette';
6+
import { useAppContext } from '../context';
67
import Header from '../header';
7-
import { LoadingLine } from '../loading-line';
88
import './style.scss';
99

1010
function Root() {

client/dashboard/app/router.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import {
55
redirect,
66
createLazyRoute,
77
} from '@tanstack/react-router';
8-
import NotFound from '../404';
9-
import UnknownError from '../500';
108
import { fetchTwoStep } from '../data';
11-
import Root from '../root';
9+
import NotFound from './404';
10+
import UnknownError from './500';
1211
import { sitesQuery, siteQuery, domainsQuery, emailsQuery, profileQuery } from './queries';
1312
import { queryClient } from './query-client';
13+
import Root from './root';
1414
import type { AppConfig } from './context';
1515
import type { FetchQueryOptions } from '@tanstack/react-query';
1616

@@ -65,7 +65,7 @@ const siteRoute = createRoute( {
6565
path: 'sites/$siteSlug',
6666
loader: ( { params: { siteSlug } } ) => maybeAwaitFetch( siteQuery( siteSlug ) ),
6767
} ).lazy( () =>
68-
import( '../site' ).then( ( d ) =>
68+
import( '../sites/site' ).then( ( d ) =>
6969
createLazyRoute( 'site' )( {
7070
component: d.default,
7171
} )
@@ -76,7 +76,7 @@ const siteOverviewRoute = createRoute( {
7676
getParentRoute: () => siteRoute,
7777
path: '/',
7878
} ).lazy( () =>
79-
import( '../site-overview' ).then( ( d ) =>
79+
import( '../sites/overview' ).then( ( d ) =>
8080
createLazyRoute( 'site-overview' )( {
8181
component: d.default,
8282
} )
@@ -87,7 +87,7 @@ const siteDeploymentsRoute = createRoute( {
8787
getParentRoute: () => siteRoute,
8888
path: 'deployments',
8989
} ).lazy( () =>
90-
import( '../site-deployments' ).then( ( d ) =>
90+
import( '../sites/deployments' ).then( ( d ) =>
9191
createLazyRoute( 'site-deployments' )( {
9292
component: d.default,
9393
} )
@@ -98,7 +98,7 @@ const sitePerformanceRoute = createRoute( {
9898
getParentRoute: () => siteRoute,
9999
path: 'performance',
100100
} ).lazy( () =>
101-
import( '../site-performance' ).then( ( d ) =>
101+
import( '../sites/performance' ).then( ( d ) =>
102102
createLazyRoute( 'site-performance' )( {
103103
component: d.default,
104104
} )
@@ -109,7 +109,7 @@ const siteSettingsRoute = createRoute( {
109109
getParentRoute: () => siteRoute,
110110
path: 'settings',
111111
} ).lazy( () =>
112-
import( '../site-settings' ).then( ( d ) =>
112+
import( '../sites/settings' ).then( ( d ) =>
113113
createLazyRoute( 'site-settings' )( {
114114
component: d.default,
115115
} )
@@ -167,7 +167,7 @@ const profileRoute = createRoute( {
167167
getParentRoute: () => meRoute,
168168
path: 'profile',
169169
} ).lazy( () =>
170-
import( '../profile' ).then( ( d ) =>
170+
import( '../me/profile' ).then( ( d ) =>
171171
createLazyRoute( 'profile' )( {
172172
component: d.default,
173173
} )
@@ -178,7 +178,7 @@ const billingRoute = createRoute( {
178178
getParentRoute: () => meRoute,
179179
path: 'billing',
180180
} ).lazy( () =>
181-
import( '../billing' ).then( ( d ) =>
181+
import( '../me/billing' ).then( ( d ) =>
182182
createLazyRoute( 'billing' )( {
183183
component: d.default,
184184
} )
@@ -189,7 +189,7 @@ const billingHistoryRoute = createRoute( {
189189
getParentRoute: () => meRoute,
190190
path: 'billing/billing-history',
191191
} ).lazy( () =>
192-
import( '../billing-history' ).then( ( d ) =>
192+
import( '../me/billing-history' ).then( ( d ) =>
193193
createLazyRoute( 'billing-history' )( {
194194
component: d.default,
195195
} )
@@ -200,7 +200,7 @@ const activeSubscriptionsRoute = createRoute( {
200200
getParentRoute: () => meRoute,
201201
path: 'billing/active-subscriptions',
202202
} ).lazy( () =>
203-
import( '../active-subscriptions' ).then( ( d ) =>
203+
import( '../me/active-subscriptions' ).then( ( d ) =>
204204
createLazyRoute( 'active-subscriptions' )( {
205205
component: d.default,
206206
} )
@@ -211,7 +211,7 @@ const paymentMethodsRoute = createRoute( {
211211
getParentRoute: () => meRoute,
212212
path: 'billing/payment-methods',
213213
} ).lazy( () =>
214-
import( '../payment-methods' ).then( ( d ) =>
214+
import( '../me/payment-methods' ).then( ( d ) =>
215215
createLazyRoute( 'payment-methods' )( {
216216
component: d.default,
217217
} )
@@ -222,7 +222,7 @@ const taxDetailsRoute = createRoute( {
222222
getParentRoute: () => meRoute,
223223
path: 'billing/tax-details',
224224
} ).lazy( () =>
225-
import( '../tax-details' ).then( ( d ) =>
225+
import( '../me/tax-details' ).then( ( d ) =>
226226
createLazyRoute( 'tax-details' )( {
227227
component: d.default,
228228
} )
@@ -233,7 +233,7 @@ const securityRoute = createRoute( {
233233
getParentRoute: () => meRoute,
234234
path: 'security',
235235
} ).lazy( () =>
236-
import( '../security' ).then( ( d ) =>
236+
import( '../me/security' ).then( ( d ) =>
237237
createLazyRoute( 'security' )( {
238238
component: d.default,
239239
} )
@@ -244,7 +244,7 @@ const privacyRoute = createRoute( {
244244
getParentRoute: () => meRoute,
245245
path: 'privacy',
246246
} ).lazy( () =>
247-
import( '../privacy' ).then( ( d ) =>
247+
import( '../me/privacy' ).then( ( d ) =>
248248
createLazyRoute( 'privacy' )( {
249249
component: d.default,
250250
} )
@@ -255,7 +255,7 @@ const notificationsRoute = createRoute( {
255255
getParentRoute: () => meRoute,
256256
path: 'notifications',
257257
} ).lazy( () =>
258-
import( '../notifications' ).then( ( d ) =>
258+
import( '../me/notifications' ).then( ( d ) =>
259259
createLazyRoute( 'notifications' )( {
260260
component: d.default,
261261
} )

client/dashboard/secondary-menu/index.tsx renamed to client/dashboard/app/secondary-menu/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import {
1111
import { __ } from '@wordpress/i18n';
1212
import { help, bellUnread, bell, commentAuthorAvatar } from '@wordpress/icons';
1313
import ReaderIcon from 'calypso/assets/icons/reader/reader-icon';
14-
import { useAppContext } from '../app/context';
14+
import MenuDivider from '../../components/menu-divider';
15+
import RouterLinkMenuItem from '../../components/router-link-menu-item';
1516
import { useAuth } from '../auth';
1617
import { useOpenCommandPalette } from '../command-palette/utils';
17-
import MenuDivider from '../menu-divider';
18-
import RouterLinkMenuItem from '../router-link-menu-item';
18+
import { useAppContext } from '../context';
1919

2020
import './style.scss';
2121

client/dashboard/domains/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { dateI18n } from '@wordpress/date';
55
import { __ } from '@wordpress/i18n';
66
import { useState } from 'react';
77
import { domainsQuery } from '../app/queries';
8-
import DataViewsCard from '../dataviews-card';
9-
import PageLayout from '../page-layout';
8+
import DataViewsCard from '../components/dataviews-card';
9+
import PageLayout from '../components/page-layout';
1010
import type { Domain } from '../data/types';
1111

1212
const fields = [

client/dashboard/emails/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { Button, ExternalLink, Notice } from '@wordpress/components';
55
import { __ } from '@wordpress/i18n';
66
import { useState, useMemo } from 'react';
77
import { emailsQuery } from '../app/queries';
8-
import DataViewsCard from '../dataviews-card';
9-
import PageLayout from '../page-layout';
8+
import DataViewsCard from '../components/dataviews-card';
9+
import PageLayout from '../components/page-layout';
1010
import type { Email } from '../data/types';
1111
import type { View } from '@automattic/dataviews';
1212

client/dashboard/active-subscriptions/index.tsx renamed to client/dashboard/me/active-subscriptions/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
2+
import PageLayout from '../../components/page-layout';
33

44
export default function ActiveSubscriptions() {
55
return (

client/dashboard/billing-history/index.tsx renamed to client/dashboard/me/billing-history/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
2+
import PageLayout from '../../components/page-layout';
33

44
function BillingHistory() {
55
return (

client/dashboard/billing/index.tsx renamed to client/dashboard/me/billing/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
billingHistoryRoute,
77
paymentMethodsRoute,
88
taxDetailsRoute,
9-
} from '../app/router';
10-
import PageLayout from '../page-layout';
11-
import RouterLinkSummaryButton from '../router-link-summary-button';
9+
} from '../../app/router';
10+
import PageLayout from '../../components/page-layout';
11+
import RouterLinkSummaryButton from '../../components/router-link-summary-button';
1212

1313
function Billing() {
1414
return (

client/dashboard/me/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { Outlet } from '@tanstack/react-router';
22
import { __experimentalHStack as HStack } from '@wordpress/components';
33
import { useViewportMatch } from '@wordpress/compose';
44
import { __ } from '@wordpress/i18n';
5-
import HeaderBar from '../header-bar';
6-
import MeMenu from '../me-menu';
7-
import MenuDivider from '../menu-divider';
5+
import HeaderBar from '../components/header-bar';
6+
import MenuDivider from '../components/menu-divider';
7+
import MeMenu from './me-menu';
88

99
function Me() {
1010
const isDesktop = useViewportMatch( 'medium' );

client/dashboard/me-menu/index.tsx renamed to client/dashboard/me/me-menu/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { __ } from '@wordpress/i18n';
2-
import { useAppContext } from '../app/context';
3-
import ResponsiveMenu from '../responsive-menu';
2+
import { useAppContext } from '../../app/context';
3+
import ResponsiveMenu from '../../components/responsive-menu';
44

55
const MeMenu = () => {
66
const { supports } = useAppContext();

client/dashboard/notifications/index.tsx renamed to client/dashboard/me/notifications/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
2+
import PageLayout from '../../components/page-layout';
33

44
function Notifications() {
55
return (

client/dashboard/payment-methods/index.tsx renamed to client/dashboard/me/payment-methods/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
2+
import PageLayout from '../../components/page-layout';
33

44
export default function PaymentMethods() {
55
return (

client/dashboard/privacy/index.tsx renamed to client/dashboard/me/privacy/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
2+
import PageLayout from '../../components/page-layout';
33

44
function Privacy() {
55
return (

client/dashboard/profile/index.tsx renamed to client/dashboard/me/profile/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import {
1717
import { createInterpolateElement, useMemo } from '@wordpress/element';
1818
import { __, sprintf } from '@wordpress/i18n';
1919
import { useState } from 'react';
20-
import { profileQuery, profileMutation } from '../app/queries';
20+
import { profileQuery, profileMutation } from '../../app/queries';
21+
import PageLayout from '../../components/page-layout';
2122
import EditGravatar from '../edit-gravatar';
22-
import PageLayout from '../page-layout';
23-
import type { Profile as ProfileType } from '../data/types';
23+
import type { Profile as ProfileType } from '../../data/types';
2424
import type { Field } from '@automattic/dataviews';
2525

2626
import './style.scss';

client/dashboard/security/index.tsx renamed to client/dashboard/me/security/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
2+
import PageLayout from '../../components/page-layout';
33

44
function Security() {
55
return (

client/dashboard/tax-details/index.tsx renamed to client/dashboard/me/tax-details/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
2+
import PageLayout from '../../components/page-layout';
33

44
export default function TaxDetails() {
55
return (

client/dashboard/site-deployments/index.tsx renamed to client/dashboard/sites/deployments/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { __ } from '@wordpress/i18n';
2-
import PageLayout from '../page-layout';
2+
import PageLayout from '../../components/page-layout';
33

44
function SiteDeployments() {
55
return <PageLayout title={ __( 'Deployments' ) } />;

0 commit comments

Comments
 (0)