Skip to content

Commit

Permalink
upgrade to latest vite (#320)
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <[email protected]>
  • Loading branch information
shanghaikid authored Nov 22, 2023
1 parent 97f6d84 commit 17db0cb
Show file tree
Hide file tree
Showing 5 changed files with 560 additions and 295 deletions.
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"react-router-dom": "^6.14.2",
"react-syntax-highlighter": "^15.5.0",
"socket.io-client": "^4.7.1",
"vite": "4.4.11",
"vite-plugin-svgr": "^0.3.0",
"vite": "5.0.2",
"vite-plugin-svgr": "4.2.0",
"web-vitals": "^1.0.1"
},
"devDependencies": {
Expand Down
28 changes: 14 additions & 14 deletions client/src/components/icons/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ import GetAppIcon from '@material-ui/icons/GetApp';
// import PersonOutlineIcon from '@material-ui/icons/PersonOutline';
import PersonOutlineIcon from '@material-ui/icons/Person';
import { SvgIcon } from '@material-ui/core';
import { ReactComponent as ZillizIcon } from '../../assets/icons/attu.svg';
import { ReactComponent as OverviewIcon } from '../../assets/icons/overview.svg';
import { ReactComponent as CollectionIcon } from '../../assets/icons/collecion.svg';
import { ReactComponent as ConsoleIcon } from '../../assets/icons/console.svg';
import { ReactComponent as InfoIcon } from '../../assets/icons/info.svg';
import { ReactComponent as ReleaseIcon } from '../../assets/icons/release.svg';
import { ReactComponent as LoadIcon } from '../../assets/icons/load.svg';
import { ReactComponent as KeyIcon } from '../../assets/icons/key.svg';
import { ReactComponent as UploadIcon } from '../../assets/icons/upload.svg';
import { ReactComponent as VectorSearchIcon } from '../../assets/icons/nav-search.svg';
import { ReactComponent as SearchEmptyIcon } from '../../assets/icons/search.svg';
import { ReactComponent as CopyIcon } from '../../assets/icons/copy.svg';
import { ReactComponent as SystemIcon } from '../../assets/icons/system.svg';
import { ReactComponent as Compact } from '../../assets/icons/compact.svg';
import ZillizIcon from '@/assets/icons/attu.svg?react';
import OverviewIcon from '@/assets/icons/overview.svg?react';
import CollectionIcon from '@/assets/icons/collecion.svg?react';
import ConsoleIcon from '@/assets/icons/console.svg?react';
import InfoIcon from '@/assets/icons/info.svg?react';
import ReleaseIcon from '@/assets/icons/release.svg?react';
import LoadIcon from '@/assets/icons/load.svg?react';
import KeyIcon from '@/assets/icons/key.svg?react';
import UploadIcon from '@/assets/icons/upload.svg?react';
import VectorSearchIcon from '@/assets/icons/nav-search.svg?react';
import SearchEmptyIcon from '@/assets/icons/search.svg?react';
import CopyIcon from '@/assets/icons/copy.svg?react';
import SystemIcon from '@/assets/icons/system.svg?react';
import Compact from '@/assets/icons/compact.svg?react';

const icons: { [x in IconsType]: (props?: any) => React.ReactElement } = {
search: (props = {}) => <SearchIcon {...props} />,
Expand Down
50 changes: 25 additions & 25 deletions client/src/components/menu/CommunityBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import SvgIcon from '@material-ui/core/SvgIcon';
import { makeStyles, Theme, Link } from '@material-ui/core';
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import GitHubIcon from '@material-ui/icons/GitHub';
import { ReactComponent as peopleIcon } from '../../assets/icons/people.svg';
import { ReactComponent as slackIcon } from '../../assets/icons/slack.svg';
import peopleIcon from '@/assets/icons/people.svg?react';
import slackIcon from '@/assets/icons/slack.svg?react';
import qrcodePath from '../../assets/imgs/wechat_qrcode.png';

const SLACK_LINK = 'https://slack.milvus.io';
Expand Down Expand Up @@ -78,14 +78,12 @@ const getStyles = makeStyles((theme: Theme) => ({
fontWeight: 500,
fontSize: theme.spacing(1.75),
lineHeight: theme.spacing(2.5),

},
contentDesc: {
fontSize: theme.spacing(1.5),
lineHeight: theme.spacing(2.5),
color: theme.palette.attuGrey.dark,
marginBottom: theme.spacing(1),

},
contentLink: {
display: 'block',
Expand All @@ -106,7 +104,7 @@ const getStyles = makeStyles((theme: Theme) => ({
marginTop: theme.spacing(2),
width: theme.spacing(2.5),
height: theme.spacing(2.5),
}
},
}));

const CommunityBtn = (props: any) => {
Expand All @@ -120,12 +118,8 @@ const CommunityBtn = (props: any) => {
{open && (
<div className={classes.container}>
<div className={classes.head}>
<div className={classes.title}>
{communityTrans.hi}
</div>
<div className={classes.titleDesc}>
{communityTrans.growing}
</div>
<div className={classes.title}>{communityTrans.hi}</div>
<div className={classes.titleDesc}>{communityTrans.growing}</div>
</div>
<div className={classes.body}>
<div className={classes.block}>
Expand All @@ -142,28 +136,32 @@ const CommunityBtn = (props: any) => {
{communityTrans.more}
</div>

<SvgIcon viewBox="0 0 24 24" component={slackIcon} className={classes.icon} />
<div className={classes.contentDesc}>
{communityTrans.join}
</div>
<SvgIcon
viewBox="0 0 24 24"
component={slackIcon}
className={classes.icon}
/>
<div className={classes.contentDesc}>{communityTrans.join}</div>
<Link
classes={{ root: classes.contentLink }}
href={SLACK_LINK}
underline='always'
underline="always"
target="_blank"
rel="noopener"
>
{SLACK_LINK}
</Link>

<SvgIcon viewBox="0 0 24 24" component={GitHubIcon} className={classes.icon} />
<div className={classes.contentDesc}>
{communityTrans.get}
</div>
<SvgIcon
viewBox="0 0 24 24"
component={GitHubIcon}
className={classes.icon}
/>
<div className={classes.contentDesc}>{communityTrans.get}</div>
<Link
classes={{ root: classes.contentLink }}
href={GITHUB_LINK}
underline='always'
underline="always"
target="_blank"
rel="noopener"
>
Expand All @@ -176,13 +174,15 @@ const CommunityBtn = (props: any) => {
<Button
className={classes.menuBtn}
aria-haspopup="true"
onClick={() => { setOpen(!open) }}
onClick={() => {
setOpen(!open);
}}
>
{open ?
{open ? (
<ChevronRightIcon className={classes.chevronIcon} />
:
) : (
<SvgIcon viewBox="0 0 24 24" component={peopleIcon} />
}
)}
</Button>
</div>
);
Expand Down
13 changes: 7 additions & 6 deletions client/vite.config.ts → client/vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'vite';
import * as path from 'path';
import reactRefresh from '@vitejs/plugin-react';
const svgrPlugin = require('vite-plugin-svgr');
import svgr from 'vite-plugin-svgr';

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -16,11 +16,12 @@ export default defineConfig({
},
plugins: [
reactRefresh(),
svgrPlugin({
svgrOptions: {
icon: true,
// ...svgr options (https://react-svgr.com/docs/options/)
},
svgr({
// A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should include.
include: '**/*.svg?react',

// A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.
exclude: '',
}),
],
resolve: {
Expand Down
Loading

0 comments on commit 17db0cb

Please sign in to comment.