Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add tooltip to SQL favourite button

Terry Sutton79c3385de9c2
diff --git a/studio/components/interfaces/SQLEditor/TabSqlQuery/FavouriteButton.tsx b/studio/components/interfaces/SQLEditor/TabSqlQuery/FavouriteButton.tsx
index a1dc3e3b6a1..7e3784e16f2 100644
--- a/studio/components/interfaces/SQLEditor/TabSqlQuery/FavouriteButton.tsx
+++ b/studio/components/interfaces/SQLEditor/TabSqlQuery/FavouriteButton.tsx
@@ -1,7 +1,7 @@
import { observer } from 'mobx-react-lite'
import { useState } from 'react'
import { Button, IconHeart } from '@supabase/ui'
-
+import * as Tooltip from '@radix-ui/react-tooltip'
import { useStore } from 'hooks'
import Telemetry from 'lib/telemetry'
import { useSqlStore } from 'localStores/sqlEditor/SqlEditorStore'
@@ -99,27 +99,36 @@ const FavouriteButton = () => {
}
}
+ const isFavorite = sqlEditorStore.activeTab.favorite
+
return (
<>
- {sqlEditorStore.activeTab.favorite ? (
- <Button
- type="text"
- size="tiny"
- shadow={false}
- onClick={unFavorite}
- loading={loading}
- icon={<IconHeart size="tiny" fill="#48bb78" />}
- />
- ) : (
- <Button
- type="text"
- size="tiny"
- shadow={false}
- onClick={addToFavorite}
- loading={loading}
- icon={<IconHeart size="tiny" fill="gray" />}
- />
- )}
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">
+ {isFavorite ? 'Remove' : 'Add'} this query {isFavorite ? 'from' : 'to'} your
+ Favourites
+ </span>
+ </div>
+ </Tooltip.Content>
+ <Tooltip.Trigger type="button">
+ <Button
+ type="text"
+ size="tiny"
+ shadow={false}
+ onClick={isFavorite ? unFavorite : addToFavorite}
+ loading={loading}
+ icon={<IconHeart size="tiny" fill={isFavorite ? '#48bb78' : 'gray'} />}
+ />
+ </Tooltip.Trigger>
+ </Tooltip.Root>
</>
)
}