Skip to content

Commit b9df834

Browse files
committed
chore: add DBHubBanner
1 parent 2f9679e commit b9df834

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/components/ConversationView/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import MessageView from "./MessageView";
2222
import ClearConversationButton from "../ClearConversationButton";
2323
import MessageTextarea from "./MessageTextarea";
2424
import DataStorageBanner from "../DataStorageBanner";
25+
import DBHubBanner from "../DBHubBanner";
2526
import SchemaDrawer from "../SchemaDrawer";
2627
import Icon from "../Icon";
2728
import { useTranslation } from "react-i18next";
@@ -320,6 +321,7 @@ const ConversationView = () => {
320321
} relative w-full h-full max-h-full flex flex-col justify-start items-start overflow-y-auto bg-white dark:bg-zinc-800`}
321322
>
322323
<div className="sticky top-0 z-1 bg-white dark:bg-zinc-800 w-full flex flex-col justify-start items-start">
324+
<DBHubBanner />
323325
<DataStorageBanner />
324326
<Header className={showHeaderShadow ? "shadow" : ""} />
325327
</div>

src/components/DBHubBanner.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { useTranslation } from "react-i18next";
2+
import { useLocalStorage } from "react-use";
3+
import Icon from "./Icon";
4+
5+
interface Props {
6+
className?: string;
7+
alwaysShow?: boolean;
8+
}
9+
10+
const DBHubBanner = (props: Props) => {
11+
const { className, alwaysShow } = props;
12+
const { t } = useTranslation();
13+
const [hideBanner, setHideBanner] = useLocalStorage("hide-github-banner", false);
14+
const show = alwaysShow || !hideBanner;
15+
16+
return (
17+
<div
18+
className={`${!show && "!hidden"} ${
19+
className || ""
20+
} relative w-full flex flex-row justify-start sm:justify-center items-center px-4 py-1 bg-blue-50 dark:bg-blue-900`}
21+
>
22+
<span className="text-sm leading-6 pr-4">
23+
<a
24+
href="https://github.com/bytebase/dbhub"
25+
target="_blank"
26+
rel="noopener noreferrer"
27+
className="text-blue-600 dark:text-blue-300 hover:underline font-medium"
28+
>
29+
Check out DBHub - a universal database MCP server to be used by Cursor, Claude Desktop, and more
30+
</a>
31+
</span>
32+
{!alwaysShow && (
33+
<button className="absolute right-2 sm:right-4 opacity-60 hover:opacity-100" onClick={() => setHideBanner(true)}>
34+
<Icon.BiX className="w-6 h-auto" />
35+
</button>
36+
)}
37+
</div>
38+
);
39+
};
40+
41+
export default DBHubBanner;

0 commit comments

Comments
 (0)