Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

add tooltips i18n

Guy Ben-Aharonb40b010b372e
diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts
index ea742d9f..298ade04 100644
--- a/src/i18n/locales/en.ts
+++ b/src/i18n/locales/en.ts
@@ -51,6 +51,7 @@ export const en: ResourceLanguage = {
tables: 'Tables',
add_table: 'Add Table',
filter: 'Filter',
+ collapse: 'Collapse All',
table: {
fields: 'Fields',
@@ -88,6 +89,7 @@ export const en: ResourceLanguage = {
relationships_section: {
relationships: 'Relationships',
filter: 'Filter',
+ collapse: 'Collapse All',
relationship: {
primary: 'Primary',
foreign: 'Foreign',
diff --git a/src/pages/editor-page/side-panel/relationships-section/relationships-section.tsx b/src/pages/editor-page/side-panel/relationships-section/relationships-section.tsx
index d847f48c..2cf8b9ea 100644
--- a/src/pages/editor-page/side-panel/relationships-section/relationships-section.tsx
+++ b/src/pages/editor-page/side-panel/relationships-section/relationships-section.tsx
@@ -9,6 +9,11 @@ import { useLayout } from '@/hooks/use-layout';
import { EmptyState } from '@/components/empty-state/empty-state';
import { ScrollArea } from '@/components/scroll-area/scroll-area';
import { useTranslation } from 'react-i18next';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/tooltip/tooltip';
export interface RelationshipsSectionProps {}
@@ -32,13 +37,22 @@ export const RelationshipsSection: React.FC<RelationshipsSectionProps> = () => {
<section className="flex flex-1 flex-col overflow-hidden px-2">
<div className="flex items-center justify-between gap-4 py-1">
<div>
- <Button
- variant="ghost"
- className="size-8 p-0"
- onClick={closeAllRelationshipsInSidebar}
- >
- <ListCollapse className="size-4" />
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>
+ <Button
+ variant="ghost"
+ className="size-8 p-0"
+ onClick={closeAllRelationshipsInSidebar}
+ >
+ <ListCollapse className="size-4" />
+ </Button>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ {t('side_panel.relationships_section.collapse')}
+ </TooltipContent>
+ </Tooltip>
</div>
<div className="flex-1">
<Input
diff --git a/src/pages/editor-page/side-panel/tables-section/tables-section.tsx b/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
index a7ffb45a..38ffbf16 100644
--- a/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
+++ b/src/pages/editor-page/side-panel/tables-section/tables-section.tsx
@@ -12,9 +12,8 @@ import { ScrollArea } from '@/components/scroll-area/scroll-area';
import { useTranslation } from 'react-i18next';
import {
Tooltip,
- TooltipTrigger,
TooltipContent,
- TooltipProvider,
+ TooltipTrigger,
} from '@/components/tooltip/tooltip';
export interface TablesSectionProps {}
@@ -34,12 +33,12 @@ export const TablesSection: React.FC<TablesSectionProps> = () => {
}, [tables, filterText]);
return (
- <TooltipProvider>
- <section className="flex flex-1 flex-col overflow-hidden px-2">
- <div className="flex items-center justify-between gap-4 py-1">
- <div>
- <Tooltip>
- <TooltipTrigger asChild>
+ <section className="flex flex-1 flex-col overflow-hidden px-2">
+ <div className="flex items-center justify-between gap-4 py-1">
+ <div>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>
<Button
variant="ghost"
className="size-8 p-0"
@@ -47,46 +46,48 @@ export const TablesSection: React.FC<TablesSectionProps> = () => {
>
<ListCollapse className="size-4" />
</Button>
- </TooltipTrigger>
- <TooltipContent side="top">Collapse</TooltipContent>
- </Tooltip>
- </div>
- <div className="flex-1">
- <Input
- type="text"
- placeholder={t('side_panel.tables_section.filter')}
- className="h-8 w-full focus-visible:ring-0"
- value={filterText}
- onChange={(e) => setFilterText(e.target.value)}
- />
- </div>
- <Button
- variant="secondary"
- className="h-8 p-2 text-xs"
- onClick={createTable}
- >
- <Table className="h-4" />
- {t('side_panel.tables_section.add_table')}
- </Button>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ {t('side_panel.tables_section.collapse')}
+ </TooltipContent>
+ </Tooltip>
</div>
- <div className="flex flex-1 flex-col overflow-hidden">
- <ScrollArea className="h-full">
- {tables.length === 0 ? (
- <EmptyState
- title={t(
- 'side_panel.tables_section.empty_state.title'
- )}
- description={t(
- 'side_panel.tables_section.empty_state.description'
- )}
- className="mt-20"
- />
- ) : (
- <TableList tables={filteredTables} />
- )}
- </ScrollArea>
+ <div className="flex-1">
+ <Input
+ type="text"
+ placeholder={t('side_panel.tables_section.filter')}
+ className="h-8 w-full focus-visible:ring-0"
+ value={filterText}
+ onChange={(e) => setFilterText(e.target.value)}
+ />
</div>
- </section>
- </TooltipProvider>
+ <Button
+ variant="secondary"
+ className="h-8 p-2 text-xs"
+ onClick={createTable}
+ >
+ <Table className="h-4" />
+ {t('side_panel.tables_section.add_table')}
+ </Button>
+ </div>
+ <div className="flex flex-1 flex-col overflow-hidden">
+ <ScrollArea className="h-full">
+ {tables.length === 0 ? (
+ <EmptyState
+ title={t(
+ 'side_panel.tables_section.empty_state.title'
+ )}
+ description={t(
+ 'side_panel.tables_section.empty_state.description'
+ )}
+ className="mt-20"
+ />
+ ) : (
+ <TableList tables={filteredTables} />
+ )}
+ </ScrollArea>
+ </div>
+ </section>
);
};