Skip to content

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

Update logs panel to use INput component with built in copy functionality

Joshen Limd6f51326acc0
diff --git a/studio/components/interfaces/Settings/Logs/LogSelection.tsx b/studio/components/interfaces/Settings/Logs/LogSelection.tsx
index dc1921a1c61..f4a37c23abf 100644
--- a/studio/components/interfaces/Settings/Logs/LogSelection.tsx
+++ b/studio/components/interfaces/Settings/Logs/LogSelection.tsx
@@ -1,7 +1,6 @@
import dayjs from 'dayjs'
import { FC } from 'react'
-import { Typography, IconX, Button, IconCopy } from '@supabase/ui'
-import { copyToClipboard } from 'lib/helpers'
+import { Typography, IconX, Input } from '@supabase/ui'
import { LogData } from './Logs.types'
@@ -40,47 +39,27 @@ const LogSelection: FC<Props> = ({ log, onClose }) => {
<div className="flex-grow overflow-y-auto bg-panel-body-light dark:bg-panel-body-dark">
<div className="p-4 flex-col space-y-4">
<div className="space-y-2">
- <Typography.Text small>Event message</Typography.Text>
- <Typography.Text code className="block w-full overflow-x-auto" small>
- {log.event_message}{' '}
- </Typography.Text>
- <div className="flex flex-row justify-end">
- <Button
- size="tiny"
- type="default"
- onClick={() => {
- copyToClipboard(String(log.event_message))
- }}
- icon={<IconCopy size={14}/>}
- >
- Copy
- </Button>
- </div>
+ <p className="text-sm">Event message</p>
+ <Input
+ copy
+ readOnly
+ size="small"
+ layout="vertical"
+ className="text-sm input-mono"
+ value={log.event_message}
+ />
</div>
<div className="space-y-2">
- <Typography.Text small>Metadata</Typography.Text>
-
- <Typography.Text
- code
- style={{ maxHeight: '30rem' }}
- className="block whitespace-pre w-full overflow-auto"
- small
- >
- {JSON.stringify(log.metadata, null, 2)}
- </Typography.Text>
- <div className="flex flex-row justify-end">
- <Button
- size="tiny"
- type="default"
- onClick={() => {
- copyToClipboard(String(log.metadata))
- }}
- icon={<IconCopy size={14}/>}
-
- >
- Copy
- </Button>
- </div>
+ <p className="text-sm">Metadata</p>
+ <Input.TextArea
+ copy
+ readOnly
+ size="small"
+ layout="vertical"
+ rows={20}
+ className="input-mono"
+ value={JSON.stringify(log.metadata, null, 2)}
+ />
</div>
</div>
</div>
diff --git a/studio/styles/main.scss b/studio/styles/main.scss
index cfe8c1eec35..61c8b616732 100644
--- a/studio/styles/main.scss
+++ b/studio/styles/main.scss
@@ -147,8 +147,11 @@ a {
text-decoration: none;
}
-.input-mono input {
- @apply font-mono;
+.input-mono {
+ input,
+ textarea {
+ @apply font-mono;
+ }
}
input[type='radio'] {