import { useEffect, useState } from "react";
import logo_light from "../assets/logo_light_46.png";
import { Link } from "react-router-dom";
import { Tabs, TabPane } from "@douyinfe/semi-ui";
import { db } from "../data/db";
import { calcPath } from "../utils";
function Thumbnail({ diagram, i }) {
const zoom = 0.3;
return (
{diagram.subjectAreas?.map((a) => (
0 ? a.width * zoom : 0}
height={a.height > 0 ? a.height * zoom : 0}
>
{a.name}
))}
{diagram.tables?.map((table, i) => {
const height = table.fields.length * 36 + 50 + 7;
return (
{table.name}
{table.fields.map((f, j) => (
))}
);
})}
{diagram.relationships?.map((e, i) => (
))}
{diagram.notes?.map((n) => {
const x = n.x * zoom;
const y = n.y * zoom;
const w = 180 * zoom;
const r = 3 * zoom;
const fold = 24 * zoom;
const h = n.height * zoom;
return (
);
})}
);
}
export default function Templates() {
const [defaultTemplates, setDefaultTemplates] = useState([]);
const [customTemplates, setCustomTemplates] = useState([]);
useEffect(() => {
document.title = "Templates | drawDB";
const loadTemplates = async () => {
const def = await db.templates.where({ custom: 0 }).toArray();
setDefaultTemplates(def);
const custom = await db.templates.where({ custom: 1 }).toArray();
setCustomTemplates(custom);
};
loadTemplates();
}, []);
return (
Templates
Database schema templates
A compilation of database entity relationship diagrams to give you
a quick start or inspire your application's architecture.
Default templates}
itemKey="1"
>
{defaultTemplates?.map((t, i) => (
))}
Your templates}
itemKey="2"
>
{customTemplates?.map((c, i) => (
))}
© 2024 drawDB - All right reserved.
);
}