Skip to content

Commit

Permalink
Feat (home): Add new theme dashboard screenshots
Browse files Browse the repository at this point in the history
- Add `next` theme variant screenshots of sample dashboards with `_new` suffix
- Add chromed screenshots of flights dashboard to use as the images in the new theme modal and replace placeholders
- Tweak gutter size in new theme modal
- Add `hasNewThemeImages` optional boolean to sample dataset registry interface
- Update sample data cards image path logic to fetch themed images if available via `hasNewThemeImages` prop

Signed-off-by: Josh Romero <[email protected]>
  • Loading branch information
joshuarrrr committed Sep 2, 2023
1 parent c886b00 commit b3e2b79
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const NewThemeModal: FC<Props> = ({ addBasePath, onClose }) => {
services: { application },
} = useOpenSearchDashboards<CoreStart>();

// TODO: Finalize copy
return (
<EuiModal onClose={onClose}>
<EuiModalHeader>
Expand Down Expand Up @@ -71,20 +70,18 @@ export const NewThemeModal: FC<Props> = ({ addBasePath, onClose }) => {
</EuiText>
</RedirectAppLinks>
<EuiSpacer />
<EuiFlexGroup gutterSize="none">
<EuiFlexGroup gutterSize="s">
<EuiFlexItem>
{/* TODO: Replace with actual next theme preview images. Using welcome graphics as placeholders */}
<EuiImage
url={addBasePath('/plugins/home/assets/welcome_graphic_light_2x.png')}
url={addBasePath('/plugins/home/assets/new_theme_light.png')}
alt={i18n.translate('home.newThemeModal.lightModeImageAltDescription', {
defaultMessage: 'screenshot of new theme in light mode',
})}
/>
</EuiFlexItem>
<EuiFlexItem>
{/* TODO: Replace with actual next theme preview images. Using welcome graphics as placeholders */}
<EuiImage
url={addBasePath('/plugins/home/assets/welcome_graphic_dark_2x.png')}
url={addBasePath('/plugins/home/assets/new_theme_dark.png')}
alt={i18n.translate('home.newThemeModal.darkModeImageAltDescription', {
defaultMessage: 'screenshot of new theme in dark mode',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,18 @@ export class SampleDataSetCards extends React.Component {
};

lightOrDarkImage = (sampleDataSet) => {
return getServices().uiSettings.get('theme:darkMode') && sampleDataSet.darkPreviewImagePath
? sampleDataSet.darkPreviewImagePath
: sampleDataSet.previewImagePath;
let imagePath = sampleDataSet.previewImagePath;

if (sampleDataSet.darkPreviewImagePath && getServices().uiSettings.get('theme:darkMode')) {
imagePath = sampleDataSet.darkPreviewImagePath;
}

// For `next` theme, append `_new`
if (sampleDataSet.hasNewThemeImages && getServices().uiSettings.get('theme:version') !== 'v7') {
imagePath = imagePath.replace(/.png/, '_new.png');
}

return imagePath;
};

render() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const ecommerceSpecProvider = function (): SampleDatasetSchema {
description: ecommerceDescription,
previewImagePath: '/plugins/home/assets/sample_data_resources/ecommerce/dashboard.png',
darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/ecommerce/dashboard_dark.png',
hasNewThemeImages: true,
overviewDashboard: DASHBOARD_ID,
getDataSourceIntegratedDashboard: appendDataSourceId(DASHBOARD_ID),
appLinks: initialAppLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const flightsSpecProvider = function (): SampleDatasetSchema {
description: flightsDescription,
previewImagePath: '/plugins/home/assets/sample_data_resources/flights/dashboard.png',
darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/flights/dashboard_dark.png',
hasNewThemeImages: true,
overviewDashboard: DASHBOARD_ID,
getDataSourceIntegratedDashboard: appendDataSourceId(DASHBOARD_ID),
appLinks: initialAppLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const logsSpecProvider = function (): SampleDatasetSchema {
description: logsDescription,
previewImagePath: '/plugins/home/assets/sample_data_resources/logs/dashboard.png',
darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/logs/dashboard_dark.png',
hasNewThemeImages: true,
overviewDashboard: DASHBOARD_ID,
getDataSourceIntegratedDashboard: appendDataSourceId(DASHBOARD_ID),
appLinks: initialAppLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export interface SampleDatasetSchema<T = unknown> {
description: string;
previewImagePath: string;
darkPreviewImagePath: string;
hasNewThemeImages?: boolean;

// saved object id of main dashboard for sample data set
overviewDashboard: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const sampleDataSchema = {
description: Joi.string().required(),
previewImagePath: Joi.string().required(),
darkPreviewImagePath: Joi.string(),
hasNewThemeImages: Joi.boolean(),

// saved object id of main dashboard for sample data set
overviewDashboard: Joi.string().required(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const createListRoute = (router: IRouter, sampleDatasets: SampleDatasetSc
description: sampleDataset.description,
previewImagePath: sampleDataset.previewImagePath,
darkPreviewImagePath: sampleDataset.darkPreviewImagePath,
hasNewThemeImages: sampleDataset.hasNewThemeImages,
overviewDashboard: sampleDataset.getDataSourceIntegratedDashboard(dataSourceId),
appLinks: sampleDataset.appLinks,
defaultIndex: sampleDataset.getDataSourceIntegratedDefaultIndex(dataSourceId),
Expand Down

0 comments on commit b3e2b79

Please sign in to comment.