The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: make SQL editor preview table cells copyable
gitstart8f8bd6e70dfa
diff --git a/studio/components/to-be-cleaned/SqlEditor/TabSqlQuery.js b/studio/components/to-be-cleaned/SqlEditor/TabSqlQuery.jsindex dd0cdba43d2..c2aedc4800e 100644--- a/studio/components/to-be-cleaned/SqlEditor/TabSqlQuery.js+++ b/studio/components/to-be-cleaned/SqlEditor/TabSqlQuery.js@@ -5,7 +5,7 @@ import { CSVLink } from 'react-csv'import { debounce } from 'lodash'import { observer } from 'mobx-react-lite'import { useEffect, useRef, useState } from 'react'-import { Button, Dropdown, IconChevronDown } from 'ui'+import { Button, Dropdown, IconChevronDown, IconClipboard } from 'ui'import { PermissionAction } from '@supabase/shared-types/out/constants'import { useKeyboardShortcuts, useStore, useWindowDimensions, checkPermissions } from 'hooks'@@ -311,11 +311,11 @@ const Results = ({ results }) => {{'Command+c': (event) => {event.stopPropagation()- onCopyCell()+ onCopySelectedCell()},'Control+c': (event) => {event.stopPropagation()- onCopyCell()+ onCopySelectedCell()},},['INPUT', 'TEXTAREA']@@ -337,7 +337,21 @@ const Results = ({ results }) => {}const formatter = (column, row) => {- return <span className="font-mono text-xs">{JSON.stringify(row[column])}</span>+ return (+ <div className="sb-grid-select-cell__formatter overflow-hidden">+ <span className="font-mono text-xs truncate">{JSON.stringify(row[column])}</span>++ {row[column] && (+ <Button+ type="outline"+ icon={<IconClipboard size="tiny" />}+ onClick={() => copyToClipboard(formatClipboardValue(row[column]))}+ className="sb-grid-select-cell__copy-action"+ title="Copy"+ />+ )}+ </div>+ )}const columnRender = (name) => {return <div className="flex h-full items-center justify-center font-mono">{name}</div>@@ -355,7 +369,7 @@ const Results = ({ results }) => {setCellPosition(position)}- function onCopyCell() {+ function onCopySelectedCell() {if (columns && cellPosition) {const { idx, rowIdx } = cellPositionconst column = columns[idx]diff --git a/studio/styles/grid.scss b/studio/styles/grid.scssindex 7da30942b20..20c6634572b 100644--- a/studio/styles/grid.scss+++ b/studio/styles/grid.scss@@ -388,7 +388,7 @@.sb-grid-select-editor {button {@apply border-none rounded-none shadow-none;- box-shadow: none !important+ box-shadow: none !important;}}@@ -527,6 +527,22 @@@apply border-scale-300;}+/*+ Cell copy action+*/++.sb-grid-select-cell__copy-action {+ @apply hidden mr-1;+}++.sb-grid-select-cell__formatter:hover .sb-grid-select-cell__copy-action {+ @apply block opacity-50;+}++.sb-grid-select-cell__copy-action:hover {+ @apply opacity-100;+}+/*Header*/