@@ -5,34 +5,25 @@ import { chunk } from 'lodash'
55import Link from 'next/link'
66import { useState } from 'react'
77import { useApp } from '~/components/app-provider'
8- import {
9- Accordion ,
10- AccordionContent ,
11- AccordionItem ,
12- AccordionTrigger ,
13- } from '~/components/ui/accordion'
148import { Button } from '~/components/ui/button'
159import { Dialog , DialogContent , DialogHeader , DialogTitle } from '~/components/ui/dialog'
1610import { Progress } from '~/components/ui/progress'
1711import { DbManager } from '~/lib/db'
1812import { countFiles , listFiles } from '~/lib/files'
13+ import { useOrigin } from '~/lib/hooks'
1914import {
2015 fileFromStream ,
2116 fileToTarStreamFile ,
2217 mergeIterables ,
2318 readableStreamFromIterable ,
2419 transformStreamFromFn ,
2520} from '~/lib/streams'
26- import {
27- currentDomainHostname ,
28- currentDomainUrl ,
29- downloadFile ,
30- legacyDomainHostname ,
31- } from '~/lib/util'
21+ import { downloadFile } from '~/lib/util'
3222
3323export default function Page ( ) {
3424 const { dbManager } = useApp ( )
3525 const [ progress , setProgress ] = useState < number > ( )
26+ const origin = useOrigin ( )
3627
3728 return (
3829 < >
@@ -42,61 +33,15 @@ export default function Page() {
4233 < DialogTitle > Export your databases</ DialogTitle >
4334 < div className = "py-2 border-b" />
4435 </ DialogHeader >
36+ < p > All databases live locally within your browser's local IndexedDB storage.</ p >
4537 < 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 .
4840 </ p >
4941
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 >
9742 < div className = "my-2 border-b" />
9843 < 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 >
10045 < ol >
10146 < li >
10247 Click < strong > Export</ strong > to download all of your databases into a single
@@ -158,12 +103,11 @@ export default function Page() {
158103 ) }
159104 < br />
160105 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 .
162107 </ li >
163108 < 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 > .
167111 </ li >
168112 </ ol >
169113 </ div >
0 commit comments