Skip to content

Commit

Permalink
🎉 upgrade antd to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
helianthuswhite committed May 9, 2023
1 parent f04e481 commit 9822f07
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"antd": "^4.24.8",
"antd": "^5.4.7",
"classnames": "^2.3.2",
"copy-to-clipboard": "^3.3.3",
"dom-to-image": "^2.6.0",
Expand Down
27 changes: 19 additions & 8 deletions src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ const Footer: React.FC<Props> = ({ onMessageUpdate, responding, setResponding })
const currentHistory = useMemo(() => {
return history.find((item) => item.uuid === uuid);
}, [history, uuid]);
const mentionOptions = useMemo(() => {
const options = [
{
label: "图片模式-Dalle2",
value: "image$dall-e2",
},
];

if (userInfo.vipUser) {
options.push({
label: "图片模式-Stable Diffusion",
value: "image$stable-diffusion",
});
}

return options;
}, [userInfo.vipUser]);

const submit = async (text: string) => {
let message = text.trim();
Expand Down Expand Up @@ -175,14 +192,8 @@ const Footer: React.FC<Props> = ({ onMessageUpdate, responding, setResponding })
onChange={onInputChange}
onSelect={(e) => setModel(e.value as Model)}
onPressEnter={onPressEnter}
>
<Mentions.Option value="image$dall-e2">图片模式-Dalle2</Mentions.Option>
{userInfo.vipUser && (
<Mentions.Option value="image$stable-diffusion">
图片模式-Stable Diffusion
</Mentions.Option>
)}
</Mentions>
options={mentionOptions}
/>
<Button type="primary" onClick={() => submit(value)}>
<SendOutlined />
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Setting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Setting: React.FC<Props> = ({ open, notice, onCancel }) => {
okText="保存"
footer={null}
width={800}
bodyStyle={isMobile ? {} : { padding: "54px 54px 24px 24px" }}
bodyStyle={isMobile ? {} : { padding: "10px 20px 0 0" }}
>
<Tabs destroyInactiveTabPane tabPosition={isMobile ? "top" : "left"}>
<Tabs.TabPane tab="基本信息" key="1">
Expand Down
37 changes: 21 additions & 16 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@ import UserStoreProvider from "@/store/User";
import { ConfigProvider } from "antd";
import Script from "next/script";

ConfigProvider.config({
theme: {
primaryColor: "#3050fb",
},
});

export default function App({ Component, pageProps }: AppProps) {
return (
<AppStoreProvider>
<UserStoreProvider>
<Component {...pageProps} />
<Script
async
src="https://chatalpha-umami.zeabur.app/script.js"
data-website-id="ecbe897f-e1ef-4e3e-8179-cc3bb9a5944c"
/>
</UserStoreProvider>
</AppStoreProvider>
<ConfigProvider
theme={{
token: {
colorPrimary: "#3050fb",
colorLink: "#3050fb",
colorInfo: "#3050fb",
colorInfoHover: "#5978ff",
},
}}
>
<AppStoreProvider>
<UserStoreProvider>
<Component {...pageProps} />
<Script
async
src="https://chatalpha-umami.zeabur.app/script.js"
data-website-id="ecbe897f-e1ef-4e3e-8179-cc3bb9a5944c"
/>
</UserStoreProvider>
</AppStoreProvider>
</ConfigProvider>
);
}
2 changes: 1 addition & 1 deletion src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@tailwind components;
@tailwind utilities;

@import "antd/dist/antd.variable.min.css";
@import "antd/dist/reset.css";

html,
body,
Expand Down

0 comments on commit 9822f07

Please sign in to comment.