diff --git a/public/app/core/components/Bookmarks/BookmarksPage.tsx b/public/app/core/components/Bookmarks/BookmarksPage.tsx index 8674b7a11c9..d7e48ac68bb 100644 --- a/public/app/core/components/Bookmarks/BookmarksPage.tsx +++ b/public/app/core/components/Bookmarks/BookmarksPage.tsx @@ -1,8 +1,9 @@ import { css } from '@emotion/css'; -import { GrafanaTheme2 } from '@grafana/data'; -import { useStyles2 } from '@grafana/ui'; +import { GrafanaTheme2, NavModelItem } from '@grafana/data'; +import { EmptyState, useStyles2 } from '@grafana/ui'; import { Page } from 'app/core/components/Page/Page'; +import { t, Trans } from 'app/core/internationalization'; import { useSelector } from 'app/types'; import { usePinnedItems } from '../AppChrome/MegaMenu/hooks'; @@ -14,25 +15,40 @@ export function BookmarksPage() { const pinnedItems = usePinnedItems(); const navTree = useSelector((state) => state.navBarTree); + const validItems = pinnedItems.reduce((acc: NavModelItem[], url) => { + const item = findByUrl(navTree, url); + if (item) { + acc.push(item); + } + return acc; + }, []); + return ( -
- {pinnedItems.map((url) => { - const item = findByUrl(navTree, url); - if (!item) { - return null; - } - return ( - - ); - })} -
+ {validItems.length === 0 ? ( + + + Hover over any item in the nav menu and click on the bookmark icon to add it here. + + + ) : ( +
+ {validItems.map((item) => { + return ( + + ); + })} +
+ )}
); diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index bdff7757373..c33b57d1979 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -233,6 +233,12 @@ "message": "No API keys found" } }, + "bookmarks-page": { + "empty": { + "message": "It looks like you haven’t created any bookmarks yet", + "tip": "Hover over any item in the nav menu and click on the bookmark icon to add it here." + } + }, "bouncing-loader": { "label": "Loading" }, diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index 8687fb0f5ac..195424cf456 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -233,6 +233,12 @@ "message": "Ńő ÅPĨ ĸęyş ƒőūʼnđ" } }, + "bookmarks-page": { + "empty": { + "message": "Ĩŧ ľőőĸş ľįĸę yőū ĥävęʼn’ŧ čřęäŧęđ äʼny þőőĸmäřĸş yęŧ", + "tip": "Ħővęř ővęř äʼny įŧęm įʼn ŧĥę ʼnäv męʼnū äʼnđ čľįčĸ őʼn ŧĥę þőőĸmäřĸ įčőʼn ŧő äđđ įŧ ĥęřę." + } + }, "bouncing-loader": { "label": "Ŀőäđįʼnģ" },