diff --git a/apps/web/app/(dash)/(memories)/content.tsx b/apps/web/app/(dash)/(memories)/content.tsx index 4514d851..47ba5e13 100644 --- a/apps/web/app/(dash)/(memories)/content.tsx +++ b/apps/web/app/(dash)/(memories)/content.tsx @@ -60,6 +60,26 @@ export function MemoriesPage({ const [filter, setFilter] = useState(initialFilter); + const handleExport = () => { + const dataToExport = sortedItems.map((item) => ({ + type: item.item, + date: new Date(item.date).toISOString(), + data: item.data, + })); + + const json = JSON.stringify(dataToExport, null, 2); + const blob = new Blob([json], { type: "application/json" }); + const url = URL.createObjectURL(blob); + + const a = document.createElement("a"); + a.href = url; + a.download = "memories_and_spaces.json"; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(url); + }; + // Sort Both memories and spaces by their savedAt and createdAt dates respectfully. // The output should be just one single list of items // And it will look something like { item: "memory" | "space", date: Date, data: Content | StoredSpace } @@ -172,13 +192,21 @@ export function MemoriesPage({ )} - +
+ + +