Skip to content

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

chore: condensed layout fixes

Jonathan Summers-Muir232c9c2f5a0b
diff --git a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
index cdc75dfe5df..aff6ddb6f7e 100644
--- a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
+++ b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
@@ -164,7 +164,7 @@ export const LogsPreviewer: React.FC<Props> = ({ projectRef, queryType, override
condensedLayout={condensedLayout}
/>
{showChart && !isLoading ? (
- <div>
+ <div className={condensedLayout ? 'px-4' : ''}>
<LogEventChart
data={!isLoading ? logData : undefined}
onBarClick={(timestampMicro) => {
diff --git a/studio/pages/project/[ref]/functions/[id]/index.tsx b/studio/pages/project/[ref]/functions/[id]/index.tsx
index 52b659b3f6d..647b5b3fc5c 100644
--- a/studio/pages/project/[ref]/functions/[id]/index.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/index.tsx
@@ -55,7 +55,7 @@ const CHART_INTERVALS = [
{ key: '7day', label: '7 days', startValue: 7, startUnit: 'day', format: 'MMM D' },
]
-function calculateAverage(array: any, attribute: string) {
+function calculateHighlightedValue(array: any, attribute: string, options?: { sum: boolean }) {
if (!array) return ''
var total = 0
@@ -67,7 +67,11 @@ function calculateAverage(array: any, attribute: string) {
count++
})
- return total / count
+ if (options?.sum) {
+ return total
+ } else {
+ return total / count
+ }
}
const PageLayout = () => {
@@ -113,8 +117,6 @@ const PageLayout = () => {
}
}
- console.log('average', data?.result ? calculateAverage(data?.result, 'avg_execution_time') : null)
-
return (
<FunctionLayout>
<div className="space-y-6">
@@ -160,7 +162,10 @@ const PageLayout = () => {
data={charts}
format="ms"
isLoading={!charts.data && !error ? true : false}
- highlightedValue={calculateAverage(data?.result, 'avg_execution_time')}
+ highlightedValue={calculateHighlightedValue(
+ data?.result,
+ 'avg_execution_time'
+ )}
// onBarClick={(v) => handleBarClick(v, '/rest')}
/>
</Panel.Content>
@@ -178,7 +183,9 @@ const PageLayout = () => {
customDateFormat={datetimeFormat}
data={charts}
isLoading={!charts.data && !error ? true : false}
- highlightedValue={calculateAverage(data?.result, 'count')}
+ highlightedValue={calculateHighlightedValue(data?.result, 'count', {
+ sum: true,
+ })}
onBarClick={(v) => handleBarClick(v, '/auth')}
/>
</Panel.Content>
diff --git a/studio/pages/project/[ref]/functions/index.tsx b/studio/pages/project/[ref]/functions/index.tsx
index 25572396808..2b1dfd80bfb 100644
--- a/studio/pages/project/[ref]/functions/index.tsx
+++ b/studio/pages/project/[ref]/functions/index.tsx
@@ -42,7 +42,7 @@ const EmptyFunctions = () => {
}
const commands: Commands[] = [
{
- command: 'Run supabase ',
+ command: 'supabase init ',
description: "Needed if the project hasen't been inited before",
jsx: () => {
return (
@@ -54,7 +54,7 @@ const EmptyFunctions = () => {
comment: 'Initialize Supabase locally',
},
{
- command: 'Login to supabase',
+ command: 'supabase login',
description: "Writes the user's API token to disk",
jsx: () => {
return (
@@ -66,12 +66,12 @@ const EmptyFunctions = () => {
comment: 'Login using your access token',
},
{
- command: `sudo supabase link --ref ${ref}`,
+ command: `supabase link --ref ${ref}`,
description: `Sets the Supabase project to be associated with your project ${ref}`,
jsx: () => {
return (
<>
- sudo <span className="text-brand-1100">supabase</span> link --ref {ref}
+ <span className="text-brand-1100">supabase</span> link --ref {ref}
</>
)
},
@@ -101,6 +101,19 @@ const EmptyFunctions = () => {
},
comment: 'Deploy your function',
},
+ {
+ command: `curl -L -X POST 'https://${ref}.functions.supabase.co/hello' -H 'Authorization: Bearer [YOUR ANON KEY]'`,
+ description: 'Deploys function at ./functions/hello.ts',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">curl</span> -L -X POST 'https://{ref}
+ .functions.supabase.co/hello' -H 'Authorization: Bearer [YOUR ANON KEY]'
+ </>
+ )
+ },
+ comment: 'Deploy your function',
+ },
]
return (
<>
diff --git a/studio/pages/project/[ref]/functions/interfaces/CommandRender.tsx b/studio/pages/project/[ref]/functions/interfaces/CommandRender.tsx
index 17893794187..18af5eb91ee 100644
--- a/studio/pages/project/[ref]/functions/interfaces/CommandRender.tsx
+++ b/studio/pages/project/[ref]/functions/interfaces/CommandRender.tsx
@@ -11,32 +11,38 @@ const CommandRender = ({ commands }: any) => {
<div>
<span className="font-mono text-xs text-scale-900">{`> ${item.comment}`}</span>
<div className="flex items-center gap-2">
- <div className="flex items-center gap-2 text-scale-1200 font-mono text-sm font-normal">
+ <div className="flex gap-2 text-scale-1200 font-mono text-sm font-normal">
<span className="text-scale-900">$</span>
- {item.jsx ? item.jsx() : null}
+ <span>
+ <span className="">{item.jsx ? item.jsx() : null} </span>
+ <button
+ type="button"
+ className="text-scale-900 hover:text-scale-1200"
+ onClick={() => {
+ function onCopy(value: any) {
+ setIsCopied(true)
+ navigator.clipboard.writeText(value).then()
+ setTimeout(function () {
+ setIsCopied(false)
+ }, 3000)
+ }
+ onCopy(item.command)
+ }}
+ >
+ {isCopied ? (
+ <div className="text-brand-900">
+ <IconCheck size={14} strokeWidth={3} />
+ </div>
+ ) : (
+ <div className="relative">
+ <div className="block">
+ <IconClipboard size={14} />
+ </div>
+ </div>
+ )}
+ </button>
+ </span>
</div>
- <button
- type="button"
- className="text-scale-900 hover:text-scale-1200"
- onClick={() => {
- function onCopy(value: any) {
- setIsCopied(true)
- navigator.clipboard.writeText(value).then()
- setTimeout(function () {
- setIsCopied(false)
- }, 3000)
- }
- onCopy(item.command)
- }}
- >
- {isCopied ? (
- <div className="text-brand-900">
- <IconCheck size={14} strokeWidth={3} />
- </div>
- ) : (
- <IconClipboard size={14} />
- )}
- </button>
</div>
<span className="text-xs text-scale-900">{item.description}</span>
</div>
diff --git a/studio/styles/main.scss b/studio/styles/main.scss
index 88d9a1aaa7d..39d171e9019 100644
--- a/studio/styles/main.scss
+++ b/studio/styles/main.scss
@@ -188,3 +188,7 @@ div[data-radix-portal]:not(.portal--toast) {
div.fixed.inset-0 {
z-index: 11 !important;
}
+
+.recharts-tooltip-cursor {
+ @apply fill-transparent;
+}