diff --git a/src/data/seeds.js b/src/data/seeds.js index ce6691a..a6ffc33 100644 --- a/src/data/seeds.js +++ b/src/data/seeds.js @@ -28,6 +28,8 @@ const t1 = { notes: [], subjectAreas: [], types: [], + title: "Template 1", + description: "Lorem ipsum", }; const t2 = { @@ -60,6 +62,8 @@ const t2 = { notes: [], subjectAreas: [], types: [], + title: "Template 2", + description: "Lorem ipsum", }; const t3 = { @@ -92,6 +96,8 @@ const t3 = { notes: [], subjectAreas: [], types: [], + title: "Template 3", + description: "Lorem ipsum", }; const t4 = { @@ -124,6 +130,8 @@ const t4 = { notes: [], subjectAreas: [], types: [], + title: "Template 4", + description: "Lorem ipsum", }; const t5 = { @@ -156,6 +164,8 @@ const t5 = { notes: [], subjectAreas: [], types: [], + title: "Template 5", + description: "Lorem ipsum", }; const t6 = { @@ -188,6 +198,8 @@ const t6 = { notes: [], subjectAreas: [], types: [], + title: "Template 6", + description: "Lorem ipsum", }; const t7 = { @@ -220,6 +232,8 @@ const t7 = { notes: [], subjectAreas: [], types: [], + title: "Template 7", + description: "Lorem ipsum", }; const t8 = { @@ -252,6 +266,8 @@ const t8 = { notes: [], subjectAreas: [], types: [], + title: "Template 8", + description: "Lorem ipsum", }; const templateSeeds = [t1, t2, t3, t4, t5, t6, t7, t8]; diff --git a/src/pages/Templates.jsx b/src/pages/Templates.jsx index 04154c7..fddf9fe 100644 --- a/src/pages/Templates.jsx +++ b/src/pages/Templates.jsx @@ -1,11 +1,119 @@ -import React from "react"; +import React, { useEffect } 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 { useLiveQuery } from "dexie-react-hooks"; +import { db } from "../data/db"; + +function cardCanvas(diagram) { + return ( +
+ + + + + + + + + {/* {diagram.areas.map((a) => ( + {}} + setResize={null} + initCoords={null} + setInitCoords={null} + zoom={null} + > + ))} */} + {diagram.tables.map((table, i) => { + const height = table.fields.length * 36 + 50 + 7; + return ( + +
+
+
+
+ {table.name} +
+ {table.fields.map((f, j) => ( +
+
+
+
{f.name}
+
+
{f.type}
+
+ ))} +
+
+
+ ); + })} + {/* + {diagram.relationships.map((e, i) => ( + + ))} + {diagram.notes.map((n) => ( + + {} + } + > + ))} */} +
+
+
+ ); +} export default function Templates() { + const templates = useLiveQuery(() => db.templates.toArray()); + + useEffect(() => { + document.title = "Templates | drawDB"; + }, []); + 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" + > +
+ {templates?.map((t, i) => ( +
+ {cardCanvas(t)} +
{t.title}
+
{t.description}
+
+ ))} +
+
+ Your templates} + itemKey="2" + > + Your templates + +
+
); }