-
Notifications
You must be signed in to change notification settings - Fork 870
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Next theme] Add modal to notify users of theme updates (#4715)
* Feat (home): Add modal to introduce `next` theme changes Copy and images provisional, for demo purposes only. Signed-off-by: Josh Romero <rmerqg@amazon.com> * revert unintended config change Signed-off-by: Josh Romero <rmerqg@amazon.com> * add changelog Signed-off-by: Josh Romero <rmerqg@amazon.com> * Disable new theme modal for functional tests Signed-off-by: Josh Romero <rmerqg@amazon.com> * add deep link to settings and hide modal if v7 theme is in use Signed-off-by: Josh Romero <rmerqg@amazon.com> * add unit tests and fix imports Signed-off-by: Josh Romero <rmerqg@amazon.com> --------- Signed-off-by: Josh Romero <rmerqg@amazon.com> (cherry picked from commit b846e80) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
- Loading branch information
1 parent
6542257
commit 12e285d
Showing
8 changed files
with
265 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/plugins/home/public/application/components/__snapshots__/home.test.js.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
src/plugins/home/public/application/components/new_theme_modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { FC } from 'react'; | ||
import { | ||
EuiButton, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiImage, | ||
EuiLink, | ||
EuiModal, | ||
EuiModalHeader, | ||
EuiModalHeaderTitle, | ||
EuiModalBody, | ||
EuiModalFooter, | ||
EuiSpacer, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
import { i18n } from '@osd/i18n'; | ||
import { FormattedMessage } from '@osd/i18n/react'; | ||
import { CoreStart } from 'opensearch-dashboards/public'; | ||
import { | ||
RedirectAppLinks, | ||
useOpenSearchDashboards, | ||
} from '../../../../../../src/plugins/opensearch_dashboards_react/public'; | ||
|
||
interface Props { | ||
addBasePath: (path: string) => string; | ||
onClose: () => void; | ||
} | ||
|
||
export const NewThemeModal: FC<Props> = ({ addBasePath, onClose }) => { | ||
const { | ||
services: { application }, | ||
} = useOpenSearchDashboards<CoreStart>(); | ||
|
||
// TODO: Finalize copy | ||
return ( | ||
<EuiModal onClose={onClose}> | ||
<EuiModalHeader> | ||
<EuiModalHeaderTitle> | ||
<FormattedMessage | ||
id="home.newThemeModal.title" | ||
defaultMessage="Introducing new OpenSearch Dashboards look & feel" | ||
/> | ||
</EuiModalHeaderTitle> | ||
</EuiModalHeader> | ||
|
||
<EuiModalBody> | ||
<RedirectAppLinks application={application}> | ||
<EuiText> | ||
<FormattedMessage | ||
id="home.newThemeModal.previewDescription.previewDetail" | ||
defaultMessage="You are now previewing the newest OpenSearch Dashboards theme with improved light and dark | ||
modes. You or your administrator can change to the previous theme by visiting {advancedSettingsLink}." | ||
values={{ | ||
advancedSettingsLink: ( | ||
<EuiLink | ||
href={addBasePath('/app/management/opensearch-dashboards/settings#appearance')} | ||
> | ||
<FormattedMessage | ||
id="home.newThemeModal.previewDescription.advancedSettingsLinkText" | ||
defaultMessage="Advanced Settings" | ||
/> | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</EuiText> | ||
</RedirectAppLinks> | ||
<EuiSpacer /> | ||
<EuiFlexGroup gutterSize="none"> | ||
<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')} | ||
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')} | ||
alt={i18n.translate('home.newThemeModal.darkModeImageAltDescription', { | ||
defaultMessage: 'screenshot of new theme in dark mode', | ||
})} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiModalBody> | ||
|
||
<EuiModalFooter> | ||
<EuiButton onClick={onClose} fill> | ||
<FormattedMessage id="home.newThemeModal.dismissButtonLabel" defaultMessage="Dismiss" /> | ||
</EuiButton> | ||
</EuiModalFooter> | ||
</EuiModal> | ||
); | ||
}; |
Oops, something went wrong.