Skip to content

Commit 785aad7

Browse files
committed
move the banner into react-world and use the theme
1 parent 2c4411f commit 785aad7

File tree

4 files changed

+35
-30
lines changed

4 files changed

+35
-30
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export default function printConsoleBanner(color: string, fontFamily: string) {
2+
// eslint-disable-next-line no-console
3+
console.log(
4+
`%c
5+
██████╗ ███████╗███╗ ██╗████████╗██████╗ ██╗ ██╗
6+
██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝██╔══██╗╚██╗ ██╔╝
7+
╚█████╗ █████╗ ██╔██╗ ██║ ██║ ██████╔╝ ╚████╔╝
8+
╚═══██╗ ██╔══╝ ██║╚██╗██║ ██║ ██╔══██╗ ╚██╔╝
9+
██████╔╝ ███████╗██║ ╚████║ ██║ ██║ ██║ ██║
10+
╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
11+
12+
👋 Hey, you opened the console!
13+
14+
Found a bug?
15+
Yeah, we probably know about it. We literally built a company
16+
around finding and fixing bugs. The irony isn't lost on us.
17+
18+
📚 Docs: https://docs.sentry.io/
19+
💬 Ideas? Complaints? Hot takes? https://github.com/getsentry/sentry/discussions
20+
21+
Like poking around in dev tools? We like that about you.
22+
We're hiring: https://sentry.io/careers/
23+
(We have snacks. And opinions about error handling.)
24+
`,
25+
`color: ${color}; font-family: ${fontFamily};`
26+
);
27+
}

static/app/components/themeAndStyleProvider.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {Fragment, lazy, useMemo} from 'react';
1+
import {Fragment, lazy, useEffect, useMemo} from 'react';
22
import {createPortal} from 'react-dom';
33
import createCache from '@emotion/cache';
44
import {CacheProvider, ThemeProvider} from '@emotion/react';
55

6+
import printConsoleBanner from 'sentry/bootstrap/printConsoleBanner';
67
import {NODE_ENV} from 'sentry/constants';
78
import ConfigStore from 'sentry/stores/configStore';
89
import {useLegacyStore} from 'sentry/stores/useLegacyStore';
@@ -60,6 +61,11 @@ export function ThemeAndStyleProvider({children}: Props) {
6061
useHotkeys(themeToggleHotkey);
6162

6263
const theme = config.theme === 'dark' ? darkTheme : lightTheme;
64+
useEffect(() => {
65+
if (NODE_ENV !== 'development') {
66+
printConsoleBanner(theme.colors.blue400, theme.text.familyMono);
67+
}
68+
}, [theme]);
6369

6470
return (
6571
<ThemeProvider theme={theme}>

static/app/index.tsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,6 @@
6868
// [1]: https://sentry.io/careers/
6969

7070
async function app() {
71-
// eslint-disable-next-line no-console
72-
console.log(
73-
`%c
74-
██████╗ ███████╗███╗ ██╗████████╗██████╗ ██╗ ██╗
75-
██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝██╔══██╗╚██╗ ██╔╝
76-
╚█████╗ █████╗ ██╔██╗ ██║ ██║ ██████╔╝ ╚████╔╝
77-
╚═══██╗ ██╔══╝ ██║╚██╗██║ ██║ ██╔══██╗ ╚██╔╝
78-
██████╔╝ ███████╗██║ ╚████║ ██║ ██║ ██║ ██║
79-
╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
80-
81-
👋 Hey, you opened the console!
82-
83-
Found a bug?
84-
Yeah, we probably know about it. We literally built a company
85-
around finding and fixing bugs. The irony isn't lost on us.
86-
87-
📚 Docs (we wrote them, please read them): https://docs.sentry.io/
88-
💬 Ideas? Complaints? Hot takes? https://github.com/getsentry/sentry/discussions
89-
90-
Like poking around in dev tools? We like that about you.
91-
We're hiring: https://sentry.io/careers/
92-
(We have snacks. And opinions about error handling.)
93-
`,
94-
`color: #6C5FC7; font-family: 'Roboto Mono', Monaco, Consolas, 'Courier New', monospace;`
95-
);
96-
9771
// We won't need initalizeMainImport until we complete bootstrapping.
9872
// Initaite the fetch, just don't await it until we need it.
9973
const initalizeMainImport = import('sentry/bootstrap/initializeMain');

static/app/main.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function buildRouter() {
2323
return router;
2424
}
2525

26-
function Main() {
26+
export default function Main() {
2727
const [router] = useState(buildRouter);
2828

2929
useEffect(() => {
@@ -51,5 +51,3 @@ function Main() {
5151
</AppQueryClientProvider>
5252
);
5353
}
54-
55-
export default Main;

0 commit comments

Comments
 (0)