HeaderLogo.jsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. Copyright (C) 2025 QuantumNous
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. For commercial licensing, please contact support@quantumnous.com
  14. */
  15. import React from 'react';
  16. import { Link } from 'react-router-dom';
  17. import { Typography, Tag } from '@douyinfe/semi-ui';
  18. import SkeletonWrapper from '../components/SkeletonWrapper';
  19. const HeaderLogo = ({
  20. isMobile,
  21. isConsoleRoute,
  22. logo,
  23. logoLoaded,
  24. isLoading,
  25. systemName,
  26. isSelfUseMode,
  27. isDemoSiteMode,
  28. t,
  29. }) => {
  30. if (isMobile && isConsoleRoute) {
  31. return null;
  32. }
  33. return (
  34. <Link to='/' className='group flex items-center gap-2'>
  35. <div className='relative w-8 h-8 md:w-8 md:h-8'>
  36. <SkeletonWrapper loading={isLoading || !logoLoaded} type='image' />
  37. <img
  38. src={logo}
  39. alt='logo'
  40. className={`absolute inset-0 w-full h-full transition-all duration-200 group-hover:scale-110 rounded-full ${!isLoading && logoLoaded ? 'opacity-100' : 'opacity-0'}`}
  41. />
  42. </div>
  43. <div className='hidden md:flex items-center gap-2'>
  44. <div className='flex items-center gap-2'>
  45. <SkeletonWrapper
  46. loading={isLoading}
  47. type='title'
  48. width={120}
  49. height={24}
  50. >
  51. <Typography.Title
  52. heading={4}
  53. className='!text-lg !font-semibold !mb-0'
  54. >
  55. {systemName}
  56. </Typography.Title>
  57. </SkeletonWrapper>
  58. {(isSelfUseMode || isDemoSiteMode) && !isLoading && (
  59. <Tag
  60. color={isSelfUseMode ? 'purple' : 'blue'}
  61. className='text-xs px-1.5 py-0.5 rounded whitespace-nowrap shadow-sm'
  62. size='small'
  63. shape='circle'
  64. >
  65. {isSelfUseMode ? t('自用模式') : t('演示站点')}
  66. </Tag>
  67. )}
  68. </div>
  69. </div>
  70. </Link>
  71. );
  72. };
  73. export default HeaderLogo;