Skip to content

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

Fix styles in storage

Joshen Lim2f0d937d01c7
diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js
index 483c38370dc..8fbc9855296 100644
--- a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js
+++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerColumn.js
@@ -1,6 +1,6 @@
import { useState, useRef, useEffect } from 'react'
import { get, sum } from 'lodash'
-import { Checkbox, IconUpload, Typography } from '@supabase/ui'
+import { Checkbox, IconUpload } from '@supabase/ui'
import { Transition } from '@headlessui/react'
import { useContextMenu } from 'react-contexify'
@@ -38,9 +38,9 @@ const DragOverOverlay = ({ isOpen, onDragLeave, onDrop, folderIsEmpty }) => {
style={{ backgroundColor: 'rgba(0,0,0,0.7)' }}
>
<IconUpload className="text-white pointer-events-none" size={20} strokeWidth={2} />
- <Typography.Text className="text-center text-sm mt-2 pointer-events-none">
+ <p className="text-center text-sm mt-2 pointer-events-none">
Drop your files to upload to this folder
- </Typography.Text>
+ </p>
</div>
)}
</div>
@@ -165,14 +165,10 @@ const FileExplorerColumn = ({
{columnFiles.length > 0 ? (
<>
<SelectAllCheckbox />
- <Typography.Text type="secondary">
- <p className="text-sm">Select all {columnFiles.length} files</p>
- </Typography.Text>
+ <p className="text-sm text-scale-1100">Select all {columnFiles.length} files</p>
</>
) : (
- <Typography.Text type="secondary">
- <p className="text-sm">No files available for selection</p>
- </Typography.Text>
+ <p className="text-sm text-scale-1100">No files available for selection</p>
)}
</div>
)}
@@ -187,13 +183,21 @@ const FileExplorerColumn = ({
"
>
<SelectAllCheckbox />
- <Typography.Text style={{ width: '30%', minWidth: '250px' }}>Name</Typography.Text>
- <Typography.Text style={{ width: '15%', minWidth: '100px' }}>Size</Typography.Text>
- <Typography.Text style={{ width: '15%', minWidth: '100px' }}>Type</Typography.Text>
- <Typography.Text style={{ width: '20%', minWidth: '180px' }}>Created at</Typography.Text>
- <Typography.Text style={{ width: '20%', minWidth: '180px' }}>
+ <p className="text-sm" style={{ width: '30%', minWidth: '250px' }}>
+ Name
+ </p>
+ <p className="text-sm" style={{ width: '15%', minWidth: '100px' }}>
+ Size
+ </p>
+ <p className="text-sm" style={{ width: '15%', minWidth: '100px' }}>
+ Type
+ </p>
+ <p className="text-sm" style={{ width: '20%', minWidth: '180px' }}>
+ Created at
+ </p>
+ <p className="text-sm" style={{ width: '20%', minWidth: '180px' }}>
Last modified at
- </Typography.Text>
+ </p>
<div className="w-3" />
</div>
)}
@@ -254,14 +258,10 @@ const FileExplorerColumn = ({
{column.items.length === 0 && column.status !== STORAGE_ROW_STATUS.LOADING && (
<div className="h-full w-full flex flex-col items-center justify-center">
<img src="/img/storage-placeholder.svg" className="opacity-75" />
- <Typography.Text>
- <p className="my-3 opacity-75">Drop your files here</p>
- </Typography.Text>
- <Typography.Text type="secondary">
- <p className="text-sm text-center w-40">
- Or upload them via the "Upload file" button above
- </p>
- </Typography.Text>
+ <p className="my-3 opacity-75">Drop your files here</p>
+ <p className="text-sm text-center w-40 text-scale-1100">
+ Or upload them via the "Upload file" button above
+ </p>
</div>
)}
@@ -283,9 +283,9 @@ const FileExplorerColumn = ({
px-4 py-2 flex items-center min-w-min sticky bottom-0 z-10
"
>
- <Typography.Text small>
+ <p className="text-sm">
{formatBytes(columnItemsSize)} for {columnItems.length} items
- </Typography.Text>
+ </p>
</div>
)}
</div>
diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRow.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRow.js
index 4f7cdc09118..2360378e63b 100644
--- a/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRow.js
+++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/FileExplorerRow.js
@@ -9,7 +9,6 @@ import {
IconMusic,
IconFilm,
IconFile,
- Typography,
} from '@supabase/ui'
import SVG from 'react-inlinesvg'
import { useContextMenu } from 'react-contexify'
@@ -23,11 +22,7 @@ import { formatBytes } from 'lib/helpers'
const RowIcon = ({ view, status, fileType, mimeType }) => {
if (view === STORAGE_VIEWS.LIST && status === STORAGE_ROW_STATUS.LOADING) {
- return (
- <Typography.Text>
- <IconLoader size={16} strokeWidth={2} className="animate-spin" />
- </Typography.Text>
- )
+ return <IconLoader size={16} strokeWidth={2} className="animate-spin" />
}
if (fileType === STORAGE_ROW_TYPES.BUCKET || fileType === STORAGE_ROW_TYPES.FOLDER) {
@@ -38,47 +33,29 @@ const RowIcon = ({ view, status, fileType, mimeType }) => {
? '/img/folder-filled.svg'
: '/img/file-filled.svg'
return (
- <Typography.Text>
- <SVG
- src={iconSrc}
- alt={fileType}
- preProcessor={(code) =>
- code.replace(/svg/, 'svg class="w-4 h-4 text-color-inherit opacity-75"')
- }
- />
- </Typography.Text>
+ <SVG
+ src={iconSrc}
+ alt={fileType}
+ preProcessor={(code) =>
+ code.replace(/svg/, 'svg class="w-4 h-4 text-color-inherit opacity-75"')
+ }
+ />
)
}
if (mimeType?.includes('image')) {
- return (
- <Typography.Text>
- <IconImage size={16} strokeWidth={2} />
- </Typography.Text>
- )
+ return <IconImage size={16} strokeWidth={2} />
}
if (mimeType?.includes('audio')) {
- return (
- <Typography.Text>
- <IconMusic size={16} strokeWidth={2} />
- </Typography.Text>
- )
+ return <IconMusic size={16} strokeWidth={2} />
}
if (mimeType?.includes('video')) {
- return (
- <Typography.Text>
- <IconFilm size={16} strokeWidth={2} />
- </Typography.Text>
- )
+ return <IconFilm size={16} strokeWidth={2} />
}
- return (
- <Typography.Text>
- <IconFile size={16} strokeWidth={2} />
- </Typography.Text>
- )
+ return <IconFile size={16} strokeWidth={2} />
}
const FileExplorerRow = ({
@@ -256,36 +233,34 @@ const FileExplorerRow = ({
}}
>
{view === STORAGE_VIEWS.COLUMNS ? (
- <Typography.Text className="w-full truncate">{item.name}</Typography.Text>
+ <p className="text-sm w-full truncate">{item.name}</p>
) : (
<>
- <Typography.Text className="truncate" style={{ width: '30%', minWidth: '250px' }}>
+ <p className="text-sm truncate" style={{ width: '30%', minWidth: '250px' }}>
{item.name}
- </Typography.Text>
- <Typography.Text className="truncate" style={{ width: '15%', minWidth: '100px' }}>
+ </p>
+ <p className="text-sm truncate" style={{ width: '15%', minWidth: '100px' }}>
{size}
- </Typography.Text>
- <Typography.Text className="truncate" style={{ width: '15%', minWidth: '100px' }}>
+ </p>
+ <p className="text-sm truncate" style={{ width: '15%', minWidth: '100px' }}>
{mimeType}
- </Typography.Text>
- <Typography.Text className="truncate" style={{ width: '20%', minWidth: '180px' }}>
+ </p>
+ <p className="text-sm truncate" style={{ width: '20%', minWidth: '180px' }}>
{createdAt}
- </Typography.Text>
- <Typography.Text className="truncate" style={{ width: '20%', minWidth: '175px' }}>
+ </p>
+ <p className="text-sm truncate" style={{ width: '20%', minWidth: '175px' }}>
{updatedAt}
- </Typography.Text>
+ </p>
{/* The 175px here is intentional due to the irregular width of the header checkbox and row icon */}
</>
)}
</div>
{item.status === STORAGE_ROW_STATUS.LOADING ? (
- <Typography.Text>
- <IconLoader
- className={`animate-spin ${view === STORAGE_VIEWS.LIST ? 'invisible' : ''}`}
- size={16}
- strokeWidth={2}
- />
- </Typography.Text>
+ <IconLoader
+ className={`animate-spin ${view === STORAGE_VIEWS.LIST ? 'invisible' : ''}`}
+ size={16}
+ strokeWidth={2}
+ />
) : (
<Dropdown
side="bottom"
@@ -298,11 +273,9 @@ const FileExplorerRow = ({
)),
]}
>
- <Typography.Text type="secondary">
- <div className="storage-row-menu opacity-0">
- <IconMoreVertical size={16} strokeWidth={2} />
- </div>
- </Typography.Text>
+ <div className="storage-row-menu opacity-0">
+ <IconMoreVertical size={16} strokeWidth={2} />
+ </div>
</Dropdown>
)}
</div>
diff --git a/studio/components/to-be-cleaned/Storage/StorageExplorer/PreviewPane.js b/studio/components/to-be-cleaned/Storage/StorageExplorer/PreviewPane.js
index 75d47ae4889..174d886c7f4 100644
--- a/studio/components/to-be-cleaned/Storage/StorageExplorer/PreviewPane.js
+++ b/studio/components/to-be-cleaned/Storage/StorageExplorer/PreviewPane.js
@@ -1,12 +1,4 @@
-import {
- Button,
- IconX,
- IconLoader,
- IconClipboard,
- IconDownload,
- IconTrash2,
- Typography,
-} from '@supabase/ui'
+import { Button, IconX, IconLoader, IconClipboard, IconDownload, IconTrash2 } from '@supabase/ui'
import SVG from 'react-inlinesvg'
import { formatBytes } from 'lib/helpers'
import { Transition } from '@headlessui/react'
@@ -41,7 +33,7 @@ const PreviewFile = ({ mimeType, previewUrl }) => {
}
/>
<p className="text-sm text-center mt-2 w-2/5">
- <Typography.Text>File size is too large to preview in the explorer</Typography.Text>
+ File size is too large to preview in the explorer
</p>
</div>
)
@@ -138,7 +130,7 @@ const PreviewPane = ({
{/* Preview Information */}
<div className="space-y-1">
<div className="flex items-center">
- <h5 className="text-scale-1200 text-base font-bold mr-2">{file.name}</h5>
+ <h5 className="text-scale-1200 text-base font-bold mr-2 truncate">{file.name}</h5>
</div>
{mimeType && (
<p className="text-sm text-scale-1100">
@@ -151,30 +143,26 @@ const PreviewPane = ({
{/* Preview Metadata */}
<div className="space-y-2">
<div>
- <Typography.Text>
- <label className="text-xs text-scale-900 mb-1">Added on</label>
- <p className="text-sm text-scale-1100">{createdAt}</p>
- </Typography.Text>
+ <label className="text-xs text-scale-900 mb-1">Added on</label>
+ <p className="text-sm text-scale-1100">{createdAt}</p>
</div>
<div>
- <Typography.Text>
- <label className="text-xs text-scale-900 mb-1">Last modified</label>
- <p className="text-sm text-scale-1100">{updatedAt}</p>
- </Typography.Text>
+ <label className="text-xs text-scale-900 mb-1">Last modified</label>
+ <p className="text-sm text-scale-1100">{updatedAt}</p>
</div>
</div>
{/* Actions */}
<div className="flex space-x-2 border-b pb-4 border-panel-border-light dark:border-panel-border-dark">
<Button
- type="secondary"
+ type="default"
icon={<IconDownload size={16} strokeWidth={2} />}
onClick={() => onDownloadFile(file)}
>
Download
</Button>
<Button
- type="default"
+ type="outline"
icon={<IconClipboard size={16} strokeWidth={2} />}
onClick={() => onCopyFileURL(file)}
>
@@ -182,7 +170,7 @@ const PreviewPane = ({
</Button>
</div>
<Button
- type="default"
+ type="outline"
shadow={false}
size="tiny"
icon={<IconTrash2 size={16} strokeWidth={2} />}
diff --git a/studio/localStores/storageExplorer/StorageExplorerStore.js b/studio/localStores/storageExplorer/StorageExplorerStore.js
index e298514e42e..fe85403497c 100644
--- a/studio/localStores/storageExplorer/StorageExplorerStore.js
+++ b/studio/localStores/storageExplorer/StorageExplorerStore.js
@@ -367,6 +367,7 @@ class StorageExplorerStore {
copyFileURLToClipboard = async (file) => {
const filePreview = find(this.filePreviewCache, { id: file.id })
+ console.log('Copy file URL', filePreview)
if (filePreview) {
// Already generated signed URL
copyToClipboard(filePreview.url, () => {
@@ -770,6 +771,7 @@ class StorageExplorerStore {
.createSignedUrl(formattedPathToFile, DEFAULT_EXPIRY)
if (!error) {
+ console.log('fetchFilePreview', data)
return data.signedURL
}