ConnectContainer.tsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import { useEffect, useState } from 'react';
  2. import { makeStyles, Theme, Typography } from '@material-ui/core';
  3. import { useTranslation } from 'react-i18next';
  4. import Icons from '@/components/icons/Icons';
  5. import { AuthForm } from './AuthForm';
  6. import CustomButton from '@/components/customButton/CustomButton';
  7. import { MilvusService } from '@/http';
  8. const getContainerStyles = makeStyles((theme: Theme) => ({
  9. wrapper: {
  10. width: '100%',
  11. height: '100vh',
  12. },
  13. box: {
  14. display: 'flex',
  15. flexDirection: 'row',
  16. backgroundColor: '#fff',
  17. border: '1px solid #E0E0E0',
  18. boxShadow: '0px 6px 30px rgba(0, 0, 0, 0.1)',
  19. minHeight: 644,
  20. },
  21. logo: {
  22. width: 64,
  23. height: 'auto',
  24. marginBottom: theme.spacing(1),
  25. display: 'block',
  26. },
  27. links: {
  28. marginTop: theme.spacing(4),
  29. display: 'flex',
  30. flexDirection: 'column',
  31. alignItems: 'center',
  32. justifyContent: 'center',
  33. width: '100%',
  34. padding: theme.spacing(2, 0),
  35. '& button': {
  36. border: 'none',
  37. },
  38. },
  39. attu: {
  40. width: 299,
  41. display: 'flex',
  42. flexDirection: 'column',
  43. padding: theme.spacing(0, 3),
  44. backgroundColor: '#f5f5f5',
  45. },
  46. form: {
  47. width: 481,
  48. padding: theme.spacing(5, 0),
  49. },
  50. sub: {
  51. marginTop: theme.spacing(1),
  52. fontSize: 12,
  53. color: '#666',
  54. },
  55. }));
  56. // used for user connect process
  57. const ConnectContainer = () => {
  58. const [version, setVersion] = useState('');
  59. const classes = getContainerStyles();
  60. const { t: commonTrans } = useTranslation();
  61. const attuTrans = commonTrans('attu');
  62. const { t: btnTrans } = useTranslation('btn');
  63. useEffect(() => {
  64. MilvusService.getVersion().then((res: any) => {
  65. setVersion(res.attu);
  66. });
  67. }, []);
  68. return (
  69. <main className={`flex-center ${classes.wrapper}`}>
  70. <section className={classes.box}>
  71. <section className={`flex-center ${classes.attu}`}>
  72. <Icons.attu classes={{ root: classes.logo }} />
  73. <Typography variant="h2" className="title">
  74. {attuTrans.admin}
  75. </Typography>
  76. {version && (
  77. <Typography component="sub" className={classes.sub}>
  78. {attuTrans.version} {version}
  79. </Typography>
  80. )}
  81. <div className={classes.links}>
  82. <CustomButton
  83. startIcon={<Icons.star />}
  84. fullWidth={true}
  85. variant="outlined"
  86. onClick={() =>
  87. window.open('https://github.com/zilliztech/attu', '_blank')
  88. }
  89. >
  90. {btnTrans('star')}
  91. </CustomButton>
  92. <CustomButton
  93. startIcon={<Icons.github />}
  94. fullWidth={true}
  95. variant="outlined"
  96. onClick={() =>
  97. window.open(
  98. 'https://github.com/zilliztech/attu/issues',
  99. '_blank'
  100. )
  101. }
  102. >
  103. {attuTrans.fileIssue}
  104. </CustomButton>
  105. <CustomButton
  106. startIcon={<Icons.discord />}
  107. variant="outlined"
  108. onClick={() => window.open('https://milvus.io/discord', '_blank')}
  109. fullWidth={true}
  110. >
  111. {attuTrans.discord}
  112. </CustomButton>
  113. </div>
  114. </section>
  115. <section className={classes.form}>
  116. <AuthForm />
  117. </section>
  118. </section>
  119. </main>
  120. );
  121. };
  122. export default ConnectContainer;