Skip to content

Commit

Permalink
fix: fix unable to add queries into favorites
Browse files Browse the repository at this point in the history
  • Loading branch information
jingsam committed Aug 4, 2024
1 parent 74f6244 commit 482a40d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions apps/studio/components/interfaces/SQLEditor/RenameQueryModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ const RenameQueryModal = ({

const validate = () => {
const errors: any = {}
if (!nameInput) errors.name = 'Please enter a query name'
if (!nameInput) errors.name = '请输入查询的名称'
return errors
}

const onSubmit = async (values: any, { setSubmitting }: any) => {
if (!ref) return console.error('Project ref is required')
if (!id) return console.error('Snippet ID is required')
if (!ref) return console.error('未找到项目号')
if (!id) return console.error('未找到代码段 ID')

setSubmitting(true)
try {
Expand Down Expand Up @@ -109,7 +109,7 @@ const RenameQueryModal = ({
}, [snippet.id])

return (
<Modal visible={visible} onCancel={onCancel} hideFooter header="Rename" size="small">
<Modal visible={visible} onCancel={onCancel} hideFooter header="重命名" size="small">
<Form
onReset={onCancel}
validateOnBlur
Expand All @@ -124,13 +124,13 @@ const RenameQueryModal = ({
<>
<Modal.Content className="space-y-4">
<Input
label="Name"
label="名称"
id="name"
name="name"
value={nameInput}
onChange={(e) => setNameInput(e.target.value)}
/>
<div className="flex w-full justify-end mt-2">
{/* <div className="flex w-full justify-end mt-2">
{!hasHipaaAddon && isAiButtonVisible && (
<Button
type="default"
Expand All @@ -146,11 +146,11 @@ const RenameQueryModal = ({
</div>
</Button>
)}
</div>
</div> */}
<Input.TextArea
label="描述"
id="description"
placeholder="描述查询"
placeholder="查询的描述信息"
size="medium"
textAreaClassName="resize-none"
value={descriptionInput}
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const SQLEditor = () => {
// Customers on HIPAA plans should not have access to Supabase AI
const hasHipaaAddon = subscriptionHasHipaaAddon(subscription)

const [isAiOpen, setIsAiOpen] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_OPEN, true)
const [isAiOpen, setIsAiOpen] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_OPEN, false)
const [isConfirmModalOpen, setIsConfirmModalOpen] = useState(false)

const selectedOrganization = useSelectedOrganization()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const UtilityActions = ({
const snapV2 = useSqlEditorV2StateSnapshot()
const enableFolders = useFlag('sqlFolderOrganization')

const [isAiOpen] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_OPEN, true)
const [isAiOpen] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_OPEN, false)
const [intellisenseEnabled, setIntellisenseEnabled] = useLocalStorageQuery(
LOCAL_STORAGE_KEYS.SQL_EDITOR_INTELLISENSE,
true
Expand Down Expand Up @@ -210,7 +210,7 @@ const UtilityActions = ({
</DropdownMenuContent>
</DropdownMenu>

{IS_PLATFORM && (
{true && (
<Tooltip_Shadcn_>
<TooltipTrigger_Shadcn_ asChild>
{isFavorite ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const QueryItemActions = ({

return (
<>
{IS_PLATFORM ? (
{true ? (
<DropdownMenu open={open} onOpenChange={setOpen}>
<DropdownMenuTrigger
className="opacity-0 group-hover:opacity-100 group-focus:opacity-100 focus:opacity-100 data-[state=open]:opacity-100"
Expand Down Expand Up @@ -128,7 +128,7 @@ export const QueryItemActions = ({
{visibility === 'project' && canCreateSQLSnippet && (
<DropdownMenuItem onClick={createPersonalCopy} className="flex gap-2">
<Copy size={14} />
复制个人副本
复制到您的个人查询
</DropdownMenuItem>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const SQLEditorMenu = ({ onViewOngoingQueries }: { onViewOngoingQueries:
onClick={() => handleNewQuery()}
icon={<Plus className="text-foreground-muted" strokeWidth={1} size={14} />}
>
新查询
新建查询
</Button>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const SQLEditorNavV1 = ({

{filteredProjectSnippets.length > 0 && (
<InnerSideMenuCollapsible className="editor-product-menu" defaultOpen>
<InnerSideMenuCollapsibleTrigger title="Project queries" />
<InnerSideMenuCollapsibleTrigger title="分享的查询" />
<InnerSideMenuCollapsibleContent>
<>
{filteredProjectSnippets.map((tabInfo) => (
Expand Down Expand Up @@ -253,7 +253,7 @@ export const SQLEditorNavV1 = ({

{personalSnippets.length > 0 && (
<InnerSideMenuCollapsible className="editor-product-menu" defaultOpen>
<InnerSideMenuCollapsibleTrigger title="您的查询" />
<InnerSideMenuCollapsibleTrigger title="您的个人查询" />
<InnerSideMenuCollapsibleContent className="editor-product-menu">
<>
<div className="space-y-0.5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export const SQLEditorTreeViewItem = ({
onFocusCapture={(e) => e.stopPropagation()}
>
<Copy size={14} />
复制个人副本
复制到您的个人查询
</ContextMenuItem_Shadcn_>
)}
{onSelectDownload !== undefined && IS_PLATFORM && (
Expand Down

0 comments on commit 482a40d

Please sign in to comment.