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.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 React from 'react';
  30. import { useIntl } from 'react-intl';
  31. import InstanceMessage from '../../components/common/InstanceMessage';
  32. import AppVersionStatus from '../../components/shared/AppVersionStatus';
  33. import { useDocUrl } from '../../helpers/docs';
  34. import { getEdition } from '../../helpers/editions';
  35. import { useAppState } from './app-state/withAppStateContext';
  36. import GlobalFooterBranding from './GlobalFooterBranding';
  37. interface GlobalFooterProps {
  38. hideLoggedInInfo?: boolean;
  39. }
  40. export default function GlobalFooter({ hideLoggedInInfo }: Readonly<GlobalFooterProps>) {
  41. const appState = useAppState();
  42. const currentEdition = appState?.edition && getEdition(appState.edition);
  43. const intl = useIntl();
  44. const docUrl = useDocUrl();
  45. return (
  46. <StyledFooter className="sw-p-6" id="footer">
  47. <PageContentFontWrapper className="sw-body-sm sw-h-full sw-flex sw-flex-col sw-items-stretch">
  48. {appState?.productionDatabase === false && (
  49. <FlagMessage className="sw-mb-4" id="evaluation_warning" variant="warning">
  50. <p>
  51. <span className="sw-body-md-highlight">
  52. {intl.formatMessage({ id: 'footer.production_database_warning' })}
  53. </span>
  54. <br />
  55. <InstanceMessage
  56. message={intl.formatMessage({ id: 'footer.production_database_explanation' })}
  57. />
  58. </p>
  59. </FlagMessage>
  60. )}
  61. <div className="sw-flex sw-justify-between sw-items-center">
  62. <GlobalFooterBranding />
  63. <ul className="sw-flex sw-items-center sw-gap-3 sw-ml-4">
  64. {!hideLoggedInInfo && currentEdition && <li>{currentEdition.name}</li>}
  65. {!hideLoggedInInfo && appState?.version && (
  66. <li className="sw-code">
  67. <AppVersionStatus />
  68. </li>
  69. )}
  70. <li>
  71. <LinkStandalone
  72. highlight={LinkHighlight.CurrentColor}
  73. to="https://www.gnu.org/licenses/lgpl-3.0.txt"
  74. >
  75. {intl.formatMessage({ id: 'footer.license' })}
  76. </LinkStandalone>
  77. </li>
  78. <li>
  79. <LinkStandalone
  80. highlight={LinkHighlight.CurrentColor}
  81. to="https://community.sonarsource.com/c/help/sq"
  82. >
  83. {intl.formatMessage({ id: 'footer.community' })}
  84. </LinkStandalone>
  85. </li>
  86. <li>
  87. <LinkStandalone highlight={LinkHighlight.CurrentColor} to={docUrl('/')}>
  88. {intl.formatMessage({ id: 'footer.documentation' })}
  89. </LinkStandalone>
  90. </li>
  91. <li>
  92. <LinkStandalone
  93. highlight={LinkHighlight.CurrentColor}
  94. to={docUrl('/instance-administration/plugin-version-matrix/')}
  95. >
  96. {intl.formatMessage({ id: 'footer.plugins' })}
  97. </LinkStandalone>
  98. </li>
  99. {!hideLoggedInInfo && (
  100. <li>
  101. <LinkStandalone highlight={LinkHighlight.CurrentColor} to="/web_api">
  102. {intl.formatMessage({ id: 'footer.web_api' })}
  103. </LinkStandalone>
  104. </li>
  105. )}
  106. </ul>
  107. </div>
  108. </PageContentFontWrapper>
  109. </StyledFooter>
  110. );
  111. }
  112. const StyledFooter = styled.div`
  113. background-color: ${themeColor('backgroundSecondary')};
  114. border-top: ${themeBorder('default')};
  115. box-sizing: border-box;
  116. min-width: ${LAYOUT_VIEWPORT_MIN_WIDTH}px;
  117. `;