Fix small issues found

This commit is contained in:
Joshen Lim committed 2025-10-27 15:42:28 +08:00
1 parent 6f050dc0b2
commit bd4f9714b7
6 files changed
+54 -115

No files matched your search

@@ -4,6 +4,7 @@ import type { ListChildComponentProps } from 'react-window'
import { FixedSizeList as List, areEqual } from 'react-window'
import type { Bucket } from 'data/storage/buckets-query'
import { cn } from 'ui'
import { BucketRow } from './BucketRow'
type BucketListProps = {
@@ -25,7 +26,7 @@ const VirtualizedBucketRow = memo(
isSelected={isSelected}
projectRef={data.projectRef}
style={style as CSSProperties}
className={BUCKET_ROW_HEIGHT}
className={cn(BUCKET_ROW_HEIGHT)}
/>
)
},
@@ -95,19 +96,15 @@ export const BucketList = ({ buckets, selectedBucketId, projectRef = '' }: Bucke
const numBuckets = buckets.length
if (numBuckets <= 50) {
return (
<div className="mr-3 mb-6">
{buckets.map((bucket) => (
<BucketRow
key={bucket.id}
bucket={bucket}
isSelected={selectedBucketId === bucket.id}
projectRef={projectRef}
className={BUCKET_ROW_HEIGHT}
/>
))}
</div>
)
return buckets.map((bucket) => (
<BucketRow
key={bucket.id}
bucket={bucket}
isSelected={selectedBucketId === bucket.id}
projectRef={projectRef}
className={BUCKET_ROW_HEIGHT}
/>
))
}
return (
@@ -10,7 +10,7 @@ import { useBucketsQuery } from 'data/storage/buckets-query'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { IS_PLATFORM } from 'lib/constants'
import { useStorageExplorerStateSnapshot } from 'state/storage-explorer'
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, Menu } from 'ui'
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, cn, Menu } from 'ui'
import { InfoTooltip } from 'ui-patterns/info-tooltip'
import {
InnerSideBarEmptyPanel,
@@ -70,15 +70,12 @@ export const StorageMenu = () => {
[sortedBuckets, searchText]
)
const tempNotSupported = error?.message.includes('Tenant config') && isBranch
const isVirtualized = buckets.length > 50
return (
<>
<Menu
type="pills"
className="pt-6 h-full flex flex-col"
ulClassName="flex flex-col flex-grow"
>
<div className="mb-6 mx-5 flex flex-col gap-y-1.5">
<Menu type="pills" className="h-full flex flex-col" ulClassName="flex flex-col flex-grow">
<div className="flex flex-col gap-y-1.5 px-5 pb-6 pt-6 sticky top-0 bg-sidebar">
<CreateBucketModal />
<InnerSideBarFilters className="px-0">
@@ -110,8 +107,8 @@ export const StorageMenu = () => {
</InnerSideBarFilters>
</div>
<div className="flex flex-col flex-grow">
<div className="flex-grow ml-3 flex flex-col">
<div className={cn('flex flex-col', isVirtualized && 'flex-grow')}>
<div className={cn('flex flex-col mx-3', isVirtualized ? 'flex-grow' : 'mb-3')}>
<Menu.Group title={<span className="uppercase font-mono">All buckets</span>} />
{isLoading && (
@@ -165,27 +162,27 @@ export const StorageMenu = () => {
</>
)}
</div>
</div>
<div className="w-full bg-dash-sidebar px-3 py-6 sticky bottom-0 border-t border-border">
<Menu.Group title={<span className="uppercase font-mono">Configuration</span>} />
<Link href={`/project/${ref}/storage/policies`}>
<Menu.Item rounded active={page === 'policies'}>
<p className="truncate">Policies</p>
<div className="w-full bg-dash-sidebar px-3 py-6 sticky bottom-0 border-t border-border">
<Menu.Group title={<span className="uppercase font-mono">Configuration</span>} />
<Link href={`/project/${ref}/storage/policies`}>
<Menu.Item rounded active={page === 'policies'}>
<p className="truncate">Policies</p>
</Menu.Item>
</Link>
{IS_PLATFORM && (
<Link href={`/project/${ref}/storage/settings`}>
<Menu.Item rounded active={page === 'settings'}>
<div className="flex items-center gap-x-2">
<p className="truncate">Settings</p>
{isListV2UpgradeAvailable && (
<InfoTooltip side="right">Upgrade available</InfoTooltip>
)}
</div>
</Menu.Item>
</Link>
{IS_PLATFORM && (
<Link href={`/project/${ref}/storage/settings`}>
<Menu.Item rounded active={page === 'settings'}>
<div className="flex items-center gap-x-2">
<p className="truncate">Settings</p>
{isListV2UpgradeAvailable && (
<InfoTooltip side="right">Upgrade available</InfoTooltip>
)}
</div>
</Menu.Item>
</Link>
)}
</div>
)}
</div>
</Menu>
</>
@@ -1,6 +1,7 @@
import { Columns3, Layers, Table2 } from 'lucide-react'
import { useCallback, useEffect, useState } from 'react'
import { toast } from 'sonner'
import { cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
import type { TableField } from '../TableEditor.types'
import { tableTemplates } from './templates'
@@ -12,12 +12,7 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'user_id',
type: 'uuid',
nullable: false,
unique: true,
},
{ name: 'user_id', type: 'uuid', nullable: false, unique: true },
{ name: 'username', type: 'text', nullable: true, unique: true },
{ name: 'display_name', type: 'text', nullable: true },
{ name: 'avatar_url', type: 'text', nullable: true },
@@ -40,11 +35,7 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'author_id',
type: 'uuid',
nullable: false,
},
{ name: 'author_id', type: 'uuid', nullable: false },
{ name: 'content', type: 'text', nullable: false },
{ name: 'image_url', type: 'text', nullable: true },
{ name: 'likes_count', type: 'int4', nullable: false, default: '0' },
@@ -65,16 +56,8 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'follower_id',
type: 'uuid',
nullable: false,
},
{
name: 'following_id',
type: 'uuid',
nullable: false,
},
{ name: 'follower_id', type: 'uuid', nullable: false },
{ name: 'following_id', type: 'uuid', nullable: false },
{ name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },
],
rationale: 'Tracks relationships between followers and followed users',
@@ -120,12 +103,8 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
default: 'gen_random_uuid()',
},
{ name: 'order_number', type: 'text', nullable: false, unique: true },
{
name: 'customer_id',
type: 'uuid',
nullable: false,
},
{ name: 'status', type: 'text', nullable: false, default: "'pending'" },
{ name: 'customer_id', type: 'uuid', nullable: false },
{ name: 'status', type: 'text', nullable: false, default: 'pending' },
{ name: 'subtotal', type: 'numeric', nullable: false },
{ name: 'tax', type: 'numeric', nullable: false, default: '0' },
{ name: 'shipping', type: 'numeric', nullable: false, default: '0' },
@@ -147,16 +126,8 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'user_id',
type: 'uuid',
nullable: false,
},
{
name: 'product_id',
type: 'uuid',
nullable: false,
},
{ name: 'user_id', type: 'uuid', nullable: false },
{ name: 'product_id', type: 'uuid', nullable: false },
{ name: 'quantity', type: 'int4', nullable: false, default: '1' },
{ name: 'added_at', type: 'timestamptz', nullable: false, default: 'now()' },
],
@@ -180,11 +151,7 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
{ name: 'content', type: 'text', nullable: true },
{ name: 'excerpt', type: 'text', nullable: true },
{ name: 'cover_image', type: 'text', nullable: true },
{
name: 'author_id',
type: 'uuid',
nullable: false,
},
{ name: 'author_id', type: 'uuid', nullable: false },
{ name: 'status', type: 'text', nullable: false, default: "'draft'" },
{ name: 'published_at', type: 'timestamptz', nullable: true },
{ name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },
@@ -222,11 +189,7 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'article_id',
type: 'uuid',
nullable: false,
},
{ name: 'article_id', type: 'uuid', nullable: false },
{ name: 'author_name', type: 'text', nullable: false },
{ name: 'author_email', type: 'text', nullable: false },
{ name: 'content', type: 'text', nullable: false },
@@ -251,13 +214,9 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
{ name: 'title', type: 'text', nullable: false },
{ name: 'description', type: 'text', nullable: true },
{ name: 'completed', type: 'bool', nullable: false, default: 'false' },
{ name: 'priority', type: 'text', nullable: true, default: "'medium'" },
{ name: 'priority', type: 'text', nullable: true, default: 'medium' },
{ name: 'due_date', type: 'date', nullable: true },
{
name: 'user_id',
type: 'uuid',
nullable: false,
},
{ name: 'user_id', type: 'uuid', nullable: false },
{ name: 'list_id', type: 'uuid', nullable: true },
{ name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },
{ name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },
@@ -279,11 +238,7 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
{ name: 'description', type: 'text', nullable: true },
{ name: 'color', type: 'text', nullable: true },
{ name: 'icon', type: 'text', nullable: true },
{
name: 'user_id',
type: 'uuid',
nullable: false,
},
{ name: 'user_id', type: 'uuid', nullable: false },
{ name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },
{ name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },
],
@@ -300,11 +255,7 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'task_id',
type: 'uuid',
nullable: false,
},
{ name: 'task_id', type: 'uuid', nullable: false },
{ name: 'title', type: 'text', nullable: false },
{ name: 'completed', type: 'bool', nullable: false, default: 'false' },
{ name: 'position', type: 'int4', nullable: false, default: '0' },
@@ -325,11 +276,7 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'user_id',
type: 'uuid',
nullable: true,
},
{ name: 'user_id', type: 'uuid', nullable: true },
{ name: 'session_id', type: 'text', nullable: true },
{ name: 'event_type', type: 'text', nullable: false },
{ name: 'properties', type: 'jsonb', nullable: true },
@@ -350,11 +297,7 @@ export const tableTemplates: Record<string, TableSuggestion[]> = {
isPrimary: true,
default: 'gen_random_uuid()',
},
{
name: 'user_id',
type: 'uuid',
nullable: true,
},
{ name: 'user_id', type: 'uuid', nullable: true },
{ name: 'session_id', type: 'text', nullable: true },
{ name: 'path', type: 'text', nullable: false },
{ name: 'referrer', type: 'text', nullable: true },
@@ -20,7 +20,7 @@ import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { usePHFlag } from 'hooks/ui/useFlag'
import { uuidv4 } from 'lib/helpers'
import { useProfile } from 'lib/profile'
import { useAiAssistantStateSnapshot, AssistantMessageType } from 'state/ai-assistant-state'
import { AssistantMessageType, useAiAssistantStateSnapshot } from 'state/ai-assistant-state'
import { useSqlEditorV2StateSnapshot } from 'state/sql-editor-v2'
import { useTableEditorStateSnapshot } from 'state/table-editor'
import { createTabId, useTabsStateSnapshot } from 'state/tabs'
@@ -63,6 +63,7 @@ export const useEdgeFunctionDeployMutation = ({
async onSuccess(data, variables, context) {
const { projectRef, slug } = variables
await Promise.all([
queryClient.invalidateQueries(edgeFunctionsKeys.list(projectRef)),
queryClient.invalidateQueries(edgeFunctionsKeys.detail(projectRef, slug)),
queryClient.invalidateQueries(edgeFunctionsKeys.body(projectRef, slug)),
])