Skip to content

Commit

Permalink
fix importing compatibility bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy committed Jan 18, 2024
1 parent 092d473 commit 6beb372
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/src/AboutDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</script>


<sl-dialog label="KanDo!: UI v0.8.13 for DNA v0.7.0" bind:this={dialog} width={600} >
<sl-dialog label="KanDo!: UI v0.8.14 for DNA v0.7.0" bind:this={dialog} width={600} >
<div class="about">
<p>KanDo! is a demonstration Holochain app built by the Holochain Foundation.</p>
<p> <b>Developers:</b>
Expand Down
15 changes: 13 additions & 2 deletions ui/src/export.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import type { BoardState } from "./board"
import sanitize from "sanitize-filename";

interface BoardsExport {
version: string,
boards: Array<BoardState>
}

const EXPORT_FORMAT_VERSION = "1"
const PREFIX = "kando"
const download = (filename: string, text: string) => {
Expand Down Expand Up @@ -33,7 +38,7 @@ export const exportBoards = (boards: Array<BoardState>) => {
}

const _exportBoards = (fileName:string, boards: Array<BoardState>) => {
const exportObject = {
const exportObject: BoardsExport = {
version: EXPORT_FORMAT_VERSION,
boards,
}
Expand All @@ -42,7 +47,7 @@ const _exportBoards = (fileName:string, boards: Array<BoardState>) => {

export const deserializeExport = (jsonExport:string) : Array<BoardState> => {
try {
const exportObject = JSON.parse(jsonExport)
const exportObject: BoardsExport = JSON.parse(jsonExport) as BoardsExport
if (!exportObject.version) {
throw("Expected export to have a version number")
}
Expand All @@ -52,6 +57,12 @@ export const deserializeExport = (jsonExport:string) : Array<BoardState> => {
if (!board.props.attachments) {
board.props.attachments = []
}
for (const card of board.cards) {
if (!card.props.attachments) {
card.props.attachments = []
}
}

}
return exportObject.boards

Expand Down

0 comments on commit 6beb372

Please sign in to comment.