-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathoverview.tsx
More file actions
68 lines (60 loc) · 1.98 KB
/
overview.tsx
File metadata and controls
68 lines (60 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React, { useContext } from "react";
import { useParams } from "react-router-dom";
import { AppContext } from "../../../../app-context.jsx";
import { SelectedTenantLedger } from "../../api/selected-tenant-ledger.jsx";
export function LedgerOverview() {
const { tenantId, ledgerId } = useParams();
const { cloud } = useContext(AppContext);
// const listTenants = cloud.getListTenantsByUser();
const listTenantsLedgers = cloud.getListTenantsLedgersByUser();
const cloudToken = cloud.getCloudToken();
if (listTenantsLedgers.isPending) {
return <div>Loading...</div>;
}
if (cloudToken.isPending) {
return <div>Loading...</div>;
}
if (!cloudToken.data) {
return <div>Not found</div>;
}
if (!listTenantsLedgers.data) {
return <div>Not found</div>;
}
if (!ledgerId) {
return <div>Not found</div>;
}
if (!tenantId) {
return <div>Not found</div>;
}
const tenant = listTenantsLedgers.data.find((t) => t.tenant.tenantId === tenantId);
if (!tenant) {
return <div>Not found</div>;
}
const ledger = tenant.ledgers.find((l) => l.ledgerId === ledgerId);
if (!ledger) {
return <div>Not found</div>;
}
return (
<div className="space-y-6 p-6">
<div className="bg-[--muted] shadow sm:rounded-lg p-6">
<h2 className="text-lg font-semibold text-[--foreground] mb-4">Onboarding - Quickstart</h2>
<div className="text-[--muted-foreground]">
To connect your database to Fireproof Cloud, use this code:
<SelectedTenantLedger
tenantAndLedger={{
tenant: tenantId,
ledger: ledgerId,
}}
cloudToken={cloudToken.data.token}
dbName={ledger.name}
/>
To learn more about using Fireproof Cloud, check out our{" "}
<a href="https://use-fireproof.com/docs/getting-started" className="text-[--accent] hover:underline">
documentation
</a>
.
</div>
</div>
</div>
);
}