File size: 4,376 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Dashboard Entry Points

The dashboard architecture is designed to support multiple entry points, where each entry point can have:

- A distinct URL path or be deployed at a different domain.
- Custom branding (logo, colors)
- Different feature sets and navigation
- Shared core functionality

Currently, during the prototyping phase, the dashboard supports two main entry points:
- WordPress.com (dotcom) at `/v2`
- Automattic for Agencies (a4a) at `/v2-a4a`

This multi-entry point approach allows us to reuse the same codebase while tailoring the user experience to specific products and user types.

## How to Define a New Entry Point

To create a new entry point for the dashboard, follow these steps:

### 1. Create a Section Definition

Add a new section definition in `client/dashboard/section.ts`:

```typescript
export const DASHBOARD_NEWPRODUCT_SECTION_DEFINITION = {
  name: 'dashboard-newproduct',
  paths: [ '/v2-newproduct' ],
  module: 'dashboard/app-newproduct',
};
```

### 2. Create the Entry Point Module

Create a new directory under `client/dashboard` called `app-newproduct` with the following files:

#### `index.tsx`
```typescript
import boot from '../app/boot';
import Logo from './logo';
import './style.scss';

boot( {
  basePath: '/v2-newproduct',
  mainRoute: '/sites', // Or whichever route should be the default
  Logo,
  supports: {
    overview: true,
    sites: true,
    domains: false,
    emails: false,
    reader: false,
    help: true,
    notifications: false,
    me: true,
  },
} );
```

#### `logo.tsx`
```typescript
function Logo() {
  return (
    // Your product's logo SVG or imported component
    <svg width="150" height="24" viewBox="0 0 150 24">
      {/* SVG content */}
    </svg>
  );
}

export default Logo;
```

#### `style.scss`
```scss
// Product-specific styles
// These will be loaded when your entry point is active
```

### 3. Register the Section in Calypso

To make your entry point available, you'll need to register the section in Calypso's main sections file. Typically this would be in `client/sections.js`.

## Customizing Branding

Each entry point can customize its branding in several ways:

### Logo Component

The `Logo` component is passed to the boot function and rendered in the header. Create a custom logo component in your entry point directory.

### SCSS

Add entry point-specific styles in your entry point's `style.scss` file. These styles will only be loaded when your entry point is active.

For example, you can override theme variables or add entry point-specific styling:

```scss
:root {
	// Layout
	--dashboard__background-color: #fcfcfc;
	--dashboard__text-color: #{$gray-900};

	// Header bar
	--dashboard-header__background-color: #fcfcfc;
	--dashboard-header__color: #{$gray-900};
	--dashboard-header__border-color: #{$gray-100};

	// Menu
	--dashboard-menu-item__color: #{$gray-700};
	--dashboard-menu-item-active__color: #{$black};

	// Secondary menu
	--dashboard-secondary-menu-item__color: #{$gray-900};
}

```

## Customizing Content and Features

The `supports` object in your entry point configuration controls which features are available:

```typescript
supports: {
  overview: true,  // Enable/disable the Overview page
  sites: true,     // Enable/disable the Sites pages
  domains: false,  // Enable/disable the Domains page
  emails: false,   // Enable/disable the Emails page
  reader: false,   // Enable/disable the Reader
  help: true,      // Enable/disable Help functionality
  notifications: false, // Enable/disable Notifications
  me: true,        // Enable/disable the Me section
}
```

This configuration:
1. Controls which routes are created in the router
2. Controls which menu items appear in the primary menu
3. Determines the default route (`mainRoute`)

## Limitations

The customization options are intentionaly limited at the moment. We need further input and explorations to ensure the following questions:

- Does the content of each route aim to be different? For example, would the sites table contain different fields/interactions depending on the application / logged in user role (agency, regular user…)?
- What kind of branding differences do we expect per dashboard? Do design tokens provide enough local variance (colors, spacing, fonts, etc.) or do we expect each property to be modified entirely (navigation, menu reordering, etc.)?