You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GlobalFooter.tsx 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import styled from '@emotion/styled';
  21. import { LinkHighlight, LinkStandalone } from '@sonarsource/echoes-react';
  22. import {
  23. FlagMessage,
  24. LAYOUT_VIEWPORT_MIN_WIDTH,
  25. PageContentFontWrapper,
  26. themeBorder,
  27. themeColor,
  28. } from 'design-system';
  29. import * as React from 'react';
  30. import InstanceMessage from '../../components/common/InstanceMessage';
  31. import { useDocUrl } from '../../helpers/docs';
  32. import { getEdition } from '../../helpers/editions';
  33. import { translate, translateWithParameters } from '../../helpers/l10n';
  34. import GlobalFooterBranding from './GlobalFooterBranding';
  35. import { AppStateContext } from './app-state/AppStateContext';
  36. interface GlobalFooterProps {
  37. hideLoggedInInfo?: boolean;
  38. }
  39. export default function GlobalFooter({ hideLoggedInInfo }: Readonly<GlobalFooterProps>) {
  40. const appState = React.useContext(AppStateContext);
  41. const currentEdition = appState?.edition && getEdition(appState.edition);
  42. const docUrl = useDocUrl();
  43. return (
  44. <StyledFooter className="sw-p-6" id="footer">
  45. <PageContentFontWrapper className="sw-body-sm sw-h-full sw-flex sw-flex-col sw-items-stretch">
  46. {appState?.productionDatabase === false && (
  47. <FlagMessage className="sw-mb-4" id="evaluation_warning" variant="warning">
  48. <p>
  49. <span className="sw-body-md-highlight">
  50. {translate('footer.production_database_warning')}
  51. </span>
  52. <br />
  53. <InstanceMessage message={translate('footer.production_database_explanation')} />
  54. </p>
  55. </FlagMessage>
  56. )}
  57. <div className="sw-flex sw-justify-between sw-items-center">
  58. <GlobalFooterBranding />
  59. <ul className="sw-flex sw-items-center sw-gap-3 sw-ml-4">
  60. {!hideLoggedInInfo && currentEdition && <li>{currentEdition.name}</li>}
  61. {!hideLoggedInInfo && appState?.version && (
  62. <li className="sw-code">
  63. {translateWithParameters('footer.version_x', appState.version)}
  64. </li>
  65. )}
  66. <li>
  67. <LinkStandalone
  68. highlight={LinkHighlight.CurrentColor}
  69. to="https://www.gnu.org/licenses/lgpl-3.0.txt"
  70. >
  71. {translate('footer.license')}
  72. </LinkStandalone>
  73. </li>
  74. <li>
  75. <LinkStandalone
  76. highlight={LinkHighlight.CurrentColor}
  77. to="https://community.sonarsource.com/c/help/sq"
  78. >
  79. {translate('footer.community')}
  80. </LinkStandalone>
  81. </li>
  82. <li>
  83. <LinkStandalone highlight={LinkHighlight.CurrentColor} to={docUrl('/')}>
  84. {translate('footer.documentation')}
  85. </LinkStandalone>
  86. </li>
  87. <li>
  88. <LinkStandalone
  89. highlight={LinkHighlight.CurrentColor}
  90. to={docUrl('/instance-administration/plugin-version-matrix/')}
  91. >
  92. {translate('footer.plugins')}
  93. </LinkStandalone>
  94. </li>
  95. {!hideLoggedInInfo && (
  96. <li>
  97. <LinkStandalone highlight={LinkHighlight.CurrentColor} to="/web_api">
  98. {translate('footer.web_api')}
  99. </LinkStandalone>
  100. </li>
  101. )}
  102. </ul>
  103. </div>
  104. </PageContentFontWrapper>
  105. </StyledFooter>
  106. );
  107. }
  108. const StyledFooter = styled.div`
  109. background-color: ${themeColor('backgroundSecondary')};
  110. border-top: ${themeBorder('default')};
  111. box-sizing: border-box;
  112. min-width: ${LAYOUT_VIEWPORT_MIN_WIDTH}px;
  113. `;