@@ -5,34 +5,25 @@ import { chunk } from 'lodash'
5
5
import Link from 'next/link'
6
6
import { useState } from 'react'
7
7
import { useApp } from '~/components/app-provider'
8
- import {
9
- Accordion ,
10
- AccordionContent ,
11
- AccordionItem ,
12
- AccordionTrigger ,
13
- } from '~/components/ui/accordion'
14
8
import { Button } from '~/components/ui/button'
15
9
import { Dialog , DialogContent , DialogHeader , DialogTitle } from '~/components/ui/dialog'
16
10
import { Progress } from '~/components/ui/progress'
17
11
import { DbManager } from '~/lib/db'
18
12
import { countFiles , listFiles } from '~/lib/files'
13
+ import { useOrigin } from '~/lib/hooks'
19
14
import {
20
15
fileFromStream ,
21
16
fileToTarStreamFile ,
22
17
mergeIterables ,
23
18
readableStreamFromIterable ,
24
19
transformStreamFromFn ,
25
20
} from '~/lib/streams'
26
- import {
27
- currentDomainHostname ,
28
- currentDomainUrl ,
29
- downloadFile ,
30
- legacyDomainHostname ,
31
- } from '~/lib/util'
21
+ import { downloadFile } from '~/lib/util'
32
22
33
23
export default function Page ( ) {
34
24
const { dbManager } = useApp ( )
35
25
const [ progress , setProgress ] = useState < number > ( )
26
+ const origin = useOrigin ( )
36
27
37
28
return (
38
29
< >
@@ -42,61 +33,15 @@ export default function Page() {
42
33
< DialogTitle > Export your databases</ DialogTitle >
43
34
< div className = "py-2 border-b" />
44
35
</ DialogHeader >
36
+ < p > All databases live locally within your browser's local IndexedDB storage.</ p >
45
37
< p >
46
- { legacyDomainHostname } is renaming to { currentDomainHostname } , which means you need to
47
- transfer your databases if you wish to continue using them .
38
+ You can backup and restore your databases in order to transfer them between browsers or
39
+ devices .
48
40
</ p >
49
41
50
- < Accordion type = "single" collapsible >
51
- < AccordionItem value = "item-1" className = "border rounded-md" >
52
- < AccordionTrigger className = "p-0 gap-2 px-3 py-2" >
53
- < div className = "flex gap-2 items-center font-normal text-lighter text-sm" >
54
- < span >
55
- Why is { legacyDomainHostname } renaming to { currentDomainHostname } ?
56
- </ span >
57
- </ div >
58
- </ AccordionTrigger >
59
- < AccordionContent className = "p-3 prose prose-sm" >
60
- This project is not an official Postgres project and we don't want to mislead
61
- anyone! We're renaming to{ ' ' }
62
- < Link href = { currentDomainUrl } className = "underline" >
63
- { currentDomainHostname }
64
- </ Link > { ' ' }
65
- because, well, that's what this does. This will still be 100% Postgres-focused,
66
- just with a different URL.
67
- </ AccordionContent >
68
- </ AccordionItem >
69
- </ Accordion >
70
- < Accordion type = "single" collapsible >
71
- < AccordionItem value = "item-1" className = "border rounded-md" >
72
- < AccordionTrigger className = "p-0 gap-2 px-3 py-2" >
73
- < div className = "flex gap-2 items-center font-normal text-lighter text-sm" >
74
- < span > Why do I need to export my databases?</ span >
75
- </ div >
76
- </ AccordionTrigger >
77
- < AccordionContent className = "p-3 prose prose-sm" >
78
- < p >
79
- Since PGlite databases are stored in your browser's IndexedDB storage, other
80
- domains like{ ' ' }
81
- < Link href = { currentDomainUrl } className = "underline" >
82
- { currentDomainHostname }
83
- </ Link > { ' ' }
84
- cannot access them directly (this is a security restriction built into every
85
- browser).
86
- </ p >
87
- < p >
88
- If you'd like to continue using your previous databases and conversations:
89
- < ol >
90
- < li > Export them from { legacyDomainHostname } </ li >
91
- < li > Import them to { currentDomainHostname } </ li >
92
- </ ol >
93
- </ p >
94
- </ AccordionContent >
95
- </ AccordionItem >
96
- </ Accordion >
97
42
< div className = "my-2 border-b" />
98
43
< div className = "prose" >
99
- < h4 className = "mb-4" > How to transfer your databases to { currentDomainHostname } </ h4 >
44
+ < h4 className = "mb-4" > How to export and import your databases </ h4 >
100
45
< ol >
101
46
< li >
102
47
Click < strong > Export</ strong > to download all of your databases into a single
@@ -158,12 +103,11 @@ export default function Page() {
158
103
) }
159
104
< br />
160
105
This tarball will contain every PGlite database's < code > pgdata</ code > dump
161
- along with any files you imported or exported from { legacyDomainHostname } .
106
+ along with any files that you imported or exported in your chats .
162
107
</ li >
163
108
< li >
164
- Navigate to{ ' ' }
165
- < Link href = { `${ currentDomainUrl } /import` } > { currentDomainHostname } /import</ Link > and
166
- click < strong > Import</ strong > .
109
+ Navigate to < Link href = "/import" > { origin ?? '' } /import</ Link > and click{ ' ' }
110
+ < strong > Import</ strong > .
167
111
</ li >
168
112
</ ol >
169
113
</ div >
0 commit comments