LinterPageFooter.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import { LOCAL_STORAGE_KEYS } from 'common'
  2. import { X } from 'lucide-react'
  3. import { Button, cn } from 'ui'
  4. import { Markdown } from '../Markdown'
  5. import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
  6. import { DOCS_URL } from '@/lib/constants'
  7. interface LinterPageFooterProps {
  8. isLoading: boolean
  9. isRefetching: boolean
  10. refetch: () => void
  11. hideDbInspectCTA?: boolean
  12. }
  13. export const LinterPageFooter = ({
  14. isLoading,
  15. isRefetching,
  16. refetch,
  17. hideDbInspectCTA,
  18. }: LinterPageFooterProps) => {
  19. const [showBottomSection, setShowBottomSection] = useLocalStorageQuery(
  20. LOCAL_STORAGE_KEYS.LINTER_SHOW_FOOTER,
  21. true
  22. )
  23. if (!showBottomSection) {
  24. return null
  25. }
  26. return (
  27. <div className="px-6 py-6 flex gap-x-4 border-t relative">
  28. <Button
  29. className="absolute top-1.5 right-3 px-1.5"
  30. type="text"
  31. size="tiny"
  32. onClick={() => setShowBottomSection(false)}
  33. >
  34. <X size="14" />
  35. </Button>
  36. <div
  37. className={cn(hideDbInspectCTA ? 'w-[35%]' : 'w-[33%]', 'flex flex-col gap-y-1 text-sm')}
  38. >
  39. <p>Reset suggestions</p>
  40. <p className="text-xs text-foreground-light">
  41. Consider resetting the analysis after making any changes
  42. </p>
  43. <Button
  44. type="default"
  45. className="mt-3! w-min"
  46. disabled={isLoading || isRefetching}
  47. loading={isLoading || isRefetching}
  48. onClick={() => refetch()}
  49. >
  50. Rerun linter
  51. </Button>
  52. </div>
  53. <div
  54. className={cn(hideDbInspectCTA ? 'w-[35%]' : 'w-[33%]', 'flex flex-col gap-y-1 text-sm')}
  55. >
  56. <p>How are these suggestions generated?</p>
  57. <div className="prose text-xs">
  58. <p>
  59. <span>These suggestions use </span>
  60. <a href="https://github.com/briven/splinter" target="" rel="">
  61. splinter (Briven Postgres LINTER)
  62. </a>
  63. .
  64. </p>
  65. </div>
  66. </div>
  67. {!hideDbInspectCTA && (
  68. <div className="w-[33%] flex flex-col gap-y-1 text-sm">
  69. <p>Inspect your database for potential issues</p>
  70. <Markdown
  71. className="text-xs"
  72. content={`The Briven CLI comes with a range of tools to help inspect your Postgres instances for
  73. potential issues. [Learn more here](${DOCS_URL}/guides/database/inspect).`}
  74. />
  75. </div>
  76. )}
  77. </div>
  78. )
  79. }